Skip to content

Commit

Permalink
use user's cid for statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoerlitz committed May 20, 2024
1 parent b662587 commit 331c9f1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions backend/src/controllers/user/UserStatisticsController.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NextFunction, Request, Response } from "express";
import axios from "axios";
import { User } from "../../models/User";
import { Config } from "../../core/Config";
import { localCache } from "../../core/Cache";

// TODO: The entire statistics controller should ideally cache the data for at least a day (the hours really don't change that much).
Expand All @@ -12,10 +11,6 @@ async function getUserRatingTimes(request: Request, response: Response, next: Ne
const user: User = response.locals.user;
let userID = user.id;

if (Config.APP_DEBUG) {
userID = 1373921;
}

if (localCache.has(userID)) {
response.send(localCache.get(userID));
return;
Expand Down
2 changes: 1 addition & 1 deletion backend/src/libraries/vatsim/ConnectLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class VatsimConnectLibrary {
*/
private async _checkIsUserAllowed() {
if (this.m_userData == undefined) return null;
const allowed_cids = [1373921, 1450775, 1331358, 1357290, 1439797, 1583954, 1438611, 1432304, 1439600, 1463320, 1238939, 10000010, 10000001, 1117638,1132984,1238939,1272780,1316527,1336219,1357290,1407054,1432304,1439600,1439797,1443079,1447366,1451860,1454201,1463320,1467762,1467870,1487136,1506680,1507672,1520064,1524005,1569331,1583954,1593864,1626019,1627359,1649341,1667561,1692470,944693,1083033,1196986,1238939,1272780,1316527,1336219,1345921,1378351,1404385,1433041,1434698,1438611,1439600,1439797,1447366,1454201,1457329,1467740,1467870,1468997,1477025,1477582,1482057,1482456,1488616,1495699,1527122,1528134,1542149,1543292,1583954,1591329,1610484,1625839,1627359,1657818,1044887,1077986,1279468,1342244,1357290,1381951,1395737,1413802,1451860,1456550,1459636,1463320,1465242,1466083,1468202,1476945,1487136,1491867,1501396,1504305,1512446,1520064,1524005,1556813,1558853,1611428,1612478,874505,1378091,1432304,1441619,1470223,1519114,1519639,1586741,1593864,1626019];
const allowed_cids = [1373921,1119615, 1450775, 1331358, 1357290, 1439797, 1583954, 1438611, 1432304, 1439600, 1463320, 1238939, 10000010, 10000001, 1117638,1132984,1238939,1272780,1316527,1336219,1357290,1407054,1432304,1439600,1439797,1443079,1447366,1451860,1454201,1463320,1467762,1467870,1487136,1506680,1507672,1520064,1524005,1569331,1583954,1593864,1626019,1627359,1649341,1667561,1692470,944693,1083033,1196986,1238939,1272780,1316527,1336219,1345921,1378351,1404385,1433041,1434698,1438611,1439600,1439797,1447366,1454201,1457329,1467740,1467870,1468997,1477025,1477582,1482057,1482456,1488616,1495699,1527122,1528134,1542149,1543292,1583954,1591329,1610484,1625839,1627359,1657818,1044887,1077986,1279468,1342244,1357290,1381951,1395737,1413802,1451860,1456550,1459636,1463320,1465242,1466083,1468202,1476945,1487136,1491867,1501396,1504305,1512446,1520064,1524005,1556813,1558853,1611428,1612478,874505,1378091,1432304,1441619,1470223,1519114,1519639,1586741,1593864,1626019];

if (!allowed_cids.includes(Number(this.m_userData.data.cid))) {
throw new VatsimConnectException(ConnectLibraryErrors.ERR_SUSPENDED);
Expand Down

0 comments on commit 331c9f1

Please sign in to comment.