Feat: Reload timer frontend on new version

This commit is contained in:
Dorian Zedler 2022-05-13 20:44:58 +02:00
parent 1db80aa45c
commit 740a20a011
Signed by: dorian
GPG Key ID: 989DE36109AFA354
3 changed files with 7 additions and 1 deletions

View File

@ -127,7 +127,8 @@ class SyncedTimer
"soundEnabled" => $userdata["soundEnabled"],
"repeatEnabled" => $userdata["repeatEnabled"],
"currentServerTime" => floor(microtime(true) * 1000),
)
),
"version" => $GLOBALS["VERSION"],
)));
} else {
http_response_code(404);

View File

@ -21,6 +21,10 @@ document.addEventListener('alpine:init', () => {
return;
}
if(response.version != activeSyncedTimerVersion) {
location.reload()
}
this.currentData = response.data
Alpine.store("audioPlayback").isDisabledByServer = !this.currentData.soundEnabled
this.header = this.currentData.header

View File

@ -370,6 +370,7 @@ class LandingpageTheme
<footer>
<script>
const username = "<?= $username ?>";
const activeSyncedTimerVersion = "<?= $GLOBALS["VERSION"] ?>"
var textElem = document.getElementById("timer");
var headerTextElem = document.getElementById("header");
var targetWidth = 0.9; // Proportion of full screen width