Add update testing functionality

- Add test mode for simulating available updates
- Implement a toggle to enable/disable test mode
- Add test parameter to check-updates endpoint
- Clean up debugging comments
- Create subtle testing UI controls

This enables testing the update functionality without needing
to create a new higher version in the repository.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-03-05 00:12:17 +00:00
parent 7c7697c2cd
commit 7041d59267
4 changed files with 200 additions and 1 deletions

View File

@@ -64,7 +64,24 @@ app.get('/api/system/check-updates', async (req, res) => {
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
const currentVersion = packageJson.version;
// Fetch latest updates without applying them
// Check for test mode flag which forces update availability for testing
const testMode = req.query.test === 'true';
if (testMode) {
// In test mode, always return that an update is available
return res.json({
status: 'success',
data: {
updateAvailable: true,
currentVersion,
remoteVersion: '2.1.0-test',
commitsBehind: 1,
testMode: true
}
});
}
// Normal mode - fetch latest updates without applying them
await execAsync('git fetch');
// Check if we're behind the remote repository