From 95602704d53bb72d96d4947869bce63830888d52 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 4 Jun 2026 18:34:18 -0700 Subject: overhaul how daily is updated from server to client --- server/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/index.ts') diff --git a/server/index.ts b/server/index.ts index 0bcfed6..c9cc6b4 100644 --- a/server/index.ts +++ b/server/index.ts @@ -19,8 +19,7 @@ const DAILY_SONGS_FILE = path.resolve( type Song = (typeof songs)[number]; type DailySongs = Record; -function getObfuscationKey(): Buffer { - const date = new Date().toISOString().split('T')[0]; +function getObfuscationKey(date = getUtcDate()): Buffer { return Buffer.from(SALT + date); } @@ -75,10 +74,11 @@ function getDailySong(date: string): Song { app.get('/today', (_req, res) => { const date = getUtcDate(); const song = getDailySong(date); - const obfuscationKey = getObfuscationKey(); + const obfuscationKey = getObfuscationKey(date); const songJson = JSON.stringify(song); const obfuscatedData = xorBuffer(Buffer.from(songJson, 'utf8'), obfuscationKey); res.json({ + date, data: obfuscatedData.toString('hex'), }); }); -- cgit v1.2.3