5.3 KiB
5.3 KiB
GitHub Gists Backup Testing Guide
Overview
Writingway 2 now includes automatic cloud backup to GitHub Gists. This guide will help you test all the backup features.
Prerequisites
- GitHub account
- GitHub Personal Access Token with
gistpermission
Setup GitHub Token
-
Go to GitHub Token Settings
- Visit: https://github.com/settings/tokens
- Click "Developer settings" → "Personal access tokens" → "Tokens (classic)"
- Click "Generate new token (classic)"
-
Configure Token
- Note:
Writingway Backup - Expiration: Choose your preference (e.g., "No expiration")
- Permissions: Check only the
gistcheckbox - Click "Generate token"
- Copy the token immediately (you won't see it again!)
- Note:
Testing Steps
1. Initial Setup
- Start Writingway 2 using
start.bat - Create a test project (or use existing one):
- Add a few chapters
- Add some scenes with content
- Add some compendium entries
- Open the main menu (☰) and click "☁️ Cloud Backup"
- Paste your GitHub token in the "GitHub Token" field
- Click "Save Settings"
- Expected: Status shows "✓ Connected as: [your-username]"
2. Manual Backup
- Click "Backup Now" button
- Expected:
- Status shows "Backing up..."
- Then shows "Backed up"
- Alert: "Backup successful!"
- Go to https://gist.github.com/
- Verify: You should see a new private Gist with your project name
3. Auto-Backup
- In the Cloud Backup settings, check "Enable automatic backup (every 5 minutes)"
- Click "Save Settings"
- Make some changes to your project:
- Edit scene content
- Add a new chapter
- Modify compendium entries
- Wait 5 minutes
- Check the console (F12) for:
✓ Auto-backup successful - Go to your Gist on GitHub
- Click "Revisions" tab
- Verify: Multiple versions should appear
4. Restore from Backup
- Make significant changes to your project that you'll recognize:
- Add a scene titled "TEST SCENE - TO BE DELETED"
- Add some unique content
- Click "Backup Now" to save this state
- Make MORE changes:
- Delete the test scene
- Add different content
- Click "📥 Restore from Backup"
- Expected: Modal shows list of backups with timestamps
- Select the most recent backup (top of list)
- Click "Restore"
- Confirm the warning dialog
- Verify:
- Project reloads
- "TEST SCENE - TO BE DELETED" is back
- All content matches the backup
5. Multiple Projects
- Create a second test project
- Add some content
- Click "Backup Now"
- Go to GitHub Gists
- Verify: Two separate Gists (one per project)
- Switch between projects
- Click "Backup Now" for each
- Verify: Each project updates its own Gist
6. Error Handling
Test these scenarios:
Invalid Token:
- Enter a fake token:
ghp_fake123456789 - Click "Save Settings"
- Expected: Alert: "Invalid GitHub token: Invalid token"
No Token:
- Clear the token field
- Try "Backup Now"
- Expected: Alert: "Please configure GitHub token and select a project first."
Restore Without Backup:
- Create a brand new project (never backed up)
- Try "📥 Restore from Backup"
- Expected: Alert: "No backup configured for this project."
7. Persistence Test
- Configure backup settings (token + auto-backup enabled)
- Close the browser
- Reopen Writingway 2
- Open Cloud Backup settings
- Verify:
- Token is still there (masked as dots)
- Auto-backup checkbox is still checked
- Username is shown
- Wait 5 minutes
- Verify: Auto-backup runs automatically
Expected Backup Contents
Each backup JSON should contain:
version: "2.0"exportedAt: ISO timestampproject: Project metadatachapters: Array of all chaptersscenes: Array of all scenessceneContents: Object mapping scene IDs to text contentcompendium: Array of compendium entriesprompts: Array of custom prompts
Troubleshooting
Backup Not Working
- Check browser console (F12) for errors
- Verify token has
gistpermission - Check network tab for API responses
Auto-Backup Not Running
- Check "Enable automatic backup" is checked
- Verify token is saved
- Check console for timer initialization message
- Wait the full 5 minutes (timer starts from app load)
Restore Not Working
- Verify the Gist exists on GitHub
- Check that
currentProjectGistIdis set (it's automatic after first backup) - Look for error messages in browser console
Success Criteria
✅ Token validation works ✅ Manual backup creates/updates Gist ✅ Auto-backup runs every 5 minutes ✅ Backup list shows all versions ✅ Restore recovers all project data ✅ Settings persist across sessions ✅ Each project has separate Gist ✅ Error messages are clear and helpful
Notes
- Backups are private by default (not visible to others)
- GitHub has no storage limits for Gists
- Version history is kept indefinitely by GitHub
- You can manually edit/delete Gists from https://gist.github.com/
- Auto-backup only runs when the app is open
- Backups include everything EXCEPT workshop chat sessions
Security
- Token is stored in
localStorage(local to your browser) - Token is sent only to
api.github.comvia HTTPS - All Gists are private (unless you manually change them)
- You can revoke the token anytime from GitHub settings