tray-hintergrundbetrieb, favoriten, neustart-fix

- Desktop-App läuft beim Schließen als Symbol neben der Uhr weiter
  (automatisches Backup auch ohne Fenster, Windows-Hinweise), nur eine
  Instanz, optional mit Windows starten (--background)
- Favoriten: Stern an Projekten, eigene Reihe in der einfachen Ansicht,
  immer zuerst sortiert, Filter "Favoriten"
- Fix: geerbtes DASHBOARD_WORKER ließ ein aus dem Dashboard gestartetes
  Dashboard ohne Supervisor laufen ("Neu starten" beendete es)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 21:18:02 +01:00
parent d6f5b1672c
commit f2d0cd1df9
6 changed files with 313 additions and 23 deletions

View File

@@ -11,10 +11,15 @@
// Host header and (for writes) a local Origin, so other web pages can't drive it.
// The process started by the launcher/console only supervises; the real server
// runs as its worker so it can be restarted after an update (lib/supervisor.js).
if (!process.env.DASHBOARD_WORKER) {
// A worker always has the IPC channel (process.send); the variable alone is not
// enough - it would be inherited by programs the dashboard starts (VS Code, consoles)
// and a dashboard started from there would then run without its supervisor.
if (!process.env.DASHBOARD_WORKER || !process.send) {
delete process.env.DASHBOARD_WORKER
require('./lib/supervisor').supervise(__filename)
return
}
delete process.env.DASHBOARD_WORKER // not passed on to anything started from here
// supervisor gone (window closed, killed) → stop too, never left behind
process.on('disconnect', () => process.exit(0))
@@ -131,10 +136,11 @@ function readStatusFile(projectPath) {
start: typeof data.start === 'string' ? data.start.slice(0, 300) : '',
program: typeof data.program === 'string' ? data.program.slice(0, 300) : '',
itch: typeof data.itch === 'string' ? data.itch.slice(0, 300) : '',
favorite: data.favorite === true,
updatedAt: data.updatedAt ?? null,
}
} catch {
return { status: 'idea', priority: 'medium', notes: '', description: '', tags: [], tasks: [], thumbnail: '', start: '', program: '', itch: '', updatedAt: null }
return { status: 'idea', priority: 'medium', notes: '', description: '', tags: [], tasks: [], thumbnail: '', start: '', program: '', itch: '', favorite: false, updatedAt: null }
}
}
@@ -644,7 +650,7 @@ app.patch('/api/projects/:name', (req, res) => {
const projectPath = resolveProject(req.params.name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
const current = readStatusFile(projectPath)
const { status, priority, notes, description, tags, tasks, thumbnail, start, program, itch: itchLink } = req.body ?? {}
const { status, priority, notes, description, tags, tasks, thumbnail, start, program, itch: itchLink, favorite } = req.body ?? {}
// itch: '' = automatic, '-' = not published, otherwise the game's page
let nextItch = current.itch
if (typeof itchLink === 'string') {
@@ -675,6 +681,7 @@ app.patch('/api/projects/:name', (req, res) => {
start: typeof start === 'string' ? start.replace(/[\r\n]+/g, ' ').slice(0, 300) : current.start,
program: nextProgram,
itch: nextItch,
favorite: typeof favorite === 'boolean' ? favorite : current.favorite,
updatedAt: new Date().toISOString(),
}
fs.writeFileSync(path.join(projectPath, STATUS_FILE), JSON.stringify(next, null, 2))