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

@@ -80,6 +80,19 @@ Oben rechts schaltest du zwischen zwei Ansichten um (gilt für diesen PC, bleibt
Knopf **Neu** oben: leeres Projekt (Ordner mit `README.md`) oder Klon eines vorhandenen. Ein Klon lässt Knopf **Neu** oben: leeres Projekt (Ordner mit `README.md`) oder Klon eines vorhandenen. Ein Klon lässt
`node_modules`, Caches und – abwählbar – Build-Ordner weg; den Git-Verlauf nur auf Wunsch. `node_modules`, Caches und – abwählbar – Build-Ordner weg; den Git-Verlauf nur auf Wunsch.
### Favoriten
Der ☆ an einem Projekt (auf den Kacheln, in der Galerie und oben im Projekt) macht es zum Favoriten.
Favoriten stehen in der einfachen Ansicht in einer eigenen Reihe ganz oben, im Board, in Galerie und Liste immer
zuerst, und es gibt den Filter „Favoriten“. Gespeichert in der `.dashboard.json` des Projekts.
### Im Hintergrund (Symbol neben der Uhr)
In der Desktop-App beendet das Schließen des Fensters das Dashboard nicht: es läuft als Symbol neben der Uhr weiter,
damit das automatische Backup auch ohne offenes Fenster läuft. Ist das Fenster zu, meldet Windows, wenn ein Backup
fertig ist oder fehlschlägt. Doppelklick auf das Symbol öffnet das Fenster, Rechtsklick → **Beenden** beendet alles.
Ein zweiter Start der exe holt einfach das laufende Fenster nach vorn.
Einstellungen → Allgemein → **Fenster**: „Beim Schließen im Hintergrund weiterlaufen“ (Standard: an) und
„Mit Windows starten“ (startet unsichtbar, nur das Symbol). Beides gilt sofort.
### Mehrere Projektordner ### Mehrere Projektordner
Oben links neben dem Logo ist ein Auswahlmenü: Oben links neben dem Logo ist ein Auswahlmenü:
- **Klick auf einen Namen** zeigt nur diesen Ordner, **Häkchen** zeigen mehrere gleichzeitig. - **Klick auf einen Namen** zeigt nur diesen Ordner, **Häkchen** zeigen mehrere gleichzeitig.
@@ -114,8 +127,8 @@ Einzelne Projekte sicherst du im Projekt unter **Aktionen → Jetzt sichern**.
**Automatisch sichern:** Einstellungen → Backup → „Automatisch sichern“: *Aus · Bei jedem Start · Stündlich · **Automatisch sichern:** Einstellungen → Backup → „Automatisch sichern“: *Aus · Bei jedem Start · Stündlich ·
Täglich (Uhrzeit) · Wöchentlich (Tag + Uhrzeit)*, auf ein Ziel oder alle nacheinander. Gesichert werden **alle** Täglich (Uhrzeit) · Wöchentlich (Tag + Uhrzeit)*, auf ein Ziel oder alle nacheinander. Gesichert werden **alle**
Projektordner, auch die gerade nicht angezeigten. Das läuft nur, solange das Dashboard geöffnet ist. Ein verpasster Projektordner, auch die gerade nicht angezeigten. Das läuft, solange das Dashboard läuft – auch im Hintergrund
Termin (PC aus) wird beim nächsten Öffnen nachgeholt; Termine vor dem Einschalten zählen nicht als verpasst. Ist das (siehe „Im Hintergrund“). Ein verpasster Termin (PC aus) wird beim nächsten Start nachgeholt; Termine vor dem Einschalten zählen nicht als verpasst. Ist das
Ziel nicht erreichbar (NAS aus, USB-Platte fehlt), folgt nach 30 Minuten ein neuer Versuch. Die Einstellungen zeigen Ziel nicht erreichbar (NAS aus, USB-Platte fehlt), folgt nach 30 Minuten ein neuer Versuch. Die Einstellungen zeigen
den nächsten Termin und das letzte Ergebnis, der Backup-Knopf zeigt „auto …“, solange es läuft. den nächsten Termin und das letzte Ergebnis, der Backup-Knopf zeigt „auto …“, solange es läuft.

View File

@@ -10,11 +10,22 @@ namespace ProjectDashboard;
static class Program static class Program
{ {
// --background: start only the server and the tray icon (Windows autostart)
[STAThread] [STAThread]
static void Main() static void Main(string[] args)
{ {
// one dashboard per port: a second start brings the running one to the front
var name = $"ProjectDashboard-{MainForm.Port}";
using var mutex = new Mutex(true, name, out var first);
if (!first)
{
try { EventWaitHandle.OpenExisting(name + "-show").Set(); } catch { }
return;
}
using var show = new EventWaitHandle(false, EventResetMode.AutoReset, name + "-show");
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new MainForm()); Application.Run(new MainForm(args.Contains("--background"), show));
GC.KeepAlive(mutex);
} }
} }
@@ -30,7 +41,7 @@ static class Program
sealed class MainForm : Form sealed class MainForm : Form
{ {
// DASHBOARD_PORT (also read by server.js) allows a second instance, e.g. for tests // DASHBOARD_PORT (also read by server.js) allows a second instance, e.g. for tests
static readonly int Port = int.TryParse(Environment.GetEnvironmentVariable("DASHBOARD_PORT"), out var p) ? p : 4848; internal static readonly int Port = int.TryParse(Environment.GetEnvironmentVariable("DASHBOARD_PORT"), out var p) ? p : 4848;
static readonly string BaseUrl = $"http://127.0.0.1:{Port}/"; static readonly string BaseUrl = $"http://127.0.0.1:{Port}/";
// DASHBOARD_HOME moves everything (window state, WebView2, unpacked app, data) - used for tests // DASHBOARD_HOME moves everything (window state, WebView2, unpacked app, data) - used for tests
static readonly string DataDir = Environment.GetEnvironmentVariable("DASHBOARD_HOME") is { Length: > 0 } home static readonly string DataDir = Environment.GetEnvironmentVariable("DASHBOARD_HOME") is { Length: > 0 } home
@@ -51,34 +62,148 @@ sealed class MainForm : Form
Process? server; // only set when this window started the server Process? server; // only set when this window started the server
StreamWriter? serverLog; StreamWriter? serverLog;
public MainForm() // tray: closing the window keeps the dashboard (and the automatic backup) running
readonly NotifyIcon tray = new() { Text = "Projekt-Dashboard" };
readonly System.Windows.Forms.Timer poll = new() { Interval = 20000 };
AppPrefs prefs = AppPrefs.Load();
bool startHidden; // --background: the first Show() is skipped
bool exiting; // "Beenden" in the tray menu: really close
string? lastAutoAt; // last automatic backup result seen (notifications)
string? lastPhase;
bool polledOnce;
public MainForm(bool background = false, EventWaitHandle? showSignal = null)
{ {
Text = "Projekte"; Text = "Projekte";
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
MinimumSize = new Size(900, 560); MinimumSize = new Size(900, 560);
RestoreWindow(); RestoreWindow();
startHidden = background;
SetupTray();
if (showSignal != null)
{
new Thread(() => { while (showSignal.WaitOne()) { try { BeginInvoke(() => ShowFromTray()); } catch { } } }) { IsBackground = true }.Start();
}
FormClosing += (_, e) => FormClosing += (_, e) =>
{ {
if (!exiting && prefs.Tray && e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
SaveWindow();
Hide();
if (!prefs.HintShown)
{
tray.ShowBalloonTip(5000, "Projekt-Dashboard läuft weiter",
"Im Hintergrund – das automatische Backup läuft weiter. Rechtsklick auf das Symbol → Beenden.", ToolTipIcon.Info);
prefs.HintShown = true;
prefs.Save();
}
return;
}
if (server != null && BackupRunning() && if (server != null && BackupRunning() &&
MessageBox.Show(this, "Das Backup läuft noch.\n\nBeim Schließen wird es abgebrochen (bereits kopierte Dateien bleiben). Trotzdem schließen?", MessageBox.Show(this, "Das Backup läuft noch.\n\nBeim Schließen wird es abgebrochen (bereits kopierte Dateien bleiben). Trotzdem schließen?",
"Projekte", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) "Projekte", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
{ {
e.Cancel = true; e.Cancel = true;
exiting = false;
return; return;
} }
SaveWindow(); if (Visible) SaveWindow();
}; };
BackColor = Color.FromArgb(245, 246, 250); BackColor = Color.FromArgb(245, 246, 250);
status.Text = "Starte Dashboard …"; status.Text = "Starte Dashboard …";
Controls.Add(web); Controls.Add(web);
Controls.Add(status); Controls.Add(status);
Shown += async (_, _) => await StartAsync(); Shown += async (_, _) => await StartAsync();
FormClosed += (_, _) => StopServer(); FormClosed += (_, _) => { poll.Stop(); tray.Visible = false; tray.Dispose(); StopServer(); };
} }
async Task StartAsync() // --background: the window is not shown at start; the server starts anyway
protected override void SetVisibleCore(bool value)
{
if (startHidden)
{
startHidden = false;
value = false;
if (!IsHandleCreated) CreateHandle();
BeginInvoke(async () =>
{
try { await EnsureServerAsync(); }
catch (Exception ex) { tray.ShowBalloonTip(8000, "Projekt-Dashboard", "Konnte nicht starten: " + ex.Message, ToolTipIcon.Error); }
});
}
base.SetVisibleCore(value);
}
void SetupTray()
{
tray.Icon = Icon;
var menu = new ContextMenuStrip();
menu.Items.Add("Öffnen", null, (_, _) => ShowFromTray());
menu.Items.Add("Backup …", null, (_, _) => ShowFromTray("backup"));
menu.Items.Add(new ToolStripSeparator());
menu.Items.Add("Beenden", null, (_, _) => { exiting = true; Close(); });
tray.ContextMenuStrip = menu;
tray.DoubleClick += (_, _) => ShowFromTray();
tray.BalloonTipClicked += (_, _) => ShowFromTray();
tray.Visible = true;
poll.Tick += async (_, _) => await PollBackup();
poll.Start();
}
// Brings the window back (from the tray, or for a second start of the exe).
void ShowFromTray(string? hash = null)
{
if (!Visible) Show(); // the first Show() also starts the web view (Shown event)
if (WindowState == FormWindowState.Minimized) WindowState = FormWindowState.Normal;
Activate();
BringToFront();
if (hash == "backup")
{
if (web.CoreWebView2 != null) _ = web.CoreWebView2.ExecuteScriptAsync("typeof openBackup === 'function' && openBackup()");
else pendingHash = "#backup";
}
}
string pendingHash = "";
// While the window is hidden: a balloon when a backup finished or failed.
async Task PollBackup()
{ {
try try
{
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(3) };
using var doc = JsonDocument.Parse(await http.GetStringAsync(BaseUrl + "api/backup"));
var r = doc.RootElement;
var phase = r.TryGetProperty("phase", out var ph) ? ph.GetString() : null;
var auto = r.TryGetProperty("auto", out var au) && au.ValueKind == JsonValueKind.True;
string? at = null; bool ok = true; string detail = "";
if (r.TryGetProperty("schedule", out var sc) && sc.TryGetProperty("lastResult", out var lr) && lr.ValueKind == JsonValueKind.Object)
{
at = lr.TryGetProperty("at", out var a) ? a.GetString() : null;
ok = lr.TryGetProperty("ok", out var o) && o.ValueKind == JsonValueKind.True;
if (lr.TryGetProperty("targets", out var ts) && ts.ValueKind == JsonValueKind.Array)
detail = string.Join(", ", ts.EnumerateArray().Select(t =>
(t.TryGetProperty("name", out var n) ? n.GetString() : "") +
(t.TryGetProperty("error", out var er) && er.ValueKind == JsonValueKind.String ? ": " + er.GetString() : "")));
}
if (polledOnce && !Visible)
{
if (at != null && at != lastAutoAt)
tray.ShowBalloonTip(6000, ok ? "Automatisches Backup fertig" : "Automatisches Backup fehlgeschlagen",
detail.Length > 0 ? detail : (ok ? "Alle Projekte gesichert." : "Details im Dashboard."), ok ? ToolTipIcon.Info : ToolTipIcon.Warning);
else if (!auto && lastPhase is "checking" or "copying" && phase is "done" or "error")
tray.ShowBalloonTip(6000, phase == "done" ? "Backup fertig" : "Backup fehlgeschlagen",
phase == "done" ? "Alles gesichert." : (r.TryGetProperty("error", out var e) ? e.GetString() ?? "" : ""), phase == "done" ? ToolTipIcon.Info : ToolTipIcon.Warning);
}
lastAutoAt = at;
lastPhase = phase;
polledOnce = true;
}
catch { }
}
// Starts the Node server unless one is already running (also used by --background).
async Task EnsureServerAsync()
{ {
Directory.CreateDirectory(DataDir); Directory.CreateDirectory(DataDir);
if (!await IsServerUp()) if (!await IsServerUp())
@@ -110,7 +235,13 @@ sealed class MainForm : Form
await Task.Delay(300); await Task.Delay(300);
} }
} }
}
async Task StartAsync()
{
try
{
await EnsureServerAsync();
var env = await CoreWebView2Environment.CreateAsync(null, Path.Combine(DataDir, "WebView2")); var env = await CoreWebView2Environment.CreateAsync(null, Path.Combine(DataDir, "WebView2"));
await web.EnsureCoreWebView2Async(env); await web.EnsureCoreWebView2Async(env);
var core = web.CoreWebView2; var core = web.CoreWebView2;
@@ -125,7 +256,8 @@ sealed class MainForm : Form
core.DocumentTitleChanged += (_, _) => Text = core.DocumentTitle; core.DocumentTitleChanged += (_, _) => Text = core.DocumentTitle;
core.WebMessageReceived += OnWebMessage; core.WebMessageReceived += OnWebMessage;
if (savedZoom is > 0.3 and < 3) web.ZoomFactor = savedZoom; if (savedZoom is > 0.3 and < 3) web.ZoomFactor = savedZoom;
web.Source = new Uri(BaseUrl); web.Source = new Uri(BaseUrl + pendingHash);
pendingHash = "";
web.Visible = true; web.Visible = true;
status.Visible = false; status.Visible = false;
} }
@@ -162,6 +294,18 @@ sealed class MainForm : Form
var m = doc.RootElement; var m = doc.RootElement;
if (m.ValueKind != JsonValueKind.Object) return; if (m.ValueKind != JsonValueKind.Object) return;
var type = m.GetProperty("type").GetString(); var type = m.GetProperty("type").GetString();
// window options from Einstellungen → Allgemein → Fenster
if (type == "getAppSettings" || type == "appSettings")
{
if (type == "appSettings")
{
if (m.TryGetProperty("tray", out var tr) && tr.ValueKind is JsonValueKind.True or JsonValueKind.False) prefs.Tray = tr.GetBoolean();
if (m.TryGetProperty("autostart", out var au) && au.ValueKind is JsonValueKind.True or JsonValueKind.False) AppPrefs.SetAutostart(au.GetBoolean());
prefs.Save();
}
web.CoreWebView2?.PostWebMessageAsJson(JsonSerializer.Serialize(new { type = "appSettings", tray = prefs.Tray, autostart = AppPrefs.Autostart() }));
return;
}
if (type != "pickFolder" && type != "pickFile") return; if (type != "pickFolder" && type != "pickFile") return;
var id = m.GetProperty("id").GetString() ?? ""; var id = m.GetProperty("id").GetString() ?? "";
var title = m.TryGetProperty("title", out var t) ? t.GetString() : null; var title = m.TryGetProperty("title", out var t) ? t.GetString() : null;
@@ -361,4 +505,42 @@ sealed class MainForm : Form
{ {
try { Process.Start(new ProcessStartInfo(uri) { UseShellExecute = true }); } catch { } try { Process.Start(new ProcessStartInfo(uri) { UseShellExecute = true }); } catch { }
} }
internal static string Home => DataDir;
}
// Window options (only the desktop app can do these): <DataDir>\app.json.
// Autostart lives in the registry (HKCU ...\Run); a test home (DASHBOARD_HOME)
// uses its own value name so it never touches the real one.
sealed class AppPrefs
{
public bool Tray { get; set; } = true;
public bool HintShown { get; set; }
static string File_ => Path.Combine(MainForm.Home, "app.json");
const string RunKey = @"Software\Microsoft\Windows\CurrentVersion\Run";
static string RunValue => Environment.GetEnvironmentVariable("DASHBOARD_HOME") is { Length: > 0 } ? "ProjectDashboard-Test" : "ProjectDashboard";
public static AppPrefs Load()
{
try { return JsonSerializer.Deserialize<AppPrefs>(File.ReadAllText(File_)) ?? new AppPrefs(); } catch { return new AppPrefs(); }
}
public void Save()
{
try { Directory.CreateDirectory(MainForm.Home); File.WriteAllText(File_, JsonSerializer.Serialize(this)); } catch { }
}
public static bool Autostart()
{
try { using var k = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(RunKey); return k?.GetValue(RunValue) is string; } catch { return false; }
}
public static void SetAutostart(bool on)
{
try
{
using var k = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(RunKey);
if (on) k.SetValue(RunValue, $"\"{Application.ExecutablePath}\" --background");
else k.DeleteValue(RunValue, false);
}
catch { }
}
} }

