|
| 1 | +# New GitHub Release Update System |
| 2 | + |
| 3 | +## Overview |
| 4 | +The Mixtape Engine now features a comprehensive GitHub-based update system that replaces the old version-checking system. This new system provides users with full control over which releases to install and gives developers powerful tools for creating and managing releases directly from the engine. |
| 5 | + |
| 6 | +## Features |
| 7 | + |
| 8 | +### For Users |
| 9 | + |
| 10 | +#### Release Selection (F6 or Ctrl+U) |
| 11 | +- **Access**: Available from Main Menu with `F6` or `Ctrl+U` |
| 12 | +- **Functionality**: |
| 13 | + - Displays all available GitHub releases in a scrollable list |
| 14 | + - Shows release information including version, date, changelog, and file sizes |
| 15 | + - Allows selection of any release to install (not just the latest) |
| 16 | + - Automatically detects platform-compatible files |
| 17 | + - Provides detailed release notes and asset information |
| 18 | + |
| 19 | +#### Automatic Update Checking |
| 20 | +- When the engine detects a newer version is available, it now redirects to the Release Selection screen instead of forcing an immediate update |
| 21 | +- Users can choose to update or continue with their current version |
| 22 | +- No more forced updates - complete user control |
| 23 | + |
| 24 | +### For Developers (Live Reload Mode Only) |
| 25 | + |
| 26 | +#### Developer Release Tool (F5 in Live Reload) |
| 27 | +- **Access**: Only available when engine is launched with `-livereload` flag |
| 28 | +- **Authentication**: Secure GitHub token storage with XOR encryption |
| 29 | +- **Features**: |
| 30 | + - GitHub authentication with personal access tokens |
| 31 | + - Repository access verification |
| 32 | + - User information display |
| 33 | + - Release creation capability |
| 34 | + - Asset packaging and upload tools |
| 35 | + |
| 36 | +## Usage Guide |
| 37 | + |
| 38 | +### Installing Updates (Users) |
| 39 | + |
| 40 | +1. **Automatic Prompt**: When a new version is detected, you'll be taken to the Release Selection screen |
| 41 | +2. **Manual Access**: Press `F6` or `Ctrl+U` from the Main Menu |
| 42 | +3. **Browse Releases**: Use UP/DOWN arrows to navigate through available releases |
| 43 | +4. **View Details**: Each release shows: |
| 44 | + - Version number and stability (Stable/Pre-release) |
| 45 | + - Release date |
| 46 | + - Changelog/description |
| 47 | + - Available download files and sizes |
| 48 | +5. **Install**: Press ENTER to install the selected release |
| 49 | +6. **Cancel**: Press ESCAPE to return to the main menu |
| 50 | + |
| 51 | +### Creating Releases (Developers) |
| 52 | + |
| 53 | +1. **Launch in Live Reload**: Start engine with `-livereload` flag |
| 54 | +2. **Access Dev Tools**: Press `F5` from Main Menu |
| 55 | +3. **Authenticate**: |
| 56 | + - Select "Authenticate with GitHub" |
| 57 | + - Enter your GitHub Personal Access Token |
| 58 | + - Token requires `repo` scope for full functionality |
| 59 | +4. **Create Release**: |
| 60 | + - Select "Create Release" |
| 61 | + - Fill in version, title, description |
| 62 | + - Mark as pre-release if needed |
| 63 | +5. **Upload Assets**: |
| 64 | + - Select "Package and Upload" |
| 65 | + - Engine will create zip file excluding mods folder |
| 66 | + - Upload directly to the created release |
| 67 | + |
| 68 | +## Technical Details |
| 69 | + |
| 70 | +### File Structure |
| 71 | +``` |
| 72 | +source/backend/GitHubAPI.hx - GitHub API integration |
| 73 | +source/states/ReleaseSelectionState.hx - Release selection UI |
| 74 | +source/states/DevReleaseToolState.hx - Developer tools |
| 75 | +source/substates/TokenInputSubstate.hx - Token input interface |
| 76 | +source/states/UpdateState.hx - Modified update downloader |
| 77 | +``` |
| 78 | + |
| 79 | +### GitHub API Integration |
| 80 | +- **Authentication**: Personal Access Tokens with secure local storage |
| 81 | +- **Release Management**: Full CRUD operations for releases |
| 82 | +- **Asset Handling**: Upload and download of release assets |
| 83 | +- **Repository Access**: Verification of push permissions |
| 84 | +- **Error Handling**: Comprehensive error handling and user feedback |
| 85 | + |
| 86 | +### Security Features |
| 87 | +- Token encryption using XOR cipher for basic protection |
| 88 | +- No tokens stored in plain text |
| 89 | +- Token validation before storage |
| 90 | +- Repository permission verification |
| 91 | +- Secure cleanup on authentication clear |
| 92 | + |
| 93 | +### Platform Support |
| 94 | +- Automatic platform detection (Windows, macOS, Linux, Android) |
| 95 | +- Platform-specific asset filtering |
| 96 | +- Cross-platform compatible packaging |
| 97 | +- Universal download support |
| 98 | + |
| 99 | +## API Reference |
| 100 | + |
| 101 | +### GitHubAPI Class Methods |
| 102 | + |
| 103 | +#### Public Release Access |
| 104 | +- `getPublicReleases(callback, errorCallback)` - Fetch all public releases |
| 105 | +- `getPlatformAssets(release)` - Filter assets for current platform |
| 106 | +- `formatFileSize(bytes)` - Human-readable file size formatting |
| 107 | +- `formatDate(dateString)` - User-friendly date formatting |
| 108 | + |
| 109 | +#### Authentication |
| 110 | +- `setAuthToken(token)` - Set and save authentication token |
| 111 | +- `loadAuthToken()` - Load saved token from disk |
| 112 | +- `clearAuth()` - Clear authentication and delete saved token |
| 113 | +- `validateToken(token, callback)` - Verify token validity |
| 114 | +- `isAuthenticated()` - Check current authentication status |
| 115 | + |
| 116 | +#### Authenticated Operations |
| 117 | +- `getUserInfo(callback, errorCallback)` - Get authenticated user information |
| 118 | +- `hasRepoAccess(callback, errorCallback)` - Verify repository permissions |
| 119 | +- `createRelease(releaseData, callback, errorCallback)` - Create new release |
| 120 | +- `uploadReleaseAsset(releaseId, filePath, fileName, contentType, progressCallback, callback, errorCallback)` - Upload files to release |
| 121 | + |
| 122 | +## Configuration |
| 123 | + |
| 124 | +### Client Preferences |
| 125 | +- `ClientPrefs.data.checkForUpdates` - Enable/disable automatic update checking |
| 126 | +- Engine respects existing update preferences |
| 127 | + |
| 128 | +### Build Flags |
| 129 | +No additional build flags required - works with existing engine configuration. |
| 130 | + |
| 131 | +## Migration from Old System |
| 132 | + |
| 133 | +### What Changed |
| 134 | +- `OutdatedState` replaced with `ReleaseSelectionState` |
| 135 | +- Version-based updates replaced with user-selected releases |
| 136 | +- Added developer tools for release management |
| 137 | +- Enhanced update UI with detailed release information |
| 138 | + |
| 139 | +### Backwards Compatibility |
| 140 | +- Existing update preferences are respected |
| 141 | +- Version checking still works but redirects to new system |
| 142 | +- No breaking changes to existing workflows |
| 143 | + |
| 144 | +## Troubleshooting |
| 145 | + |
| 146 | +### Common Issues |
| 147 | + |
| 148 | +#### "Not Authenticated" Error |
| 149 | +- Ensure you have a valid GitHub Personal Access Token |
| 150 | +- Verify token has `repo` scope |
| 151 | +- Check internet connection |
| 152 | + |
| 153 | +#### "No Repository Access" Warning |
| 154 | +- Token user must have push access to the repository |
| 155 | +- Contact repository maintainer for access |
| 156 | +- Verify token permissions |
| 157 | + |
| 158 | +#### "No Compatible Files" Error |
| 159 | +- Release may not have files for your platform |
| 160 | +- Check release assets manually on GitHub |
| 161 | +- Contact developer for platform-specific builds |
| 162 | + |
| 163 | +#### Download Failures |
| 164 | +- Check internet connection |
| 165 | +- Verify GitHub API rate limits |
| 166 | +- Try again after a few minutes |
| 167 | + |
| 168 | +### Debug Information |
| 169 | +- Enable debug logging in engine |
| 170 | +- Check console output for detailed error messages |
| 171 | +- Review GitHub API responses in network tools |
| 172 | + |
| 173 | +## Best Practices |
| 174 | + |
| 175 | +### For Users |
| 176 | +- Always backup your mods before updating |
| 177 | +- Read release notes before installing |
| 178 | +- Use stable releases for important projects |
| 179 | +- Test pre-releases in separate environments |
| 180 | + |
| 181 | +### For Developers |
| 182 | +- Always test releases before publishing |
| 183 | +- Include comprehensive changelogs |
| 184 | +- Tag versions consistently |
| 185 | +- Exclude unnecessary files from releases |
| 186 | +- Test on multiple platforms before release |
| 187 | + |
| 188 | +## Security Considerations |
| 189 | + |
| 190 | +### Token Management |
| 191 | +- Keep Personal Access Tokens secure |
| 192 | +- Use tokens with minimal required permissions |
| 193 | +- Rotate tokens regularly |
| 194 | +- Never share tokens publicly |
| 195 | + |
| 196 | +### Release Verification |
| 197 | +- Verify release authenticity |
| 198 | +- Check checksums when available |
| 199 | +- Only download from official repository |
| 200 | +- Be cautious with pre-release versions |
| 201 | + |
| 202 | +## Future Enhancements |
| 203 | + |
| 204 | +### Planned Features |
| 205 | +- Automatic checksumming for release verification |
| 206 | +- Incremental updates for smaller downloads |
| 207 | +- Release signing and verification |
| 208 | +- Advanced filtering and search options |
| 209 | +- Release scheduling and automation |
| 210 | +- Multi-repository support |
| 211 | +- Rollback functionality |
| 212 | +- Update history and changelogs |
| 213 | + |
| 214 | +### Developer Tools Expansion |
| 215 | +- Automated building and packaging |
| 216 | +- CI/CD integration |
| 217 | +- Release template system |
| 218 | +- Bulk asset management |
| 219 | +- Release analytics and statistics |
| 220 | + |
| 221 | +This new system provides a much more flexible and powerful update mechanism while maintaining ease of use for end users and providing powerful tools for developers. |
0 commit comments