From da60198bbb593d4969c494e81b78912828477663 Mon Sep 17 00:00:00 2001 From: mrwnslz Date: Fri, 2 Oct 2026 16:36:00 +0200 Subject: [PATCH] =?UTF-8?q?Podcast-Oberfl=C3=A4che=20aus=20diora-android?= =?UTF-8?q?=20(Benachrichtigen),=20sw=20v61?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Chip "Benachrichtigen" auf der Podcast-Seite setzt notify auch im Browser (die Mitteilungen kommen von den Telefonen). Die Einstellung "Im Hintergrund abgleichen" gibt es nur in der App. Co-Authored-By: Claude Opus 5.5 --- static/js/sw.js | 2 +- static/podcasts/native-podcast.js | 51 ++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/static/js/sw.js b/static/js/sw.js index 4fb34d3..7c776ea 100644 --- a/static/js/sw.js +++ b/static/js/sw.js @@ -2,7 +2,7 @@ * diora service worker — caches the app shell for offline use. */ -const CACHE = 'diora-v60'; +const CACHE = 'diora-v61'; const SHELL = [ '/static/css/app.css', '/static/js/app.js', diff --git a/static/podcasts/native-podcast.js b/static/podcasts/native-podcast.js index bbade4e..b65c32a 100644 --- a/static/podcasts/native-podcast.js +++ b/static/podcasts/native-podcast.js @@ -1,4 +1,4 @@ -// Copied from diora-android 38d03c6 2026-10-02: web-native/static/native-podcast.js +// Copied from diora-android dff015e 2026-10-02: web-native/static/native-podcast.js // by tools/sync_podcast_ui.py. Do not edit here: change it in diora-android // and copy again. The browser host is static/js/podcasts-web.js. @@ -271,6 +271,7 @@ action: () => N.podcastSettings(JSON.stringify({auto_download_default: !s.auto_download_default}))}, ...dlSettingsItems(), ]), + backgroundSyncItem(), group('⇅', 'Abos umziehen', 'OPML exportieren und importieren', () => [ {icon: '⇩', label: 'Abos exportieren (OPML)', hint: 'zum Umziehen in eine andere App', action: exportOpml}, {icon: '⇧', label: 'Abos importieren (OPML)', action: importOpml}, @@ -279,6 +280,25 @@ ]); } + // The app's background job (BackgroundSync.kt): new episodes, their notifications and downloads with the app closed. + const BG_SYNC = [ + {value: 0, label: 'Aus', hint: 'nur wenn die App offen ist'}, + {value: 15, label: 'Alle 15 Minuten'}, + {value: 60, label: 'Jede Stunde', hint: 'Standard'}, + {value: 240, label: 'Alle 4 Stunden'}, + ]; + + function backgroundSyncItem() { + if (!N.podcastBackgroundSync || !N.podcastSetBackgroundSync) return null; + const now = N.podcastBackgroundSync(); + const label = (BG_SYNC.find(c => c.value === now) || BG_SYNC[2]).label; + return {icon: '⟲', label: 'Im Hintergrund abgleichen', hint: label + ' · neue Folgen, Mitteilungen, Downloads', + action: () => openSheet('Im Hintergrund abgleichen', BG_SYNC.map(c => ({ + icon: c.value === now ? '●' : '○', label: c.label, hint: c.hint, active: c.value === now, + action: () => { N.podcastSetBackgroundSync(c.value); settingsMenu(); }, + })))}; + } + function skipItem(name, label, choices) { if (!N.podcastSetPrefValue) return null; const now = devicePrefs()[name]; @@ -802,6 +822,15 @@ {icon: !live.auto_download ? '●' : '○', label: 'Nein', hint: 'nur die Warteschlange wird geladen', action: () => save({auto_download: false})}, ]))); } + // AntennaPod's episode notifications: the phone tells when a new episode is in „Neu“. + if ('notify' in live) { + row.append(chip('Benachrichtigen', live.notify ? 'an' : 'aus', !!live.notify, () => + openSheet(`Bei neuen Folgen von „${plain(live.title)}“ benachrichtigen?`, [ + {icon: live.notify ? '●' : '○', label: 'Ja', hint: 'eine Mitteilung auf dem Telefon, sobald eine neue Folge in „Neu“ ist', + action: () => save({notify: true})}, + {icon: !live.notify ? '●' : '○', label: 'Nein', action: () => save({notify: false})}, + ]))); + } row.append(chip('Filter', words || 'aus', !!words, () => openSheet('Welche neuen Folgen zählen?', [ {icon: '+', label: 'Nur mit diesen Wörtern im Titel', hint: live.include_words || 'alle', action: () => ask('include_words', 'Nur Folgen, deren Titel eines dieser Wörter enthält (mit Komma getrennt):', live.include_words)}, @@ -2434,6 +2463,26 @@ render(); }; + // A new-episode notification was tapped: that podcast's page (gone meanwhile: „Neu“). + window.__dioraOpenFeed = function (feedId) { + if (typeof showTab !== 'function') return; + closeStats(); + closeDownloads(); + closeNotes(); + closePlayer(); + selected = null; + showTab('podcasts'); + const f = feeds().find(x => x.id === feedId); + if (f) { + openFeed(f); + } else { + feedView = null; + view = 'inbox'; + render(); + scrollTop(0); + } + }; + window.__dioraPodcastsRefreshed = function (ok) { refreshing = false; if (!ok) toast(navigator.onLine ? 'Abrufen hat nicht geklappt' : 'Offline — es gilt der letzte Stand');