Feat: Reload timer frontend on new version
This commit is contained in:
parent
1db80aa45c
commit
740a20a011
3 changed files with 7 additions and 1 deletions
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue