mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-01 01:10:21 +08:00
fix: refresh WebUI with cache buster
This commit is contained in:
@@ -156,6 +156,12 @@ function dismiss() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
function reloadWithCacheBuster() {
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.set('_r', Date.now().toString());
|
||||
window.location.replace(url.toString());
|
||||
}
|
||||
|
||||
function waitForRestart() {
|
||||
clearRestartTimer();
|
||||
let attempts = 0;
|
||||
@@ -169,7 +175,7 @@ function waitForRestart() {
|
||||
) {
|
||||
clearRestartTimer();
|
||||
sessionStorage.removeItem(UPGRADE_RECOVERY_TOKEN_KEY);
|
||||
window.location.reload();
|
||||
reloadWithCacheBuster();
|
||||
}
|
||||
} catch (_error) {
|
||||
// The backend may be temporarily unavailable during restart.
|
||||
|
||||
@@ -31,6 +31,11 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reloadWithCacheBuster() {
|
||||
const url = new URL(window.location.href)
|
||||
url.searchParams.set('_r', Date.now().toString())
|
||||
window.location.replace(url.toString())
|
||||
},
|
||||
async check(initialStartTime = null) {
|
||||
this.newStartTime = -1
|
||||
this.cnt = 0
|
||||
@@ -83,8 +88,7 @@ export default {
|
||||
this.newStartTime = newStartTime
|
||||
console.log('wfr: restarted')
|
||||
this.visible = false
|
||||
// reload
|
||||
window.location.reload()
|
||||
this.reloadWithCacheBuster()
|
||||
}
|
||||
} catch (_error) {
|
||||
// backend may be unavailable during restart window
|
||||
|
||||
@@ -611,7 +611,13 @@ async function fetchAstrBotStartTime() {
|
||||
|
||||
function reloadAfterUpdate() {
|
||||
stopRestartReloadTimer();
|
||||
window.location.reload();
|
||||
reloadWithCacheBuster();
|
||||
}
|
||||
|
||||
function reloadWithCacheBuster() {
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.set("_r", Date.now().toString());
|
||||
window.location.replace(url.toString());
|
||||
}
|
||||
|
||||
function showRestartCompleted() {
|
||||
@@ -819,7 +825,7 @@ function updateDashboard() {
|
||||
updateStatus.value = res.data.message || "";
|
||||
if (res.data.status == "ok") {
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
reloadWithCacheBuster();
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user