aboutsummaryrefslogtreecommitdiffstats
path: root/server/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/index.ts')
-rw-r--r--server/index.ts6
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'),
});
});
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage