Add AMOLED theme, fullscreen, settings tab, and NTFY notifications

This commit is contained in:
purplebored committed 2026-11-08 19:38:17 +01:00
1 parent fe13a4d989
commit bbf92bb478
6 files changed
+429 -4

No files matched your search

+41 -1
View File
@@ -55,6 +55,9 @@ async function loadView(view) {
case "freedays":
await renderFreedays(token);
break;
case "settings":
await renderSettings(token);
break;
case "dashboard":
default:
await renderDashboard(token);
@@ -212,7 +215,7 @@ function runCommand(raw) {
/* ------------------------------------------------------------------- actions */
function handleAction(action) {
async function handleAction(action) {
switch (action) {
case "refresh":
refreshCurrent();
@@ -245,6 +248,43 @@ function handleAction(action) {
case "retry":
loadView(state.view);
break;
case "settings-save": {
const next = collectSettingsFromForm();
saveSettings(next);
const status = $("#settings-status");
if (status) {
status.textContent = next.enabled && next.topic
? `saved · topic ${next.topic} · poll every ${next.pollMinutes} min`
: "saved · disabled (no topic)";
}
appendSettingsLog(next.enabled ? "settings saved · ntfy enabled" : "settings saved · ntfy disabled");
toast(next.enabled ? "Settings saved. NTFY enabled." : "Settings saved.", "ok", 1800);
startNotificationPolling();
break;
}
case "settings-test": {
const current = collectSettingsFromForm();
const status = $("#settings-status");
try {
await sendNtfy(current, "librus-tui test", "Test notification from librus-tui settings.");
if (status) status.textContent = "test push sent";
appendSettingsLog("test push sent");
toast("Test notification sent.", "ok", 1800);
} catch (error) {
if (status) status.textContent = `test failed: ${error.message}`;
appendSettingsLog(`test push failed: ${error.message}`);
toast(`[ntfy fail] ${error.message}`, "warn");
}
break;
}
case "settings-clear": {
const defaults = defaultSettings();
saveSettings(defaults);
renderSettings();
startNotificationPolling();
toast("Settings reset to defaults.", "ok", 1800);
break;
}
default:
break;
}