From de4c855d4845c782eb609ee078a1322980e635b3 Mon Sep 17 00:00:00 2001 From: "Ronald M. Clifford" Date: Sun, 7 Jan 2024 16:26:43 -0800 Subject: [PATCH] Fix Necrolab URLs. --- docker-compose.yml | 4 +++ node-roncli-com/src/necrolab/index.js | 35 +++++++++++++++++++-------- node-roncli-com/start.sh | 2 +- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e92cf0e5..4c2addba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -100,6 +100,7 @@ services: MASTODON_SERVER: "https://mastodon.social" MINIFY_CACHE: 1 MINIFY_ENABLED: 1 + NECROLAB_TOKEN_FILE: /run/secrets/NECROLAB_TOKEN_FILE NODE_ENV: production PHOTOS_URL: https://photos.roncli.com PORT: 3030 @@ -129,6 +130,7 @@ services: - ENCRYPTION_KEY_FILE - GITHUB_TOKEN_FILE - GOOGLE_API_KEY_FILE + - NECROLAB_TOKEN_FILE - REDIS_PASSWORD_FILE - SMTP_PASSWORD_FILE - SOUNDCLOUD_CLIENT_ID_FILE @@ -315,6 +317,8 @@ secrets: file: ./secrets/MYSQL_PASSWORD_FILE MYSQL_ROOT_PASSWORD_FILE: file: ./secrets/MYSQL_ROOT_PASSWORD_FILE + NECROLAB_TOKEN_FILE: + file: ./secrets/NECROLAB_TOKEN_FILE PHOTOS_USERNAME_FILE: file: ./secrets/PHOTOS_USERNAME_FILE PHOTOS_PASSWORD_FILE: diff --git a/node-roncli-com/src/necrolab/index.js b/node-roncli-com/src/necrolab/index.js index 3a00cdcb..1588681e 100644 --- a/node-roncli-com/src/necrolab/index.js +++ b/node-roncli-com/src/necrolab/index.js @@ -32,8 +32,11 @@ class Necrolab { */ static async getRank(name) { const res = await request.get({ - uri: `https://necrolab.com/api/rankings/steam/all-time-any-percent-synchrony-amplified-single-player-ost/all/entries?search=${name}`, - json: true + uri: `https://www.necrolab.com/api/rankings/steam/all-time~any-percent~synchrony-amplified~single-player~ost/all/entries?search=${name}`, + json: true, + auth: { + bearer: process.env.NECROLAB_TOKEN + } }); if (res.statusCode !== 200) { @@ -63,8 +66,11 @@ class Necrolab { */ async () => { const res = await request.get({ - uri: `https://necrolab.com/api/rankings/steam/all-time-any-percent-synchrony-amplified-single-player-ost/all/entries/${rank}/leaderboards/time?limit=10000`, - json: true + uri: `https://www.necrolab.com/api/rankings/steam/all-time~any-percent~synchrony-amplified~single-player~ost/all/entries/${rank}/leaderboards/time?limit=10000`, + json: true, + auth: { + bearer: process.env.NECROLAB_TOKEN + } }); if (res.statusCode !== 200) { @@ -86,8 +92,11 @@ class Necrolab { */ async () => { const res = await request.get({ - uri: `https://necrolab.com/api/rankings/steam/all-time-any-percent-synchrony-amplified-single-player-ost/all/entries/${rank}/leaderboards/score?limit=10000`, - json: true + uri: `https://www.necrolab.com/api/rankings/steam/all-time~any-percent~synchrony-amplified~single-player~ost/all/entries/${rank}/leaderboards/score?limit=10000`, + json: true, + auth: { + bearer: process.env.NECROLAB_TOKEN + } }); if (res.statusCode !== 200) { @@ -109,8 +118,11 @@ class Necrolab { */ async () => { const res = await request.get({ - uri: `https://necrolab.com/api/rankings/steam/all-time-any-percent-synchrony-amplified-single-player-ost/all/entries/${rank}/leaderboards/wins?limit=10000`, - json: true + uri: `https://www.necrolab.com/api/rankings/steam/all-time~any-percent~synchrony-amplified~single-player~ost/all/entries/${rank}/leaderboards/wins?limit=10000`, + json: true, + auth: { + bearer: process.env.NECROLAB_TOKEN + } }); if (res.statusCode !== 200) { @@ -192,8 +204,11 @@ class Necrolab { } const res = await request.get({ - uri: "https://necrolab.com/api/filters", - json: true + uri: "https://www.necrolab.com/api/filters", + json: true, + auth: { + bearer: process.env.NECROLAB_TOKEN + } }); if (res.statusCode !== 200) { diff --git a/node-roncli-com/start.sh b/node-roncli-com/start.sh index 3e398b94..11122146 100644 --- a/node-roncli-com/start.sh +++ b/node-roncli-com/start.sh @@ -7,4 +7,4 @@ then fi # Run app. -exec env APPINSIGHTS_INSTRUMENTATIONKEY=$(cat $APPINSIGHTS_INSTRUMENTATIONKEY) env BLIZZARD_CLIENT_ID=$(cat $BLIZZARD_CLIENT_ID_FILE) env BLIZZARD_CLIENT_SECRET=$(cat $BLIZZARD_CLIENT_SECRET_FILE) env COOKIE_SECRET=$(cat $COOKIE_SECRET_FILE) env DISCORD_TOKEN=$(cat $DISCORD_TOKEN_FILE) env ENCRYPTION_KEY=$(cat $ENCRYPTION_KEY_FILE) env GITHUB_TOKEN=$(cat $GITHUB_TOKEN_FILE) env GOOGLE_API_KEY=$(cat $GOOGLE_API_KEY_FILE) env REDIS_PASSWORD=$(cat $REDIS_PASSWORD_FILE) env SMTP_PASSWORD=$(cat $SMTP_PASSWORD_FILE) env SOUNDCLOUD_CLIENT_ID=$(cat $SOUNDCLOUD_CLIENT_ID_FILE) env SOUNDCLOUD_CLIENT_SECRET=$(cat $SOUNDCLOUD_CLIENT_SECRET_FILE) env STEAM_API_KEY=$(cat $STEAM_API_KEY_FILE) env TUMBLR_CONSUMER_KEY=$(cat $TUMBLR_CONSUMER_KEY_FILE) env TWITCH_CLIENTID=$(cat $TWITCH_CLIENTID_FILE) env TWITCH_CLIENTSECRET=$(cat $TWITCH_CLIENTSECRET_FILE) env WEB_RONCLI_PASSWORD=$(cat $WEB_RONCLI_PASSWORD_FILE) env XIVAPI_API_KEY=$(cat $XIVAPI_API_KEY_FILE) node index +exec env APPINSIGHTS_INSTRUMENTATIONKEY=$(cat $APPINSIGHTS_INSTRUMENTATIONKEY) env BLIZZARD_CLIENT_ID=$(cat $BLIZZARD_CLIENT_ID_FILE) env BLIZZARD_CLIENT_SECRET=$(cat $BLIZZARD_CLIENT_SECRET_FILE) env COOKIE_SECRET=$(cat $COOKIE_SECRET_FILE) env DISCORD_TOKEN=$(cat $DISCORD_TOKEN_FILE) env ENCRYPTION_KEY=$(cat $ENCRYPTION_KEY_FILE) env GITHUB_TOKEN=$(cat $GITHUB_TOKEN_FILE) env GOOGLE_API_KEY=$(cat $GOOGLE_API_KEY_FILE) env NECROLAB_TOKEN=$(cat $NECROLAB_TOKEN_FILE) env REDIS_PASSWORD=$(cat $REDIS_PASSWORD_FILE) env SMTP_PASSWORD=$(cat $SMTP_PASSWORD_FILE) env SOUNDCLOUD_CLIENT_ID=$(cat $SOUNDCLOUD_CLIENT_ID_FILE) env SOUNDCLOUD_CLIENT_SECRET=$(cat $SOUNDCLOUD_CLIENT_SECRET_FILE) env STEAM_API_KEY=$(cat $STEAM_API_KEY_FILE) env TUMBLR_CONSUMER_KEY=$(cat $TUMBLR_CONSUMER_KEY_FILE) env TWITCH_CLIENTID=$(cat $TWITCH_CLIENTID_FILE) env TWITCH_CLIENTSECRET=$(cat $TWITCH_CLIENTSECRET_FILE) env WEB_RONCLI_PASSWORD=$(cat $WEB_RONCLI_PASSWORD_FILE) env XIVAPI_API_KEY=$(cat $XIVAPI_API_KEY_FILE) node index