8000 [pull] main from miniflux:main by pull[bot] · Pull Request #329 · suhaoGe/miniflux · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions internal/ui/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,19 +658,28 @@ function toggleEntryStatus(element, toasting) {
/**
* Handle the refresh of all feeds.
*
* This function POSTs to the URL specified in the data-refresh-all-feeds-url attribute of the body element.
* This submits a real form POST to the URL specified in the data-refresh-all-feeds-url
* attribute of the body element, so the browser follows the redirect once and renders the
* server-side flash message, matching the behavior of the menu button.
*/
function handleRefreshAllFeedsAction() {
const refreshAllFeedsUrl = document.body.dataset.refreshAllFeedsUrl;
if (refreshAllFeedsUrl) {
sendPOSTRequest(refreshAllFeedsUrl).then((response) => {
if (response?.redirected && response.url) {
window.location.href = response.url;
} else {
window.location.reload();
}
});
if (!refreshAllFeedsUrl) {
return;
}

const form = document.createElement("form");
form.method = "post";
form.action = refreshAllFeedsUrl;

const csrfField = document.createElement("input");
csrfField.type = "hidden";
csrfField.name = "csrf";
csrfField.value = document.body.dataset.csrfToken || "";
form.appendChild(csrfField);

document.body.appendChild(form);
form.submit();
}

/**
Expand Down
0