View File

@@ -58,7 +58,7 @@ async function create(opts) {
const tasks = Array.isArray(m.tasks) ? m.tasks.filter((t) => !t?.done) : [] const tasks = Array.isArray(m.tasks) ? m.tasks.filter((t) => !t?.done) : []
const note = `Klon von „${path.basename(src)}“ (${now.slice(0, 10)}).` const note = `Klon von „${path.basename(src)}“ (${now.slice(0, 10)}).`
fs.writeFileSync(path.join(dest, STATUS_FILE), JSON.stringify({ fs.writeFileSync(path.join(dest, STATUS_FILE), JSON.stringify({
...m, status: 'idea', itch: '', tasks, ...m, status: 'idea', itch: '', favorite: false, tasks,
notes: m.notes ? `${note}\n\n${m.notes}` : note, notes: m.notes ? `${note}\n\n${m.notes}` : note,
updatedAt: now, updatedAt: now,
}, null, 2)) }, null, 2))

View File

@@ -149,6 +149,33 @@ function pubTitle(p) {
const x = p.published const x = p.published
return x ? `Auf itch.io veröffentlicht${x.title ? `: ${x.title}` : ''} (${x.source === 'manual' ? 'manuell eingetragen' : 'automatisch erkannt'}) – Klick öffnet die Seite` : '' return x ? `Auf itch.io veröffentlicht${x.title ? `: ${x.title}` : ''} (${x.source === 'manual' ? 'manuell eingetragen' : 'automatisch erkannt'}) – Klick öffnet die Seite` : ''
} }
// favorites: a star to toggle (tiles, panel) or a small mark (cards, rows)
const favMark = (p) => (p.favorite ? `<span class="favmark" title="Favorit">${ic('star', 'sm')}</span>` : '')
const favBtn = (p, cls = '') => `<button type="button" class="favbtn ${p.favorite ? 'on' : ''} ${cls}" data-fav title="${p.favorite ? 'Kein Favorit mehr' : 'Als Favorit markieren'}" aria-pressed="${!!p.favorite}">${ic('star')}</button>`
async function toggleFavorite(p) {
try {
const res = await fetch(`/api/projects/${encodeURIComponent(p.name)}`, {
method: 'PATCH', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ favorite: !p.favorite }),
})
const r = await res.json().catch(() => ({}))
if (!res.ok) throw new Error(r.error ?? 'Speichern fehlgeschlagen')
for (const x of [p, projects.find((y) => y.name === p.name), editing?.name === p.name ? editing : null]) if (x) x.favorite = r.favorite
render()
if (editing?.name === p.name) {
const el = document.getElementById('pFav')
el.innerHTML = favBtn(editing)
wireFav(el, editing)
}
toast(r.favorite ? `${p.name} ist jetzt Favorit` : `${p.name} ist kein Favorit mehr`, 'star')
} catch (e) { toast(e.message, 'triangle-alert') }
}
function wireFav(el, p) {
for (const b of el.querySelectorAll('[data-fav]')) {
b.onclick = (e) => { e.stopPropagation(); toggleFavorite(p) }
b.addEventListener('mousedown', (e) => e.stopPropagation())
}
}
function pubChip(p, short = false) { function pubChip(p, short = false) {
if (!p.published) return '' if (!p.published) return ''
return `<a class="chip pub" href="${escapeHtml(p.published.url)}" target="_blank" draggable="false" onclick="event.stopPropagation()" title="${escapeHtml(pubTitle(p))}">${ic('rocket', 'sm')}${short ? '' : 'itch.io'}</a>` return `<a class="chip pub" href="${escapeHtml(p.published.url)}" target="_blank" draggable="false" onclick="event.stopPropagation()" title="${escapeHtml(pubTitle(p))}">${ic('rocket', 'sm')}${short ? '' : 'itch.io'}</a>`
@@ -513,9 +540,32 @@ if (hasPicker) {
window.chrome.webview.addEventListener('message', (e) => { window.chrome.webview.addEventListener('message', (e) => {
const m = e.data const m = e.data
if ((m?.type === 'folderPicked' || m?.type === 'filePicked') && pickWaiters.has(m.id)) { pickWaiters.get(m.id)(m.path ?? ''); pickWaiters.delete(m.id) } if ((m?.type === 'folderPicked' || m?.type === 'filePicked') && pickWaiters.has(m.id)) { pickWaiters.get(m.id)(m.path ?? ''); pickWaiters.delete(m.id) }
if (m?.type === 'appSettings') showAppSettings(m)
}) })
} else document.body.classList.add('no-picker') } else document.body.classList.add('no-picker')
// window options of the desktop app (tray, autostart) - kept by the launcher, not in settings.json
let appSettingsSent = null
function showAppSettings(m) {
document.getElementById('appWin').hidden = false
document.getElementById('fTray').checked = !!m.tray
document.getElementById('fAutostart').checked = !!m.autostart
if (appSettingsSent) {
const what = appSettingsSent
appSettingsSent = null
toast(what === 'tray' ? (m.tray ? 'Läuft beim Schließen im Hintergrund weiter' : 'Schließen beendet das Dashboard') : (m.autostart ? 'Startet mit Windows' : 'Startet nicht mehr mit Windows'), 'app-window')
}
}
if (hasPicker) {
for (const id of ['fTray', 'fAutostart']) {
document.getElementById(id).addEventListener('change', (e) => {
e.stopPropagation()
appSettingsSent = id === 'fTray' ? 'tray' : 'autostart'
window.chrome.webview.postMessage({ type: 'appSettings', [appSettingsSent]: e.target.checked })
})
}
}
function pickDialog(type, title, initial) { function pickDialog(type, title, initial) {
return new Promise((resolve) => { return new Promise((resolve) => {
const id = Math.random().toString(36).slice(2) const id = Math.random().toString(36).slice(2)
@@ -530,6 +580,7 @@ async function openSettings(setup) {
settingsSetup = !!setup settingsSetup = !!setup
closeEditor(); closeBackup() closeEditor(); closeBackup()
try { settingsCache = await (await fetch('/api/settings')).json() } catch {} try { settingsCache = await (await fetch('/api/settings')).json() } catch {}
if (hasPicker) window.chrome.webview.postMessage({ type: 'getAppSettings' })
const s = settingsCache ?? { roots: [], backup: { targets: [], excludeDirs: [] } } const s = settingsCache ?? { roots: [], backup: { targets: [], excludeDirs: [] } }
shownRootIds = s.activeRoots ?? [s.activeRoot] shownRootIds = s.activeRoots ?? [s.activeRoot]
document.getElementById('fRoots').innerHTML = (s.roots ?? []).map((r) => rootRow(r)).join('') || rootRow() document.getElementById('fRoots').innerHTML = (s.roots ?? []).map((r) => rootRow(r)).join('') || rootRow()
@@ -688,7 +739,7 @@ function setSettingsTab(tab) {
} }
for (const b of document.querySelectorAll('#spTabs button')) b.onclick = () => setSettingsTab(b.dataset.stab) for (const b of document.querySelectorAll('#spTabs button')) b.onclick = () => setSettingsTab(b.dataset.stab)
const markSettingsDirty = () => document.getElementById('spanel').classList.add('dirty') const markSettingsDirty = () => document.getElementById('spanel').classList.add('dirty')
document.getElementById('spanel').addEventListener('input', (e) => { if (!e.target.closest('#fImport')) markSettingsDirty() }) document.getElementById('spanel').addEventListener('input', (e) => { if (!e.target.closest('#fImport, #appWin')) markSettingsDirty() })
document.addEventListener('keydown', (e) => { document.addEventListener('keydown', (e) => {
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 's' && document.getElementById('spanel').classList.contains('open')) { if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 's' && document.getElementById('spanel').classList.contains('open')) {
e.preventDefault() e.preventDefault()
@@ -1018,6 +1069,7 @@ const QUICK = [
{ key: 'install', label: 'npm install', icon: 'download', test: (p) => p.tech?.needsInstall }, { key: 'install', label: 'npm install', icon: 'download', test: (p) => p.tech?.needsInstall },
{ key: 'noicon', label: 'Ohne Icon', icon: 'image-off', test: (p) => !p.hasIcon }, { key: 'noicon', label: 'Ohne Icon', icon: 'image-off', test: (p) => !p.hasIcon },
{ key: 'gencopy', label: 'Generator-Kopie', icon: 'copy', test: (p) => p.tools?.generators?.some((g) => g.kind === 'copy') }, { key: 'gencopy', label: 'Generator-Kopie', icon: 'copy', test: (p) => p.tools?.generators?.some((g) => g.kind === 'copy') },
{ key: 'fav', label: 'Favoriten', icon: 'star', test: (p) => !!p.favorite },
{ key: 'itch', label: 'itch.io', icon: 'rocket', feature: 'itch', test: (p) => !!p.published }, { key: 'itch', label: 'itch.io', icon: 'rocket', feature: 'itch', test: (p) => !!p.published },
{ key: 'noitch', label: 'Fertig, nicht auf itch', icon: 'circle-off', feature: 'itch', test: (p) => p.status === 'done' && !p.published }, { key: 'noitch', label: 'Fertig, nicht auf itch', icon: 'circle-off', feature: 'itch', test: (p) => p.status === 'done' && !p.published },
] ]
@@ -1041,6 +1093,7 @@ function visibleProjects({ useStatus = true } = {}) {
function sortProjects(items) { function sortProjects(items) {
const sort = document.getElementById('fltSort').value const sort = document.getElementById('fltSort').value
return [...items].sort((a, b) => { return [...items].sort((a, b) => {
if (!!a.favorite !== !!b.favorite) return a.favorite ? -1 : 1 // favorites always first
if (sort === 'name') return a.name.localeCompare(b.name, 'de', { sensitivity: 'base' }) if (sort === 'name') return a.name.localeCompare(b.name, 'de', { sensitivity: 'base' })
if (sort === 'priority') return (PRIO_ORDER[a.priority] - PRIO_ORDER[b.priority]) || (new Date(lastActivity(b)) - new Date(lastActivity(a))) if (sort === 'priority') return (PRIO_ORDER[a.priority] - PRIO_ORDER[b.priority]) || (new Date(lastActivity(b)) - new Date(lastActivity(a)))
if (sort === 'size') return (b.storage?.sizeMB ?? -1) - (a.storage?.sizeMB ?? -1) if (sort === 'size') return (b.storage?.sizeMB ?? -1) - (a.storage?.sizeMB ?? -1)
@@ -1183,7 +1236,7 @@ function rowHtml(p) {
<span class="prio-dot ${p.priority}" title="${prioTitle}"></span> <span class="prio-dot ${p.priority}" title="${prioTitle}"></span>
${avatar(p)} ${avatar(p)}
<div class="rmain"> <div class="rmain">
<span class="name" title="${escapeHtml(p.name)}">${escapeHtml(p.name)}</span> <span class="name" title="${escapeHtml(p.name)}">${favMark(p)}${escapeHtml(p.name)}</span>
<span class="rsub"> <span class="rsub">
${rootTag(p, true)} ${rootTag(p, true)}
<span class="rsize" title="${escapeHtml(sizeTitle(p))}">${ic('folder', 'sm')}${p.storage?.sizeMB != null ? fmtMB(p.storage.sizeMB) : '–'}</span> <span class="rsize" title="${escapeHtml(sizeTitle(p))}">${ic('folder', 'sm')}${p.storage?.sizeMB != null ? fmtMB(p.storage.sizeMB) : '–'}</span>
@@ -1204,7 +1257,7 @@ function cardHtml(p) {
const tags = (p.tags ?? []).map((t) => `<span class="chip tag">${ic('tag', 'sm')}${escapeHtml(t)}</span>`).join('') const tags = (p.tags ?? []).map((t) => `<span class="chip tag">${ic('tag', 'sm')}${escapeHtml(t)}</span>`).join('')
return ` return `
<div class="head">${avatar(p)} <div class="head">${avatar(p)}
<div style="min-width:0"><div class="name" title="${escapeHtml(p.name)}">${escapeHtml(p.name)}</div> <div style="min-width:0"><div class="name" title="${escapeHtml(p.name)}">${favMark(p)}${escapeHtml(p.name)}</div>
<div class="sub">${prioHtml(p.priority)}</div></div> <div class="sub">${prioHtml(p.priority)}</div></div>
${qsGroup(p, false, true)} ${qsGroup(p, false, true)}
</div> </div>
@@ -1276,6 +1329,7 @@ function renderGallery() {
<div class="thumb" style="--c:${nameColor(p.name)}"><span class="ini">${escapeHtml(initialsOf(p.name))}</span> <div class="thumb" style="--c:${nameColor(p.name)}"><span class="ini">${escapeHtml(initialsOf(p.name))}</span>
<img loading="lazy" class="${p.hasIcon ? '' : 'photo'}" src="${thumbUrl(p.name)}" alt="" onerror="this.remove()"> <img loading="lazy" class="${p.hasIcon ? '' : 'photo'}" src="${thumbUrl(p.name)}" alt="" onerror="this.remove()">
${statusHtml(p.status)} ${statusHtml(p.status)}
${favBtn(p, 'onthumb')}
<span class="tbadges">${pubBadge(p)}${cloudBadge(p)}<span class="tbadge ${p.git.level}" title="Git: ${escapeHtml(p.git.label)}">${ic(GIT_ICON[p.git.level])}</span></span> <span class="tbadges">${pubBadge(p)}${cloudBadge(p)}<span class="tbadge ${p.git.level}" title="Git: ${escapeHtml(p.git.label)}">${ic(GIT_ICON[p.git.level])}</span></span>
</div> </div>
<div class="info"> <div class="info">
@@ -1284,6 +1338,7 @@ function renderGallery() {
<div class="meta"><span style="display:flex;gap:6px;align-items:center;min-width:0">${prioHtml(p.priority)}${rootTag(p, true)}</span><span>${p.storage?.sizeMB != null ? `${ic('hard-drive', 'sm')} ${fmtMB(p.storage.sizeMB)} · ` : ''}${timeAgo(lastActivity(p))}</span></div> <div class="meta"><span style="display:flex;gap:6px;align-items:center;min-width:0">${prioHtml(p.priority)}${rootTag(p, true)}</span><span>${p.storage?.sizeMB != null ? `${ic('hard-drive', 'sm')} ${fmtMB(p.storage.sizeMB)} · ` : ''}${timeAgo(lastActivity(p))}</span></div>
</div>` </div>`
wireQuickStart(tile, p) wireQuickStart(tile, p)
wireFav(tile, p)
tile.onclick = () => openEditor(p) tile.onclick = () => openEditor(p)
grid.appendChild(tile) grid.appendChild(tile)
} }
@@ -1304,7 +1359,7 @@ function renderList() {
const sort = document.getElementById('fltSort').value const sort = document.getElementById('fltSort').value
table.innerHTML = `<thead><tr>${LIST_COLS.map((c) => `<th class="${c.num ? 'num' : ''} ${c.cls ?? ''}" ${c.sort ? `data-sort="${c.sort}"` : ''}>${c.label}${c.sort === sort ? ' ' + ic('arrow-down', 'sm') : ''}</th>`).join('')}</tr></thead> table.innerHTML = `<thead><tr>${LIST_COLS.map((c) => `<th class="${c.num ? 'num' : ''} ${c.cls ?? ''}" ${c.sort ? `data-sort="${c.sort}"` : ''}>${c.label}${c.sort === sort ? ' ' + ic('arrow-down', 'sm') : ''}</th>`).join('')}</tr></thead>
<tbody>${items.map((p) => `<tr data-name="${escapeHtml(p.name)}"> <tbody>${items.map((p) => `<tr data-name="${escapeHtml(p.name)}">
<td><div class="nm" title="${escapeHtml(p.name)}">${avatar(p)}<span>${escapeHtml(p.name)}</span>${rootTag(p, true)}</div></td> <td><div class="nm" title="${escapeHtml(p.name)}">${avatar(p)}<span>${favMark(p)}${escapeHtml(p.name)}</span>${rootTag(p, true)}</div></td>
<td class="c-status"><div class="chips" style="flex-wrap:nowrap">${statusHtml(p.status)}${pubChip(p, true)}</div></td> <td class="c-status"><div class="chips" style="flex-wrap:nowrap">${statusHtml(p.status)}${pubChip(p, true)}</div></td>
<td>${gitHtml(p.git, true)}</td> <td>${gitHtml(p.git, true)}</td>
<td>${cloudChip(p)}</td> <td>${cloudChip(p)}</td>
@@ -1388,13 +1443,20 @@ function renderHome() {
const grid = document.getElementById('homeGrid') const grid = document.getElementById('homeGrid')
if (!items.length) { grid.innerHTML = `<div class="empty">${ic('search-x', 'xl')}<div>Keine Projekte gefunden.</div></div>`; return } if (!items.length) { grid.innerHTML = `<div class="empty">${ic('search-x', 'xl')}<div>Keine Projekte gefunden.</div></div>`; return }
grid.innerHTML = '' grid.innerHTML = ''
for (const p of items) { // "Alle": favorites get their own row on top
const favs = homeStatus === 'all' ? items.filter((p) => p.favorite) : []
const head = (icon, text) => { const h = document.createElement('div'); h.className = 'hgroup'; h.innerHTML = `${ic(icon, 'sm')}${text}`; grid.appendChild(h) }
if (favs.length) head('star', 'Favoriten')
const ordered = favs.length ? [...favs, null, ...items.filter((p) => !p.favorite)] : items
for (const p of ordered) {
if (!p) { head('layout-grid', 'Alle Projekte'); continue }
const desc = (p.description || p.notes || '').split(/\r?\n/).map((x) => x.trim()).find(Boolean) ?? '' const desc = (p.description || p.notes || '').split(/\r?\n/).map((x) => x.trim()).find(Boolean) ?? ''
const due = backupDue(p) const due = backupDue(p)
const tile = document.createElement('div') const tile = document.createElement('div')
tile.className = 'htile' tile.className = 'htile'
tile.innerHTML = ` tile.innerHTML = `
<div class="hhead"> <div class="hhead">
${favBtn(p, 'ontile')}
<div class="hicon" style="--c:${nameColor(p.name)}">${escapeHtml(initialsOf(p.name))}<img loading="lazy" src="${thumbUrl(p.name)}" alt="" onerror="this.remove()"></div> <div class="hicon" style="--c:${nameColor(p.name)}">${escapeHtml(initialsOf(p.name))}<img loading="lazy" src="${thumbUrl(p.name)}" alt="" onerror="this.remove()"></div>
<div style="min-width:0;flex:1"> <div style="min-width:0;flex:1">
<div class="hname" title="${escapeHtml(p.name)}">${escapeHtml(p.name)}</div> <div class="hname" title="${escapeHtml(p.name)}">${escapeHtml(p.name)}</div>
@@ -1408,6 +1470,7 @@ function renderHome() {
${qsGroup(p, false, true)} ${qsGroup(p, false, true)}
</div>` </div>`
wireQuickStart(tile, p) wireQuickStart(tile, p)
wireFav(tile, p)
tile.onclick = () => openEditor(p) tile.onclick = () => openEditor(p)
grid.appendChild(tile) grid.appendChild(tile)
} }
@@ -2775,6 +2838,8 @@ function openEditor(p) {
editingTasks = (p.tasks ?? []).map((t) => ({ ...t })) editingTasks = (p.tasks ?? []).map((t) => ({ ...t }))
document.getElementById('pAvatar').innerHTML = avatar(p, 'lg') document.getElementById('pAvatar').innerHTML = avatar(p, 'lg')
document.getElementById('panelTitle').textContent = p.name document.getElementById('panelTitle').textContent = p.name
document.getElementById('pFav').innerHTML = favBtn(p)
wireFav(document.getElementById('pFav'), p)
document.getElementById('panelSub').innerHTML = uiMode === 'simple' ? `${statusHtml(p.status)}${rootTag(p)}` : `${statusHtml(p.status)}${gitHtml(p.git, true)}${techChips(p.tech?.types)}${pubChip(p)}` document.getElementById('panelSub').innerHTML = uiMode === 'simple' ? `${statusHtml(p.status)}${rootTag(p)}` : `${statusHtml(p.status)}${gitHtml(p.git, true)}${techChips(p.tech?.types)}${pubChip(p)}`
document.getElementById('fStatus').value = p.status document.getElementById('fStatus').value = p.status
document.getElementById('fPriority').value = p.priority document.getElementById('fPriority').value = p.priority

View File

@@ -601,6 +601,20 @@
.featrow { display: flex !important; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; } .featrow { display: flex !important; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.featrow input { margin-top: 3px; } .featrow input { margin-top: 3px; }
.featrow b { display: inline-flex; gap: 5px; align-items: center; } .featrow b { display: inline-flex; gap: 5px; align-items: center; }
/* favorites */
.favbtn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 6px; display: inline-grid; place-items: center; opacity: .55; }
.favbtn:hover { opacity: 1; color: var(--yellow); background: var(--surface-2); }
.favbtn.on { color: var(--yellow); opacity: 1; }
.favbtn.on .i, .favmark .i { fill: currentColor; }
.favmark { color: var(--yellow); display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.favbtn.onthumb { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.35); color: #fff; opacity: 0; z-index: 2; }
.tile:hover .favbtn.onthumb, .favbtn.onthumb.on { opacity: 1; }
.favbtn.onthumb.on { color: var(--yellow); }
.htile .hhead { position: relative; }
.favbtn.ontile { position: absolute; top: -8px; right: -8px; opacity: 0; }
.htile:hover .favbtn.ontile, .favbtn.ontile.on { opacity: 1; }
.hgroup { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.hgroup:first-child { margin-top: 0; }
.pdesc { font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; } .pdesc { font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.pdesc.muted { color: var(--muted); font-style: italic; } .pdesc.muted { color: var(--muted); font-style: italic; }
.pdesc-edit textarea { width: 100%; min-height: 120px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.5; } .pdesc-edit textarea { width: 100%; min-height: 120px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.5; }
@@ -921,7 +935,7 @@
<div class="phead"> <div class="phead">
<div id="pAvatar"></div> <div id="pAvatar"></div>
<div style="min-width:0"> <div style="min-width:0">
<h3 id="panelTitle"></h3> <h3 style="display:flex;align-items:center;gap:6px"><span id="panelTitle"></span><span id="pFav"></span></h3>
<div class="sub" id="panelSub"></div> <div class="sub" id="panelSub"></div>
</div> </div>
<button class="iconbtn close" id="btnClose" title="Schließen (Esc)"><svg class="i"><use href="/icons.svg#x"/></svg></button> <button class="iconbtn close" id="btnClose" title="Schließen (Esc)"><svg class="i"><use href="/icons.svg#x"/></svg></button>
@@ -1076,7 +1090,7 @@
<span id="fAutoTargetWrap">auf <select id="fAutoTarget" class="autosel"></select></span> <span id="fAutoTargetWrap">auf <select id="fAutoTarget" class="autosel"></select></span>
</div> </div>
<div class="spstatus" id="spAuto"></div> <div class="spstatus" id="spAuto"></div>
<div class="hint" style="margin:0">Sichert alle Projektordner – nur, solange das Dashboard geöffnet ist. Ein verpasster Termin (PC aus) wird beim nächsten Öffnen nachgeholt; ist das Ziel nicht erreichbar, folgt nach 30 Minuten ein neuer Versuch.</div> <div class="hint" style="margin:0">Sichert alle Projektordner – solange das Dashboard läuft, auch im Hintergrund (Symbol neben der Uhr, siehe Allgemein → Fenster). Ein verpasster Termin (PC aus) wird beim nächsten Start nachgeholt; ist das Ziel nicht erreichbar, folgt nach 30 Minuten ein neuer Versuch.</div>
</div> </div>
<details class="more"><summary><svg class="i sm"><use href="/icons.svg#info"/></svg>Wohin wird gesichert?</summary><div>Jedes Projekt landet im Ziel in einem gleichnamigen Unterordner. Der Hauptordner geht direkt ins Ziel, jeder weitere Projektordner in einen Unterordner mit seinem Namen. Jedes Ziel hat seinen eigenen Backup-Stand; <code>backup-projekte.bat</code> sichert auf das erste. Im Backup wird nie etwas gelöscht.</div></details> <details class="more"><summary><svg class="i sm"><use href="/icons.svg#info"/></svg>Wohin wird gesichert?</summary><div>Jedes Projekt landet im Ziel in einem gleichnamigen Unterordner. Der Hauptordner geht direkt ins Ziel, jeder weitere Projektordner in einen Unterordner mit seinem Namen. Jedes Ziel hat seinen eigenen Backup-Stand; <code>backup-projekte.bat</code> sichert auf das erste. Im Backup wird nie etwas gelöscht.</div></details>
</section> </section>
@@ -1097,6 +1111,15 @@
<div class="sphead"><h4>Allgemein</h4><p>Wo das Dashboard seine Daten ablegt.</p></div> <div class="sphead"><h4>Allgemein</h4><p>Wo das Dashboard seine Daten ablegt.</p></div>
<div class="kv" id="spData"></div> <div class="kv" id="spData"></div>
<div class="rowbtns"><button class="btn" type="button" id="spOpenData"><svg class="i"><use href="/icons.svg#folder-open"/></svg>Datenordner öffnen</button></div> <div class="rowbtns"><button class="btn" type="button" id="spOpenData"><svg class="i"><use href="/icons.svg#folder-open"/></svg>Datenordner öffnen</button></div>
<div class="appwin" id="appWin" hidden>
<div class="sphead" style="margin-top:8px"><h4>Fenster</h4><p>Gilt sofort, ohne Speichern.</p></div>
<label class="chk featrow"><input type="checkbox" id="fTray">
<span><b><svg class="i sm"><use href="/icons.svg#app-window"/></svg> Beim Schließen im Hintergrund weiterlaufen</b><br>
<span class="hint" style="margin:0">Das Dashboard bleibt als Symbol neben der Uhr. Nötig, damit das automatische Backup auch ohne offenes Fenster läuft – mit Windows-Hinweis, wenn es fertig ist oder fehlschlägt. Rechtsklick auf das Symbol → Beenden.</span></span></label>
<label class="chk featrow" style="margin-top:8px"><input type="checkbox" id="fAutostart">
<span><b><svg class="i sm"><use href="/icons.svg#power"/></svg> Mit Windows starten</b><br>
<span class="hint" style="margin:0">Startet unsichtbar im Hintergrund (nur das Symbol neben der Uhr).</span></span></label>
</div>
<div class="sphead" style="margin-top:8px"><h4>Funktionen</h4><p>Zusätzliches, das nicht jeder braucht. Ausgeschaltet ist davon nichts zu sehen.</p></div> <div class="sphead" style="margin-top:8px"><h4>Funktionen</h4><p>Zusätzliches, das nicht jeder braucht. Ausgeschaltet ist davon nichts zu sehen.</p></div>
<label class="chk featrow"><input type="checkbox" id="fFeatItch"> <label class="chk featrow"><input type="checkbox" id="fFeatItch">
<span><b><svg class="i sm"><use href="/icons.svg#rocket"/></svg> itch.io</b><br> <span><b><svg class="i sm"><use href="/icons.svg#rocket"/></svg> itch.io</b><br>

View File

@@ -11,10 +11,15 @@
// Host header and (for writes) a local Origin, so other web pages can't drive it. // 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 // 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). // 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) require('./lib/supervisor').supervise(__filename)
return return
} }
delete process.env.DASHBOARD_WORKER // not passed on to anything started from here
// supervisor gone (window closed, killed) → stop too, never left behind // supervisor gone (window closed, killed) → stop too, never left behind
process.on('disconnect', () => process.exit(0)) process.on('disconnect', () => process.exit(0))
@@ -131,10 +136,11 @@ function readStatusFile(projectPath) {
start: typeof data.start === 'string' ? data.start.slice(0, 300) : '', start: typeof data.start === 'string' ? data.start.slice(0, 300) : '',
program: typeof data.program === 'string' ? data.program.slice(0, 300) : '', program: typeof data.program === 'string' ? data.program.slice(0, 300) : '',
itch: typeof data.itch === 'string' ? data.itch.slice(0, 300) : '', itch: typeof data.itch === 'string' ? data.itch.slice(0, 300) : '',
favorite: data.favorite === true,
updatedAt: data.updatedAt ?? null, updatedAt: data.updatedAt ?? null,
} }
} catch { } 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) const projectPath = resolveProject(req.params.name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' }) if (!projectPath) return res.status(404).json({ error: 'unknown project' })
const current = readStatusFile(projectPath) 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 // itch: '' = automatic, '-' = not published, otherwise the game's page
let nextItch = current.itch let nextItch = current.itch
if (typeof itchLink === 'string') { 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, start: typeof start === 'string' ? start.replace(/[\r\n]+/g, ' ').slice(0, 300) : current.start,
program: nextProgram, program: nextProgram,
itch: nextItch, itch: nextItch,
favorite: typeof favorite === 'boolean' ? favorite : current.favorite,
updatedAt: new Date().toISOString(), updatedAt: new Date().toISOString(),
} }
fs.writeFileSync(path.join(projectPath, STATUS_FILE), JSON.stringify(next, null, 2)) fs.writeFileSync(path.join(projectPath, STATUS_FILE), JSON.stringify(next, null, 2))