diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-06-04 18:34:18 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-06-04 18:34:18 -0700 |
| commit | 95602704d53bb72d96d4947869bce63830888d52 (patch) | |
| tree | 89f158d98beb5667ececf371258545aef5c64732 /server/index.ts | |
| parent | 66a7890647d225957d81c8b361a46d0f797025da (diff) | |
overhaul how daily is updated from server to client
Diffstat (limited to 'server/index.ts')
| -rw-r--r-- | server/index.ts | 6 |
1 files changed, 3 insertions, 3 deletions
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<string, Song>; -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'), }); }); |
