diff --git a/crates/app/src/public/js/atto.js b/crates/app/src/public/js/atto.js index 0ff868f..0fd18fb 100644 --- a/crates/app/src/public/js/atto.js +++ b/crates/app/src/public/js/atto.js @@ -454,18 +454,18 @@ media_theme_pref(); } }); - self.define("hooks::spotify_time_text", (_) => { + self.define("hooks::spotify_time_text", async (_) => { for (const element of Array.from( document.querySelectorAll("[hook=spotify_time_text]") || [], )) { - function render() { + async function render() { const updated = element.getAttribute("hook-arg:updated"); const progress = element.getAttribute("hook-arg:progress"); const duration = element.getAttribute("hook-arg:duration"); const display = element.getAttribute("hook-arg:display") || "full"; - element.innerHTML = trigger("spotify::timestamp", [ + element.innerHTML = await trigger("spotify::timestamp", [ updated, progress, duration, @@ -473,7 +473,7 @@ media_theme_pref(); ]); } - setInterval(() => { + setInterval(async () => { element.setAttribute( "hook-arg:updated", Number.parseInt(element.getAttribute("hook-arg:updated")) + @@ -486,10 +486,10 @@ media_theme_pref(); 1000, ); - render(); + await render(); }, 1000); - render(); + await render(); } }); diff --git a/crates/app/src/public/js/me.js b/crates/app/src/public/js/me.js index 4eb0f69..ed8eeb0 100644 --- a/crates/app/src/public/js/me.js +++ b/crates/app/src/public/js/me.js @@ -1134,7 +1134,7 @@ artist: playing.artist.name, album: playing.album["#text"], // times - timestamp: new Date().getTime().toString(), + timestamp: Date.now().toString(), duration_ms: (mb_info.length || 0).toString(), }, },