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"], "soundEnabled" => $userdata["soundEnabled"],
"repeatEnabled" => $userdata["repeatEnabled"], "repeatEnabled" => $userdata["repeatEnabled"],
"currentServerTime" => floor(microtime(true) * 1000), "currentServerTime" => floor(microtime(true) * 1000),
) ),
"version" => $GLOBALS["VERSION"],
))); )));
} else { } else {
http_response_code(404); http_response_code(404);

View file

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

View file

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