From 5d2163515e8b6a34e939fd0b186d62636d634b5e Mon Sep 17 00:00:00 2001 From: Ivan K Date: Thu, 20 Mar 2025 21:47:55 +0300 Subject: [PATCH] refactor: improve caching prevention logic --- .../luci-static/resources/view/podkop/podkop.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js index 924d737..b7cc972 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js @@ -774,13 +774,11 @@ let createStatusSection = function (podkopStatus, singboxStatus, podkop, luci, s return view.extend({ async render() { - // Add timestamp to URL to prevent caching - if (!window.location.href.includes('_nocache=')) { - const timestamp = new Date().getTime(); - const separator = window.location.href.includes('?') ? '&' : '?'; - const newUrl = `${window.location.href}${separator}_nocache=${timestamp}`; - window.history.replaceState({}, document.title, newUrl); - } + // Always add fresh timestamp to URL to prevent caching + const timestamp = new Date().getTime(); + const url = new URL(window.location.href); + url.searchParams.set('_nocache', timestamp); + window.history.replaceState({}, document.title, url.toString()); document.head.insertAdjacentHTML('beforeend', `