()
| 2243 | } |
| 2244 | |
| 2245 | function triggerGitHubAutoSync() { |
| 2246 | const studio = loadStudioConfig(); |
| 2247 | if (!studio.githubAutoSync) return; |
| 2248 | |
| 2249 | if (autoSyncTimer) clearTimeout(autoSyncTimer); |
| 2250 | |
| 2251 | console.log('[AutoSync] Change detected, scheduling GitHub backup in 15s...'); |
| 2252 | autoSyncTimer = setTimeout(async () => { |
| 2253 | console.log('[AutoSync] Starting GitHub backup...'); |
| 2254 | try { |
| 2255 | const result = await performGitHubBackup(); |
| 2256 | console.log(`[AutoSync] Backup completed: ${result.message || 'Pushed to GitHub'}`); |
| 2257 | } catch (err) { |
| 2258 | console.error('[AutoSync] Backup failed:', err.message); |
| 2259 | } |
| 2260 | }, 15000); // 15s debounce |
| 2261 | } |
| 2262 | |
| 2263 | app.get('/api/github/backup/status', async (req, res) => { |
| 2264 | try { |
no test coverage detected