Merge pull request #12 from defunkt/claude/auto-start-app-on-push-zklQA
Add app startup handling in activate endpoint
This commit is contained in:
commit
ee9c4a1d0a
|
|
@ -1,4 +1,4 @@
|
||||||
import { APPS_DIR, allApps, registerApp, removeApp, restartApp } from '$apps'
|
import { APPS_DIR, allApps, registerApp, removeApp, restartApp, startApp } from '$apps'
|
||||||
import { computeHash, generateManifest } from '../sync'
|
import { computeHash, generateManifest } from '../sync'
|
||||||
import { loadGitignore } from '@gitignore'
|
import { loadGitignore } from '@gitignore'
|
||||||
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, watch, writeFileSync } from 'fs'
|
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, watch, writeFileSync } from 'fs'
|
||||||
|
|
@ -329,6 +329,9 @@ router.post('/apps/:app/activate', async c => {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return c.json({ error: `Failed to restart app: ${e instanceof Error ? e.message : String(e)}` }, 500)
|
return c.json({ error: `Failed to restart app: ${e instanceof Error ? e.message : String(e)}` }, 500)
|
||||||
}
|
}
|
||||||
|
} else if (app.state === 'stopped' || app.state === 'invalid') {
|
||||||
|
// App not running (possibly due to error) - try to start it
|
||||||
|
startApp(appName)
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.json({ ok: true })
|
return c.json({ ok: true })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user