diff --git a/html/poketube.ejs b/html/poketube.ejs index e5741e8a..bfc970b6 100644 --- a/html/poketube.ejs +++ b/html/poketube.ejs @@ -1621,7 +1621,26 @@ if (/[?&]autoplay=/.test(location.search)) { } } +// Function to refresh the page +const refreshPage = () => { + location.reload(); +}; +// Check if a timer is already set in localStorage +const timer = localStorage.getItem('refreshTimer'); + +if (timer) { + // If a timer is already set, clear it before setting a new one + clearTimeout(timer); +} + +// Set a new timer to refresh the page after 1 hour +const newTimer = setTimeout(() => { + refreshPage(); +}, 60 * 60 * 1000); // 1 hour in milliseconds + +// Save the new timer in localStorage +localStorage.setItem('refreshTimer', newTimer);