From 0b067d264593af2fc2dab52d6608c53dc31692ac Mon Sep 17 00:00:00 2001 From: Rim Date: Sat, 19 Apr 2025 22:31:14 -0400 Subject: [PATCH] chore: migrate mapList to CDN tab & update replacements --- app.js | 26 +++++++------------------- src/data/replacements.json | 12 ++++++++++-- src/index.html | 25 ++++++++++++++----------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/app.js b/app.js index 79c8a03..bb97a2d 100644 --- a/app.js +++ b/app.js @@ -146,11 +146,6 @@ app.post('/api/stats', async (req, res) => { return res.status(400).json({ error: 'SSO Token is required' }); } */ - // For mapList, username is not required - if (apiCall !== 'mapList' && !username) { - return res.status(400).json({ error: 'Username is required' }); - } - // Clear previous session if it exists if (activeSessions.has(ssoToken)) { logger.debug('Clearing previous session'); @@ -181,7 +176,7 @@ app.post('/api/stats', async (req, res) => { // Check if the platform is valid for the game const requiresUno = ['mw2', 'wz2', 'mw3', 'wzm'].includes(game); - if (requiresUno && platform !== 'uno' && apiCall !== 'mapList') { + if (requiresUno && platform !== 'uno') { logger.warn(`${game} requires Uno ID`); return res.status(200).json({ status: 'error', @@ -296,19 +291,6 @@ app.post('/api/stats', async (req, res) => { timestamp: global.Utils.toIsoString(new Date()), }); } - } else if (apiCall === 'mapList') { - // Fetch map list (only valid for MW) - if (game === 'mw') { - data = await fetchWithTimeout(() => - API.ModernWarfare.mapList(platform) - ); - } else { - return res.status(200).json({ - status: 'error', - message: 'Map list is only available for Modern Warfare', - timestamp: global.Utils.toIsoString(new Date()), - }); - } } logger.debug('Data fetched successfully'); @@ -871,9 +853,15 @@ app.post('/api/cdn', async (req, res) => { try { logger.debug(`Attempting to fetch CDN data for ${cdnCall}`); let data; + let platform = API.platforms.Activision; // Fetch user data based on cdnCall switch (cdnCall) { + case 'mapList': + data = await fetchWithTimeout(() => + API.ModernWarfare.mapList(platform) + ); + break; case 'accolades': data = await fetchWithTimeout(() => API.CDN.accolades()); break; diff --git a/src/data/replacements.json b/src/data/replacements.json index b5b2d86..0833860 100644 --- a/src/data/replacements.json +++ b/src/data/replacements.json @@ -70,7 +70,7 @@ "conf": "Kill Confirmed", "cruise_predator": "Cruise Missile", "ctf": "Capture the Flag", - "cw": "Cold War", + "cw": "Call of Duty: Cold War (2020)", "cyber_hc": "Cyber Attack Hardcore", "cyber": "Cyber Attack", "dd_hc": "Demolition Hardcore", @@ -398,7 +398,11 @@ "mp_village_rm": "Standoff", "mp_village2": "Hovec Sawmill", "mp_zoo_rm": "Zoo", - "mw": "Modern Warfare", + "mw": "Call of Duty: Modern Warfare (2019)", + "mw2": "Call of Duty: Modern Warfare 2 (2022)", + "mw3": "Call of Duty: Modern Warfare 3 (2023)", + "mwii": "Call of Duty: Modern Warfare 2 (2022)", + "mwiii": "Call of Duty: Modern Warfare 3 (2023)", "nuke": "Nuke", "nuketown6_holiday": "Nuketown '84 Holiday", "pac_sentry": "", @@ -433,6 +437,7 @@ "toma_strike": "Cluster Strike", "uav": "UAV", "uno": "PC", + "vg": "Call of Duty: Vanguard (2021)", "war_hc": "Team Deathmatch Hardcore", "war": "Team Deathmatch", "weapon_assault_rifle": "Assault Rifle", @@ -456,5 +461,8 @@ "wz_golova": "Golova", "wz_sanatorium": "Sanatorium", "wz_ski_slopes": "Alpine", + "wz": "Call of Duty: Warzone™ (2019)", + "wz2": "Call of Duty: Warzone™ 2 (2022)", + "wzm": "Call of Duty: Warzone Mobile (2024)", "xbl": "Xbox Live" } diff --git a/src/index.html b/src/index.html index 8e3e690..78c84a3 100644 --- a/src/index.html +++ b/src/index.html @@ -179,13 +179,14 @@
@@ -193,11 +194,10 @@ - +

Authentication Setup

@@ -360,7 +360,9 @@ + - +