Add 'Refresh all' button to podcast toolbar
Shows live progress counter (↻ 3/42) while fetching feeds sequentially, then reloads the current view when done. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
74bebe6451
commit
4f413c673e
2 changed files with 22 additions and 0 deletions
|
|
@ -1939,6 +1939,27 @@ async function refreshOpenFeed(btn) {
|
|||
if (btn) { btn.disabled = false; btn.textContent = '↻ Refresh'; }
|
||||
}
|
||||
|
||||
async function refreshAllFeedsBtn(btn) {
|
||||
if (btn) { btn.disabled = true; btn.textContent = '↻ 0/' + podcastFeeds.length; }
|
||||
let done = 0;
|
||||
for (const feed of podcastFeeds) {
|
||||
try {
|
||||
await fetch('/podcasts/feeds/refresh/', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', 'X-CSRFToken': getCsrfToken()},
|
||||
body: JSON.stringify({feed_id: feed.id}),
|
||||
});
|
||||
} catch (e) {}
|
||||
done++;
|
||||
if (btn) btn.textContent = `↻ ${done}/${podcastFeeds.length}`;
|
||||
}
|
||||
await loadFeedList();
|
||||
if (podcastCurrentView === 'feeds') renderFeedList();
|
||||
if (podcastCurrentView === 'inbox') loadAndRenderInbox();
|
||||
if (podcastCurrentView === 'episodes' && podcastCurrentFeedId) openFeed(podcastCurrentFeedId);
|
||||
if (btn) { btn.disabled = false; btn.textContent = '↻ All'; }
|
||||
}
|
||||
|
||||
async function refreshAllFeeds() {
|
||||
if (!IS_AUTHENTICATED || !podcastFeeds.length) return;
|
||||
for (const feed of podcastFeeds) {
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@
|
|||
<button class="btn btn-sm" onclick="showPodcastView('inbox')">Inbox</button>
|
||||
<button class="btn btn-sm" onclick="showPodcastView('queue')">Queue</button>
|
||||
<button class="btn btn-sm" onclick="podcastSearchOpen()">+ Search</button>
|
||||
<button class="btn btn-sm" id="refresh-all-btn" onclick="refreshAllFeedsBtn(this)" title="Refresh all feeds">↻ All</button>
|
||||
<label class="btn btn-sm" for="opml-file-input">Import OPML</label>
|
||||
<input type="file" id="opml-file-input" accept=".opml,.xml" style="display:none;" onchange="importOPML(this)">
|
||||
<span id="opml-status" class="muted"></span>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue