chore: migrate mapList to CDN tab & update replacements

This commit is contained in:
Rim 2025-04-19 22:31:14 -04:00
parent 6b53294330
commit 0b067d2645
3 changed files with 31 additions and 32 deletions

26
app.js
View File

@ -146,11 +146,6 @@ app.post('/api/stats', async (req, res) => {
return res.status(400).json({ error: 'SSO Token is required' }); 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 // Clear previous session if it exists
if (activeSessions.has(ssoToken)) { if (activeSessions.has(ssoToken)) {
logger.debug('Clearing previous session'); 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 // Check if the platform is valid for the game
const requiresUno = ['mw2', 'wz2', 'mw3', 'wzm'].includes(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`); logger.warn(`${game} requires Uno ID`);
return res.status(200).json({ return res.status(200).json({
status: 'error', status: 'error',
@ -296,19 +291,6 @@ app.post('/api/stats', async (req, res) => {
timestamp: global.Utils.toIsoString(new Date()), 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'); logger.debug('Data fetched successfully');
@ -871,9 +853,15 @@ app.post('/api/cdn', async (req, res) => {
try { try {
logger.debug(`Attempting to fetch CDN data for ${cdnCall}`); logger.debug(`Attempting to fetch CDN data for ${cdnCall}`);
let data; let data;
let platform = API.platforms.Activision;
// Fetch user data based on cdnCall // Fetch user data based on cdnCall
switch (cdnCall) { switch (cdnCall) {
case 'mapList':
data = await fetchWithTimeout(() =>
API.ModernWarfare.mapList(platform)
);
break;
case 'accolades': case 'accolades':
data = await fetchWithTimeout(() => API.CDN.accolades()); data = await fetchWithTimeout(() => API.CDN.accolades());
break; break;

View File

@ -70,7 +70,7 @@
"conf": "Kill Confirmed", "conf": "Kill Confirmed",
"cruise_predator": "Cruise Missile", "cruise_predator": "Cruise Missile",
"ctf": "Capture the Flag", "ctf": "Capture the Flag",
"cw": "Cold War", "cw": "Call of Duty: Cold War (2020)",
"cyber_hc": "Cyber Attack Hardcore", "cyber_hc": "Cyber Attack Hardcore",
"cyber": "Cyber Attack", "cyber": "Cyber Attack",
"dd_hc": "Demolition Hardcore", "dd_hc": "Demolition Hardcore",
@ -398,7 +398,11 @@
"mp_village_rm": "Standoff", "mp_village_rm": "Standoff",
"mp_village2": "Hovec Sawmill", "mp_village2": "Hovec Sawmill",
"mp_zoo_rm": "Zoo", "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", "nuke": "Nuke",
"nuketown6_holiday": "Nuketown '84 Holiday", "nuketown6_holiday": "Nuketown '84 Holiday",
"pac_sentry": "", "pac_sentry": "",
@ -433,6 +437,7 @@
"toma_strike": "Cluster Strike", "toma_strike": "Cluster Strike",
"uav": "UAV", "uav": "UAV",
"uno": "PC", "uno": "PC",
"vg": "Call of Duty: Vanguard (2021)",
"war_hc": "Team Deathmatch Hardcore", "war_hc": "Team Deathmatch Hardcore",
"war": "Team Deathmatch", "war": "Team Deathmatch",
"weapon_assault_rifle": "Assault Rifle", "weapon_assault_rifle": "Assault Rifle",
@ -456,5 +461,8 @@
"wz_golova": "Golova", "wz_golova": "Golova",
"wz_sanatorium": "Sanatorium", "wz_sanatorium": "Sanatorium",
"wz_ski_slopes": "Alpine", "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" "xbl": "Xbox Live"
} }

View File

@ -179,13 +179,14 @@
<div class="form-group"> <div class="form-group">
<label for="game">Game:</label> <label for="game">Game:</label>
<select id="game"> <select id="game">
<option value="mw">Modern Warfare / Warzone</option> <option value="mw">Call of Duty: Modern Warfare (2019)</option>
<option value="mw2">Modern Warfare 2</option> <option value="wz">Call of Duty: Warzone™ (2019)</option>
<option value="wz2">Warzone 2</option> <option value="cw">Call of Duty: Cold War (2020)</option>
<option value="mw3">Modern Warfare 3</option> <option value="vg">Call of Duty: Vanguard (2021)</option>
<option value="cw">Cold War</option> <option value="mw2">Call of Duty: Modern Warfare 2 (2022)</option>
<option value="vg">Vanguard</option> <option value="wz2">Call of Duty: Warzone™ 2 (2022)</option>
<option value="wzm">Warzone Mobile</option> <option value="mw3">Call of Duty: Modern Warfare 3 (2023)</option>
<option value="wzm">Call of Duty: Warzone Mobile (2024)</option>
</select> </select>
</div> </div>
@ -193,11 +194,10 @@
<label for="apiCall">API Request:</label> <label for="apiCall">API Request:</label>
<select id="apiCall"> <select id="apiCall">
<option value="fullData">Lifetime Statistics</option> <option value="fullData">Lifetime Statistics</option>
<option value="mapList">Map List</option>
</select> </select>
</div> </div>
<button id="fetchStats">Fetch Stats</button> <button id="fetchStats">Fetch Lifetime Statistics</button>
<div id="tutorial" class="tutorial"> <div id="tutorial" class="tutorial">
<h2>Authentication Setup</h2> <h2>Authentication Setup</h2>
@ -360,7 +360,9 @@
<select id="userCall"> <select id="userCall">
<option value="userInfo">User Info (Logged In User Only)</option> <option value="userInfo">User Info (Logged In User Only)</option>
<option value="codPoints">COD Points (Logged In User Only)</option> <option value="codPoints">COD Points (Logged In User Only)</option>
<option value="connectedAccounts">Connected Accounts (Logged In User Only)</option> <option value="connectedAccounts">
Connected Accounts (Logged In User Only)
</option>
<option value="identities">Identities (Logged In User Only)</option> <option value="identities">Identities (Logged In User Only)</option>
<option value="friendsList"> <option value="friendsList">
Friends List (Logged In User Only) Friends List (Logged In User Only)
@ -420,8 +422,9 @@
<div class="form-group"> <div class="form-group">
<label for="cdnCall">API Request:</label> <label for="cdnCall">API Request:</label>
<select id="cdnCall"> <select id="cdnCall">
<option value="mapList">Map List</option>
<option value="accolades">Accolade List</option> <option value="accolades">Accolade List</option>
<option value="allCDNData">CDN Data List</option> <option value="allCDNData">General Data List</option>
</select> </select>
</div> </div>