diff --git a/src/cache.ts b/src/cache.ts index e8f9743..37e5ed5 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -24,4 +24,4 @@ export default class Cache { get(): T | undefined { return this.data; } -} \ No newline at end of file +} diff --git a/src/config-manager.ts b/src/config-manager.ts index 38788ed..6affc9f 100644 --- a/src/config-manager.ts +++ b/src/config-manager.ts @@ -1,8 +1,8 @@ import fs from 'fs-extra'; -import mongoose from 'mongoose'; import dotenv from 'dotenv'; import { LOG_INFO, LOG_WARN, LOG_ERROR } from '@/logger'; -import { Config } from '@/types/common/config'; +import type mongoose from 'mongoose'; +import type { Config } from '@/types/common/config'; dotenv.config(); @@ -72,7 +72,7 @@ if (!config.cdn_url) { try { new URL(config.cdn_url); -} catch (e) { +} catch { LOG_ERROR('Invalid CDN URL, URL must be a valid URL with a protocol (http/https) and domain'); process.exit(0); } @@ -138,4 +138,4 @@ if (!config.grpc.account.api_key) { if (!config.aes_key) { LOG_ERROR('Token AES key is not set. Set the PN_MIIVERSE_API_CONFIG_AES_KEY environment variable to your AES-256-CBC key'); process.exit(0); -} \ No newline at end of file +} diff --git a/src/database.ts b/src/database.ts index 6f2a45d..8e16561 100644 --- a/src/database.ts +++ b/src/database.ts @@ -7,12 +7,12 @@ import { Endpoint } from '@/models/endpoint'; import { Post } from '@/models/post'; import { Settings } from '@/models/settings'; import { config } from '@/config-manager'; -import { HydratedCommunityDocument } from '@/types/mongoose/community'; -import { HydratedPostDocument, IPost } from '@/types/mongoose/post'; -import { HydratedEndpointDocument } from '@/types/mongoose/endpoint'; -import { HydratedSettingsDocument } from '@/types/mongoose/settings'; -import { HydratedContentDocument } from '@/types/mongoose/content'; -import { HydratedConversationDocument } from '@/types/mongoose/conversation'; +import type { HydratedConversationDocument } from '@/types/mongoose/conversation'; +import type { HydratedContentDocument } from '@/types/mongoose/content'; +import type { HydratedSettingsDocument } from '@/types/mongoose/settings'; +import type { HydratedEndpointDocument } from '@/types/mongoose/endpoint'; +import type { HydratedPostDocument, IPost } from '@/types/mongoose/post'; +import type { HydratedCommunityDocument } from '@/types/mongoose/community'; const { mongoose: mongooseConfig } = config; @@ -176,4 +176,4 @@ export async function getFriendMessages(pid: string, search_key: string[], limit parent: null, removed: false }).sort({ created_at: 1 }).limit(limit); -} \ No newline at end of file +} diff --git a/src/logger.ts b/src/logger.ts index 21bb483..2f5ecb0 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -44,4 +44,4 @@ export function LOG_INFO(input: string): void { streams.info.write(`${input}\n`); console.log(`${input}`.cyan.bold); -} \ No newline at end of file +} diff --git a/src/middleware/auth.ts b/src/middleware/auth.ts index d7b2f3d..628ad8b 100644 --- a/src/middleware/auth.ts +++ b/src/middleware/auth.ts @@ -1,11 +1,11 @@ -import express from 'express'; import xmlbuilder from 'xmlbuilder'; import moment from 'moment'; import { z } from 'zod'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; -import { getEndpoint, getUserSettings } from '@/database'; import { getUserAccountData, getValueFromHeaders, decodeParamPack, getPIDFromServiceToken } from '@/util'; -import { HydratedEndpointDocument } from '@/types/mongoose/endpoint'; +import { getEndpoint, getUserSettings } from '@/database'; +import type express from 'express'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { HydratedEndpointDocument } from '@/types/mongoose/endpoint'; const ParamPackSchema = z.object({ title_id: z.string(), @@ -112,7 +112,6 @@ async function auth(request: express.Request, response: express.Response, next: } else { return badAuth(response, 7, 'PNID_PERM_BAN'); } - } return next(); diff --git a/src/middleware/client-header.ts b/src/middleware/client-header.ts index 7b40938..85646fa 100644 --- a/src/middleware/client-header.ts +++ b/src/middleware/client-header.ts @@ -1,15 +1,14 @@ -import express from 'express'; import xmlbuilder from 'xmlbuilder'; import { getValueFromHeaders } from '@/util'; +import type express from 'express'; const VALID_CLIENT_ID_SECRET_PAIRS: { [key: string]: string } = { // * 'Key' is the client ID, 'Value' is the client secret - 'a2efa818a34fa16b8afbc8a74eba3eda': 'c91cdb5658bd4954ade78533a339cf9a', // * Possibly WiiU exclusive? - 'daf6227853bcbdce3d75baee8332b': '3eff548eac636e2bf45bb7b375e7b6b0', // * Possibly 3DS exclusive? - 'ea25c66c26b403376b4c5ed94ab9cdea': 'd137be62cb6a2b831cad8c013b92fb55', // * Possibly 3DS exclusive? + a2efa818a34fa16b8afbc8a74eba3eda: 'c91cdb5658bd4954ade78533a339cf9a', // * Possibly WiiU exclusive? + daf6227853bcbdce3d75baee8332b: '3eff548eac636e2bf45bb7b375e7b6b0', // * Possibly 3DS exclusive? + ea25c66c26b403376b4c5ed94ab9cdea: 'd137be62cb6a2b831cad8c013b92fb55' // * Possibly 3DS exclusive? }; - function nintendoClientHeaderCheck(request: express.Request, response: express.Response, next: express.NextFunction): void { response.type('text/xml'); response.set('Server', 'Nintendo 3DS (http)'); @@ -41,4 +40,4 @@ function nintendoClientHeaderCheck(request: express.Request, response: express.R return next(); } -export default nintendoClientHeaderCheck; \ No newline at end of file +export default nintendoClientHeaderCheck; diff --git a/src/models/community.ts b/src/models/community.ts index 284c35a..c06bbd1 100644 --- a/src/models/community.ts +++ b/src/models/community.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; -import { CommunityData } from '@/types/miiverse/community'; -import { ICommunity, ICommunityMethods, CommunityModel, ICommunityPermissions, HydratedCommunityDocument } from '@/types/mongoose/community'; +import type { CommunityData } from '@/types/miiverse/community'; +import type { ICommunity, ICommunityMethods, CommunityModel, ICommunityPermissions, HydratedCommunityDocument } from '@/types/mongoose/community'; const PermissionsSchema = new Schema({ open: { @@ -18,7 +18,7 @@ const PermissionsSchema = new Schema({ minimum_new_community_access_level: { type: Number, default: 0 - }, + } }); const CommunitySchema = new Schema({ @@ -54,7 +54,7 @@ const CommunitySchema = new Schema('json', function json(): Commu }; }); -export const Community = model('Community', CommunitySchema); \ No newline at end of file +export const Community = model('Community', CommunitySchema); diff --git a/src/models/content.ts b/src/models/content.ts index 8818c39..4443848 100644 --- a/src/models/content.ts +++ b/src/models/content.ts @@ -1,5 +1,5 @@ import { Schema, model } from 'mongoose'; -import { IContent, ContentModel } from '@/types/mongoose/content'; +import type { IContent, ContentModel } from '@/types/mongoose/content'; const ContentSchema = new Schema({ pid: Number, diff --git a/src/models/conversation.ts b/src/models/conversation.ts index 304b630..d7c9d83 100644 --- a/src/models/conversation.ts +++ b/src/models/conversation.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { Snowflake } from 'node-snowflake'; -import { IConversation, IConversationMethods, ConversationModel, HydratedConversationDocument } from '@/types/mongoose/conversation'; +import type { IConversation, IConversationMethods, ConversationModel, HydratedConversationDocument } from '@/types/mongoose/conversation'; const ConversationSchema = new Schema({ id: { @@ -9,11 +9,11 @@ const ConversationSchema = new Schema('newMessage', async func await this.save(); }); -export const Conversation = model('Conversation', ConversationSchema); \ No newline at end of file +export const Conversation = model('Conversation', ConversationSchema); diff --git a/src/models/endpoint.ts b/src/models/endpoint.ts index bc57f56..19c3b2a 100644 --- a/src/models/endpoint.ts +++ b/src/models/endpoint.ts @@ -1,5 +1,5 @@ import { Schema, model } from 'mongoose'; -import { IEndpoint, EndpointModel } from '@/types/mongoose/endpoint'; +import type { IEndpoint, EndpointModel } from '@/types/mongoose/endpoint'; const endpointSchema = new Schema({ status: Number, diff --git a/src/models/notification.ts b/src/models/notification.ts index a4fd5dd..f683db3 100644 --- a/src/models/notification.ts +++ b/src/models/notification.ts @@ -1,5 +1,5 @@ import { Schema, model } from 'mongoose'; -import { INotification, NotificationModel } from '@/types/mongoose/notification'; +import type { INotification, NotificationModel } from '@/types/mongoose/notification'; const NotificationSchema = new Schema({ pid: String, diff --git a/src/models/post.ts b/src/models/post.ts index f221f1a..11eb963 100644 --- a/src/models/post.ts +++ b/src/models/post.ts @@ -2,10 +2,10 @@ import crypto from 'node:crypto'; import moment from 'moment'; import { Schema, model } from 'mongoose'; import { INVALID_POST_BODY_REGEX } from '@/util'; -import { HydratedPostDocument, IPost, IPostMethods, PostModel } from '@/types/mongoose/post'; -import { HydratedCommunityDocument } from '@/types/mongoose/community'; -import { PostToJSONOptions } from '@/types/mongoose/post-to-json-options'; -import { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/types/miiverse/post'; +import type { HydratedPostDocument, IPost, IPostMethods, PostModel } from '@/types/mongoose/post'; +import type { HydratedCommunityDocument } from '@/types/mongoose/community'; +import type { PostToJSONOptions } from '@/types/mongoose/post-to-json-options'; +import type { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/types/miiverse/post'; const PostSchema = new Schema({ id: String, @@ -88,7 +88,6 @@ const PostSchema = new Schema({ id: false // * Disables the .id() getter used by Mongoose in TypeScript. Needed to have our own .id field }); - PostSchema.method('del', async function del(reason: string) { this.removed = true; this.removed_reason = reason; @@ -178,7 +177,7 @@ PostSchema.method('json', function json(options: PostToJSO screen_name: this.screen_name, screenshot: this.formatScreenshot(), topic_tag: undefined, // * Conditionally set later - title_id: this.title_id, + title_id: this.title_id }; if (options.app_data) { @@ -206,7 +205,7 @@ PostSchema.method('json', function json(options: PostToJSO return post; }); -PostSchema.pre('save', async function(next) { +PostSchema.pre('save', async function (next) { if (!this.id) { await this.generatePostUID(21); } diff --git a/src/models/report.ts b/src/models/report.ts index 608b729..436b645 100644 --- a/src/models/report.ts +++ b/src/models/report.ts @@ -1,5 +1,5 @@ import { Schema, model } from 'mongoose'; -import { IReport, ReportModel } from '@/types/mongoose/report'; +import type { IReport, ReportModel } from '@/types/mongoose/report'; const ReportSchema = new Schema({ pid: String, diff --git a/src/models/settings.ts b/src/models/settings.ts index d3c7e03..48f721a 100644 --- a/src/models/settings.ts +++ b/src/models/settings.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; -import { SettingsData } from '@/types/miiverse/settings'; -import { HydratedSettingsDocument, ISettings, ISettingsMethods, SettingsModel } from '@/types/mongoose/settings'; +import type { SettingsData } from '@/types/miiverse/settings'; +import type { HydratedSettingsDocument, ISettings, ISettingsMethods, SettingsModel } from '@/types/mongoose/settings'; const SettingsSchema = new Schema({ pid: Number, diff --git a/src/server.ts b/src/server.ts index 46d42c7..3f80fb4 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,20 +1,18 @@ -process.title = 'Pretendo - Miiverse'; -process.on('SIGTERM', () => { - process.exit(0); -}); - import express from 'express'; import morgan from 'morgan'; import xmlbuilder from 'xmlbuilder'; import { connect as connectDatabase } from '@/database'; import { LOG_INFO, LOG_SUCCESS } from '@/logger'; import auth from '@/middleware/auth'; - import discovery from '@/services/discovery'; import api from '@/services/api'; - import { config } from '@/config-manager'; +process.title = 'Pretendo - Miiverse'; +process.on('SIGTERM', () => { + process.exit(0); +}); + const { http: { port } } = config; const app = express(); diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 005cf53..94faaa4 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -1,7 +1,6 @@ import express from 'express'; import subdomain from 'express-subdomain'; import { LOG_INFO } from '@/logger'; - import postsHandlers from '@/services/api/routes/posts'; import friendMessagesHandlers from '@/services/api/routes/friend_messages'; import communitiesHandlers from '@/services/api/routes/communities'; @@ -32,4 +31,4 @@ api.use('/v1/topics/', topicsHandlers); api.use('/v1/users/', usersHandlers); api.use('/v1/status/', statusHandlers); -export default router; \ No newline at end of file +export default router; diff --git a/src/services/api/routes/communities.ts b/src/services/api/routes/communities.ts index 40376f2..0ccf978 100644 --- a/src/services/api/routes/communities.ts +++ b/src/services/api/routes/communities.ts @@ -2,23 +2,23 @@ import express from 'express'; import xmlbuilder from 'xmlbuilder'; import multer from 'multer'; import { z } from 'zod'; +import { Post } from '@/models/post'; +import { Community } from '@/models/community'; +import { LOG_WARN } from '@/logger'; +import { getValueFromQueryString, getUserAccountData } from '@/util'; import { getMostPopularCommunities, getNewCommunities, getCommunityByTitleID, - getUserContent, + getUserContent } from '@/database'; -import { getValueFromQueryString, getUserAccountData } from '@/util'; -import { LOG_WARN } from '@/logger'; -import { Community } from '@/models/community'; -import { Post } from '@/models/post'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; -import { HydratedCommunityDocument } from '@/types/mongoose/community'; -import { SubCommunityQuery } from '@/types/mongoose/subcommunity-query'; -import { CommunityPostsQuery } from '@/types/mongoose/community-posts-query'; -import { HydratedPostDocument, IPost } from '@/types/mongoose/post'; -import { ParamPack } from '@/types/common/param-pack'; -import { CommunitiesResult, CommunityPostsResult } from '@/types/miiverse/community'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { HydratedCommunityDocument } from '@/types/mongoose/community'; +import type { SubCommunityQuery } from '@/types/mongoose/subcommunity-query'; +import type { CommunityPostsQuery } from '@/types/mongoose/community-posts-query'; +import type { HydratedPostDocument, IPost } from '@/types/mongoose/post'; +import type { ParamPack } from '@/types/common/param-pack'; +import type { CommunitiesResult, CommunityPostsResult } from '@/types/miiverse/community'; const createNewCommunitySchema = z.object({ name: z.string(), @@ -46,7 +46,6 @@ function respondCommunityNotFound(response: express.Response): void { } async function commonGetSubCommunity(paramPack: ParamPack, communityID: string | undefined): Promise { - const parentCommunity = await getCommunityByTitleID(paramPack.title_id); if (!parentCommunity) { @@ -191,7 +190,7 @@ router.get('/:communityID/posts', async function (request: express.Request, resp query.is_spoiler = 0; } - //TODO: There probably is a type for text and screenshots too, will have to investigate + // TODO: There probably is a type for text and screenshots too, will have to investigate if (postType === 'memo') { query.painting = { $ne: null }; } @@ -272,8 +271,8 @@ router.post('/', multer().none(), async function (request: express.Request, resp let pnid: GetUserDataResponse; try { - pnid = await getUserAccountData(request.pid); - } catch (error) { + pnid = await getUserAccountData(request.pid); + } catch (ignored) { // TODO - Log this error response.sendStatus(403); return; @@ -455,7 +454,6 @@ router.post('/:community_id.unfavorite', multer().none(), async function (reques })); }); - router.post('/:community_id', multer().none(), async function (request: express.Request, response: express.Response): Promise { response.type('application/xml'); diff --git a/src/services/api/routes/friend_messages.ts b/src/services/api/routes/friend_messages.ts index fdc720d..d0a9446 100644 --- a/src/services/api/routes/friend_messages.ts +++ b/src/services/api/routes/friend_messages.ts @@ -4,7 +4,6 @@ import { Snowflake } from 'node-snowflake'; import moment from 'moment'; import xmlbuilder from 'xmlbuilder'; import { z } from 'zod'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; import { getUserFriendPIDs, getUserAccountData, @@ -17,8 +16,9 @@ import { getConversationByUsers, getUserSettings, getFriendMessages } from '@/da import { LOG_WARN } from '@/logger'; import { Post } from '@/models/post'; import { Conversation } from '@/models/conversation'; -import { FormattedMessage } from '@/types/common/formatted-message'; import { config } from '@/config-manager'; +import type { FormattedMessage } from '@/types/common/formatted-message'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; const sendMessageSchema = z.object({ body: z.string().optional(), @@ -28,7 +28,7 @@ const sendMessageSchema = z.object({ feeling_id: z.string(), is_autopost: z.string(), number: z.string(), - message_to_pid: z.string().transform(Number), + message_to_pid: z.string().transform(Number) }); const router = express.Router(); @@ -62,7 +62,7 @@ router.post('/', upload.none(), async function (request: express.Request, respon try { sender = await getUserAccountData(request.pid); - } catch (error) { + } catch (ignored) { LOG_WARN('[Messages] Cannot find sender'); response.sendStatus(422); return; @@ -79,7 +79,7 @@ router.post('/', upload.none(), async function (request: express.Request, respon try { recipient = await getUserAccountData(recipientPID); - } catch (error) { + } catch (ignored) { // TODO - Log this error LOG_WARN('[Messages] Cannot find recipient'); response.type('application/xml'); @@ -121,7 +121,7 @@ router.post('/', upload.none(), async function (request: express.Request, respon pid: recipient.pid, official: (recipient.accessLevel === 2 || recipient.accessLevel === 3), read: false - }, + } ] }); } @@ -330,4 +330,4 @@ router.post('/:post_id/empathies', upload.none(), async function (_request: expr */ }); -export default router; \ No newline at end of file +export default router; diff --git a/src/services/api/routes/people.ts b/src/services/api/routes/people.ts index b372893..53b14fa 100644 --- a/src/services/api/routes/people.ts +++ b/src/services/api/routes/people.ts @@ -4,9 +4,9 @@ import moment from 'moment'; import { getUserContent, getFollowedUsers } from '@/database'; import { getValueFromQueryString, getUserFriendPIDs } from '@/util'; import { Post } from '@/models/post'; -import { CommunityPostsQuery } from '@/types/mongoose/community-posts-query'; -import { HydratedPostDocument, IPost } from '@/types/mongoose/post'; -import { PeopleFollowingResult, PeoplePostsResult } from '@/types/miiverse/people'; +import type { CommunityPostsQuery } from '@/types/mongoose/community-posts-query'; +import type { HydratedPostDocument, IPost } from '@/types/mongoose/post'; +import type { PeopleFollowingResult, PeoplePostsResult } from '@/types/miiverse/people'; const router = express.Router(); @@ -68,9 +68,9 @@ router.get('/', async function (request: express.Request, response: express.Resp posts = unhydratedPosts.map((post: IPost) => Post.hydrate(post)); } else if (request.query.is_hot === '1') { - posts = await Post.find(query).sort({ empathy_count: -1}).limit(limit); + posts = await Post.find(query).sort({ empathy_count: -1 }).limit(limit); } else { - posts = await Post.find(query).sort({ created_at: -1}).limit(limit); + posts = await Post.find(query).sort({ created_at: -1 }).limit(limit); } const result: PeoplePostsResult = { @@ -148,4 +148,4 @@ router.get('/:pid/following', async function (request: express.Request, response })); }); -export default router; \ No newline at end of file +export default router; diff --git a/src/services/api/routes/posts.ts b/src/services/api/routes/posts.ts index 77eedac..4855a92 100644 --- a/src/services/api/routes/posts.ts +++ b/src/services/api/routes/posts.ts @@ -2,7 +2,6 @@ import express from 'express'; import multer from 'multer'; import xmlbuilder from 'xmlbuilder'; import { z } from 'zod'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; import { getUserAccountData, processPainting, @@ -22,9 +21,10 @@ import { import { LOG_WARN } from '@/logger'; import { Post } from '@/models/post'; import { Community } from '@/models/community'; -import { HydratedPostDocument } from '@/types/mongoose/post'; -import { PostRepliesResult } from '@/types/miiverse/post'; import { config } from '@/config-manager'; +import type { PostRepliesResult } from '@/types/miiverse/post'; +import type { HydratedPostDocument } from '@/types/mongoose/post'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; const newPostSchema = z.object({ community_id: z.string().optional(), @@ -220,7 +220,7 @@ async function newPost(request: express.Request, response: express.Response): Pr try { user = await getUserAccountData(request.pid); - } catch (error) { + } catch (ignored) { // TODO - Log this error response.sendStatus(403); return; @@ -429,4 +429,4 @@ async function newPost(request: express.Request, response: express.Response): Pr }).end({ pretty: true, allowEmpty: true })); } -export default router; \ No newline at end of file +export default router; diff --git a/src/services/api/routes/status.ts b/src/services/api/routes/status.ts index d77ec3a..d4a583e 100644 --- a/src/services/api/routes/status.ts +++ b/src/services/api/routes/status.ts @@ -3,11 +3,11 @@ import { getEndpoints } from '@/database'; const router = express.Router(); -router.get('/', function(_request: express.Request, response: express.Response): void { +router.get('/', function (_request: express.Request, response: express.Response): void { response.send('Pong!'); }); -router.get('/database', async function(_request: express.Request, response: express.Response): Promise { +router.get('/database', async function (_request: express.Request, response: express.Response): Promise { const endpoints = await getEndpoints(); if (endpoints && endpoints.length <= 0) { diff --git a/src/services/api/routes/topics.ts b/src/services/api/routes/topics.ts index f559f21..2dd3b8e 100644 --- a/src/services/api/routes/topics.ts +++ b/src/services/api/routes/topics.ts @@ -4,9 +4,9 @@ import xmlbuilder from 'xmlbuilder'; import Cache from '@/cache'; import { Post } from '@/models/post'; import { Community } from '@/models/community'; -import { IPost } from '@/types/mongoose/post'; -import { HydratedCommunityDocument } from '@/types/mongoose/community'; -import { WWPResult, WWPTopic } from '@/types/miiverse/wara-wara-plaza'; +import type { IPost } from '@/types/mongoose/post'; +import type { HydratedCommunityDocument } from '@/types/mongoose/community'; +import type { WWPResult, WWPTopic } from '@/types/miiverse/wara-wara-plaza'; const router = express.Router(); const ONE_HOUR = 60 * 60 * 1000; @@ -23,28 +23,28 @@ router.get('/', async function (request: express.Request, response: express.Resp // * usable and thus break this request. This is // * done as a quick/hacky fix around that // TODO - Re-enable this and filter out the current users posts - //let user: GetUserDataResponse; + // let user: GetUserDataResponse; // - //try { + // try { // user = await getUserAccountData(request.pid); - //} catch (error) { + // } catch (error) { // // TODO - Log this error // response.sendStatus(403); // return; - //} + // } // - //let discovery: HydratedEndpointDocument | null; + // let discovery: HydratedEndpointDocument | null; // - //if (user) { + // if (user) { // discovery = await getEndpoint(user.serverAccessLevel); - //} else { + // } else { // discovery = await getEndpoint('prod'); - //} + // } // - //if (!discovery || !discovery.topics) { + // if (!discovery || !discovery.topics) { // response.sendStatus(404); // return; - //} + // } if (!WARA_WARA_PLAZA_CACHE.valid()) { const communities = await calculateMostPopularCommunities(24, 10); @@ -80,7 +80,7 @@ async function generateTopicsData(communities: HydratedCommunityDocument[]): Pro for (let i = 0; i < communities.length; i++) { const community = communities[i]; - const empathies = await Post.aggregate<{ _id: null; total: number; }>([ + const empathies = await Post.aggregate<{ _id: null; total: number }>([ { $match: { community_id: community.olive_community_id @@ -109,10 +109,10 @@ async function generateTopicsData(communities: HydratedCommunityDocument[]): Pro is_recommended: community.is_recommended ? 1 : 0, name: community.name, people: [], - position: i+1 + position: i + 1 }; - community.title_id.forEach(title_id => { + community.title_id.forEach((title_id) => { // * Just in case if (title_id) { topic.title_ids.push({ title_id }); @@ -219,7 +219,7 @@ async function calculateMostPopularCommunities(hours: number, limit: number): Pr throw new Error('Invalid date'); } - const validCommunities = await Community.aggregate<{ _id: null; communities: string[]; }>([ + const validCommunities = await Community.aggregate<{ _id: null; communities: string[] }>([ { $match: { type: 0, @@ -242,7 +242,7 @@ async function calculateMostPopularCommunities(hours: number, limit: number): Pr throw new Error('No communities found'); } - const popularCommunities = await Post.aggregate<{ _id: null; count: number; }>([ + const popularCommunities = await Post.aggregate<{ _id: null; count: number }>([ { $match: { created_at: { diff --git a/src/services/api/routes/users.ts b/src/services/api/routes/users.ts index 912cc99..b6b22bf 100644 --- a/src/services/api/routes/users.ts +++ b/src/services/api/routes/users.ts @@ -4,7 +4,7 @@ import { getValueFromQueryString } from '@/util'; const router = express.Router(); -router.get('/:pid/notifications', function(request: express.Request, response: express.Response): void { +router.get('/:pid/notifications', function (request: express.Request, response: express.Response): void { const type = getValueFromQueryString(request.query, 'type')[0]; const titleID = getValueFromQueryString(request.query, 'title_id')[0]; const pid = getValueFromQueryString(request.query, 'pid')[0]; diff --git a/src/services/discovery/index.ts b/src/services/discovery/index.ts index 95f3d56..c9af747 100644 --- a/src/services/discovery/index.ts +++ b/src/services/discovery/index.ts @@ -1,7 +1,6 @@ import express from 'express'; import subdomain from 'express-subdomain'; import { LOG_INFO } from '@/logger'; - import discoveryHandlers from '@/services/discovery/routes/discovery'; // Main router for endpointsindex.js @@ -19,4 +18,4 @@ router.use(subdomain('discovery-dev.olv', discovery)); // Setup routes discovery.use('/v1/endpoint', discoveryHandlers); -export default router; \ No newline at end of file +export default router; diff --git a/src/services/discovery/routes/discovery.ts b/src/services/discovery/routes/discovery.ts index 15e4b5a..6590833 100644 --- a/src/services/discovery/routes/discovery.ts +++ b/src/services/discovery/routes/discovery.ts @@ -1,9 +1,9 @@ import express from 'express'; import xmlbuilder from 'xmlbuilder'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; import { getUserAccountData } from '@/util'; import { getEndpoint } from '@/database'; -import { HydratedEndpointDocument } from '@/types/mongoose/endpoint'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { HydratedEndpointDocument } from '@/types/mongoose/endpoint'; const router = express.Router(); @@ -15,7 +15,7 @@ router.get('/', async function (request: express.Request, response: express.Resp try { user = await getUserAccountData(request.pid); - } catch (error) { + } catch (ignored) { // TODO - Log this error response.sendStatus(404); return; @@ -52,7 +52,7 @@ router.get('/', async function (request: express.Request, response: express.Resp } }).end({ pretty: true })); - return ; + return; case 1: message = 'SYSTEM_UPDATE_REQUIRED'; errorCode = 1; diff --git a/src/types/common/config.ts b/src/types/common/config.ts index 29feee8..b5a9487 100644 --- a/src/types/common/config.ts +++ b/src/types/common/config.ts @@ -1,4 +1,4 @@ -import mongoose from 'mongoose'; +import type mongoose from 'mongoose'; export interface Config { http: { @@ -30,4 +30,4 @@ export interface Config { }; }; aes_key: string; -} \ No newline at end of file +} diff --git a/src/types/common/formatted-message.ts b/src/types/common/formatted-message.ts index 2871234..8582bcb 100644 --- a/src/types/common/formatted-message.ts +++ b/src/types/common/formatted-message.ts @@ -21,8 +21,8 @@ export interface FormattedMessage { screen_name: string; topic_tag: { name: string; - title_id: number + title_id: number; }; title_id: string; }; -} \ No newline at end of file +} diff --git a/src/types/common/param-pack.ts b/src/types/common/param-pack.ts index 7bb252b..bf28b25 100644 --- a/src/types/common/param-pack.ts +++ b/src/types/common/param-pack.ts @@ -13,4 +13,4 @@ export interface ParamPack { transferable_id: string; tz_name: string; utc_offset: string; -} \ No newline at end of file +} diff --git a/src/types/common/token.ts b/src/types/common/token.ts index e414ba3..16c0264 100644 --- a/src/types/common/token.ts +++ b/src/types/common/token.ts @@ -5,4 +5,4 @@ export interface Token { access_level: number; title_id: bigint; expire_time: bigint; -} \ No newline at end of file +} diff --git a/src/types/express-subdomain.d.ts b/src/types/express-subdomain.d.ts index b4ae490..85e40df 100644 --- a/src/types/express-subdomain.d.ts +++ b/src/types/express-subdomain.d.ts @@ -13,4 +13,4 @@ declare module 'express-subdomain'{ subdomain: string, fn: Router ): (req: Request, res: Response, next: () => void) => void | typeof fn; -} \ No newline at end of file +} diff --git a/src/types/express.d.ts b/src/types/express.d.ts index 1a214ee..24fb13d 100644 --- a/src/types/express.d.ts +++ b/src/types/express.d.ts @@ -1,10 +1,10 @@ -import { ParamPack } from '@/types/common/param-pack'; +import type { ParamPack } from '@/types/common/param-pack'; declare global { namespace Express { interface Request { pid: number; - paramPack: ParamPack + paramPack: ParamPack; } } -} \ No newline at end of file +} diff --git a/src/types/miiverse/community.ts b/src/types/miiverse/community.ts index 2048f79..ea4554f 100644 --- a/src/types/miiverse/community.ts +++ b/src/types/miiverse/community.ts @@ -1,4 +1,4 @@ -import { PostData } from '@/types/miiverse/post'; +import type { PostData } from '@/types/miiverse/post'; export type CommunityData = { community_id: string; @@ -30,4 +30,4 @@ export type CommunityPostsResult = { posts: { post: PostData; }[]; -}; \ No newline at end of file +}; diff --git a/src/types/miiverse/people.ts b/src/types/miiverse/people.ts index 500689d..81e1e78 100644 --- a/src/types/miiverse/people.ts +++ b/src/types/miiverse/people.ts @@ -1,12 +1,12 @@ -import { PostData } from '@/types/miiverse/post'; -import { SettingsData } from '@/types/miiverse/settings'; +import type { PostData } from '@/types/miiverse/post'; +import type { SettingsData } from '@/types/miiverse/settings'; export type PersonPosts = { person: { posts: { post: PostData; }[]; - } + }; }; export type PeoplePostsResult = { @@ -24,4 +24,4 @@ export type PeopleFollowingResult = { people: { person: SettingsData; }[]; -}; \ No newline at end of file +}; diff --git a/src/types/miiverse/post.ts b/src/types/miiverse/post.ts index 378cb61..6fcb038 100644 --- a/src/types/miiverse/post.ts +++ b/src/types/miiverse/post.ts @@ -50,4 +50,4 @@ export type PostRepliesResult = { posts: { post: PostData; }[]; -}; \ No newline at end of file +}; diff --git a/src/types/miiverse/settings.ts b/src/types/miiverse/settings.ts index ae43819..ff8e3f0 100644 --- a/src/types/miiverse/settings.ts +++ b/src/types/miiverse/settings.ts @@ -1,4 +1,4 @@ export type SettingsData = { pid: number; screen_name: string; -}; \ No newline at end of file +}; diff --git a/src/types/miiverse/wara-wara-plaza.ts b/src/types/miiverse/wara-wara-plaza.ts index 582e9a0..3a10d78 100644 --- a/src/types/miiverse/wara-wara-plaza.ts +++ b/src/types/miiverse/wara-wara-plaza.ts @@ -1,4 +1,4 @@ -import { PersonPosts } from '@/types/miiverse/people'; +import type { PersonPosts } from '@/types/miiverse/people'; export type WWPTopic = { empathy_count: number; @@ -24,4 +24,3 @@ export type WWPResult = { topic: WWPTopic; }[]; }; - diff --git a/src/types/mongoose/community-posts-query.ts b/src/types/mongoose/community-posts-query.ts index eac6a11..65c4a7a 100644 --- a/src/types/mongoose/community-posts-query.ts +++ b/src/types/mongoose/community-posts-query.ts @@ -19,6 +19,6 @@ export interface CommunityPostsQuery { $in: number[]; }; parent?: { - $eq: null + $eq: null; }; -} \ No newline at end of file +} diff --git a/src/types/mongoose/community.ts b/src/types/mongoose/community.ts index bd4b446..2380364 100644 --- a/src/types/mongoose/community.ts +++ b/src/types/mongoose/community.ts @@ -1,5 +1,5 @@ -import { Model, Types, HydratedDocument } from 'mongoose'; -import { CommunityData } from '@/types/miiverse/community'; +import type { Model, Types, HydratedDocument } from 'mongoose'; +import type { CommunityData } from '@/types/miiverse/community'; enum COMMUNITY_TYPE { Main = 0, @@ -37,7 +37,7 @@ export interface ICommunity { is_recommended: number; app_data: string; user_favorites: Types.Array; - permissions: ICommunityPermissions + permissions: ICommunityPermissions; } export interface ICommunityMethods { @@ -48,4 +48,4 @@ export interface ICommunityMethods { export type CommunityModel = Model; -export type HydratedCommunityDocument = HydratedDocument; \ No newline at end of file +export type HydratedCommunityDocument = HydratedDocument; diff --git a/src/types/mongoose/content.ts b/src/types/mongoose/content.ts index 6934632..12a80e8 100644 --- a/src/types/mongoose/content.ts +++ b/src/types/mongoose/content.ts @@ -1,12 +1,12 @@ -import { Model, Types, HydratedDocument } from 'mongoose'; +import type { Model, Types, HydratedDocument } from 'mongoose'; export interface IContent { pid: number; - followed_communities: Types.Array; - followed_users: Types.Array; - following_users: Types.Array; + followed_communities: Types.Array; + followed_users: Types.Array; + following_users: Types.Array; } export type ContentModel = Model; -export type HydratedContentDocument = HydratedDocument; \ No newline at end of file +export type HydratedContentDocument = HydratedDocument; diff --git a/src/types/mongoose/conversation.ts b/src/types/mongoose/conversation.ts index 7f73c7b..2c6d9c2 100644 --- a/src/types/mongoose/conversation.ts +++ b/src/types/mongoose/conversation.ts @@ -1,17 +1,17 @@ -import { Model, Types, HydratedDocument } from 'mongoose'; +import type { Model, Types, HydratedDocument } from 'mongoose'; export type ConversationUser = { pid: number; - official: boolean; - read: boolean; + official: boolean; + read: boolean; }; export interface IConversation { id: string; - created_at: Date; - last_updated: Date; - message_preview: string, - users: Types.Array; + created_at: Date; + last_updated: Date; + message_preview: string; + users: Types.Array; } export interface IConversationMethods { @@ -20,4 +20,4 @@ export interface IConversationMethods { export type ConversationModel = Model; -export type HydratedConversationDocument = HydratedDocument; \ No newline at end of file +export type HydratedConversationDocument = HydratedDocument; diff --git a/src/types/mongoose/endpoint.ts b/src/types/mongoose/endpoint.ts index 281bf93..9738a13 100644 --- a/src/types/mongoose/endpoint.ts +++ b/src/types/mongoose/endpoint.ts @@ -1,16 +1,16 @@ -import { Model, HydratedDocument } from 'mongoose'; +import type { Model, HydratedDocument } from 'mongoose'; export interface IEndpoint { status: number; - server_access_level: string; - topics: boolean; - guest_access: boolean; - host: string; - api_host: string; - portal_host: string; - n3ds_host: string; + server_access_level: string; + topics: boolean; + guest_access: boolean; + host: string; + api_host: string; + portal_host: string; + n3ds_host: string; } export type EndpointModel = Model; -export type HydratedEndpointDocument = HydratedDocument; \ No newline at end of file +export type HydratedEndpointDocument = HydratedDocument; diff --git a/src/types/mongoose/notification.ts b/src/types/mongoose/notification.ts index 7ecf24c..986d55c 100644 --- a/src/types/mongoose/notification.ts +++ b/src/types/mongoose/notification.ts @@ -1,20 +1,20 @@ -import { Model, Types, HydratedDocument } from 'mongoose'; +import type { Model, Types, HydratedDocument } from 'mongoose'; export type NotificationUser = { user: string; - timestamp: number; -} + timestamp: number; +}; export interface INotification { pid: string; - type: string; - link: string; - objectID: string; - users: Types.Array; - read: boolean; - lastUpdated: number; + type: string; + link: string; + objectID: string; + users: Types.Array; + read: boolean; + lastUpdated: number; } export type NotificationModel = Model; -export type HydratedNotificationDocument = HydratedDocument; \ No newline at end of file +export type HydratedNotificationDocument = HydratedDocument; diff --git a/src/types/mongoose/post-to-json-options.ts b/src/types/mongoose/post-to-json-options.ts index dc11f9f..ebf8976 100644 --- a/src/types/mongoose/post-to-json-options.ts +++ b/src/types/mongoose/post-to-json-options.ts @@ -2,4 +2,4 @@ export interface PostToJSONOptions { with_mii: boolean; app_data?: boolean; topic_tag?: boolean; -} \ No newline at end of file +} diff --git a/src/types/mongoose/post.ts b/src/types/mongoose/post.ts index 6e90b78..dffb394 100644 --- a/src/types/mongoose/post.ts +++ b/src/types/mongoose/post.ts @@ -1,7 +1,7 @@ -import { Model, Types, HydratedDocument } from 'mongoose'; -import { HydratedCommunityDocument } from '@/types/mongoose/community'; -import { PostToJSONOptions } from '@/types/mongoose/post-to-json-options'; -import { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/types/miiverse/post'; +import type { Model, Types, HydratedDocument } from 'mongoose'; +import type { HydratedCommunityDocument } from '@/types/mongoose/community'; +import type { PostToJSONOptions } from '@/types/mongoose/post-to-json-options'; +import type { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/types/miiverse/post'; export interface IPost { id: string; @@ -54,4 +54,4 @@ export interface IPostMethods { export type PostModel = Model; -export type HydratedPostDocument = HydratedDocument; \ No newline at end of file +export type HydratedPostDocument = HydratedDocument; diff --git a/src/types/mongoose/report.ts b/src/types/mongoose/report.ts index ce3d870..413633a 100644 --- a/src/types/mongoose/report.ts +++ b/src/types/mongoose/report.ts @@ -1,12 +1,12 @@ -import { Model, HydratedDocument } from 'mongoose'; +import type { Model, HydratedDocument } from 'mongoose'; export interface IReport { pid: string; - post_id: string; - reason: number; - created_at: Date; + post_id: string; + reason: number; + created_at: Date; } export type ReportModel = Model; -export type HydratedReportDocument = HydratedDocument; \ No newline at end of file +export type HydratedReportDocument = HydratedDocument; diff --git a/src/types/mongoose/settings.ts b/src/types/mongoose/settings.ts index 6f92776..290660d 100644 --- a/src/types/mongoose/settings.ts +++ b/src/types/mongoose/settings.ts @@ -1,21 +1,21 @@ -import { Model, HydratedDocument } from 'mongoose'; -import { SettingsData } from '@/types/miiverse/settings'; +import type { Model, HydratedDocument } from 'mongoose'; +import type { SettingsData } from '@/types/miiverse/settings'; export interface ISettings { pid: number; - screen_name: string; - account_status: number; - ban_lift_date: Date; - ban_reason: string; - profile_comment: string; - profile_comment_visibility: boolean; - game_skill: number; - game_skill_visibility: boolean; - birthday_visibility: boolean; - relationship_visibility: boolean; - country_visibility: boolean; - profile_favorite_community_visibility: boolean; - receive_notifications: boolean; + screen_name: string; + account_status: number; + ban_lift_date: Date; + ban_reason: string; + profile_comment: string; + profile_comment_visibility: boolean; + game_skill: number; + game_skill_visibility: boolean; + birthday_visibility: boolean; + relationship_visibility: boolean; + country_visibility: boolean; + profile_favorite_community_visibility: boolean; + receive_notifications: boolean; } export interface ISettingsMethods { @@ -24,4 +24,4 @@ export interface ISettingsMethods { export type SettingsModel = Model; -export type HydratedSettingsDocument = HydratedDocument; \ No newline at end of file +export type HydratedSettingsDocument = HydratedDocument; diff --git a/src/types/mongoose/subcommunity-query.ts b/src/types/mongoose/subcommunity-query.ts index 3ee3824..3dd8f81 100644 --- a/src/types/mongoose/subcommunity-query.ts +++ b/src/types/mongoose/subcommunity-query.ts @@ -6,4 +6,4 @@ export interface SubCommunityQuery { user_favorites?: number; olive_community_id?: string; community_id?: string; -} \ No newline at end of file +} diff --git a/src/types/node-snowflake.d.ts b/src/types/node-snowflake.d.ts index 6404ab0..dfeb2f8 100644 --- a/src/types/node-snowflake.d.ts +++ b/src/types/node-snowflake.d.ts @@ -11,4 +11,4 @@ declare module 'node-snowflake' { init: (config: SnowflakeInitConfig) => void; nextId: (workerId?: number, dataCenterId?: number, sequence?: number) => string; }; -} \ No newline at end of file +} diff --git a/src/types/tga.d.ts b/src/types/tga.d.ts index 16eb4a2..365a31e 100644 --- a/src/types/tga.d.ts +++ b/src/types/tga.d.ts @@ -55,4 +55,4 @@ declare module 'tga' { public pixels: Uint8Array; } -} \ No newline at end of file +} diff --git a/src/util.ts b/src/util.ts index 9ba79c3..79f86ea 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,22 +1,20 @@ import crypto from 'node:crypto'; -import { IncomingHttpHeaders } from 'node:http'; import TGA from 'tga'; import BMP from 'bmp-js'; import pako from 'pako'; import { PNG } from 'pngjs'; import aws from 'aws-sdk'; import { createChannel, createClient, Metadata } from 'nice-grpc'; -import { ParsedQs } from 'qs'; import crc32 from 'crc/crc32'; -import { ParamPack } from '@/types/common/param-pack'; -import { config } from '@/config-manager'; -import { Token } from '@/types/common/token'; - import { FriendsDefinition } from '@pretendonetwork/grpc/friends/friends_service'; -import { FriendRequest } from '@pretendonetwork/grpc/friends/friend_request'; - import { AccountDefinition } from '@pretendonetwork/grpc/account/account_service'; -import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import { config } from '@/config-manager'; +import type { FriendRequest } from '@pretendonetwork/grpc/friends/friend_request'; +import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc'; +import type { ParsedQs } from 'qs'; +import type { IncomingHttpHeaders } from 'node:http'; +import type { ParamPack } from '@/types/common/param-pack'; +import type { Token } from '@/types/common/token'; // * nice-grpc doesn't export ChannelImplementation so this can't be typed const gRPCFriendsChannel = createChannel(`${config.grpc.friends.ip}:${config.grpc.friends.port}`); @@ -224,4 +222,4 @@ export function getValueFromHeaders(headers: IncomingHttpHeaders, key: string): } return value; -} \ No newline at end of file +} diff --git a/test/test.ts b/test/test.ts index a346075..e407514 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,6 +1,5 @@ import crypto from 'node:crypto'; import newman from 'newman'; -import { Collection, CollectionDefinition } from 'postman-collection'; import qs from 'qs'; import axios from 'axios'; import { create as parseXML } from 'xmlbuilder2'; @@ -8,9 +7,9 @@ import { table } from 'table'; import ora from 'ora'; import dotenv from 'dotenv'; import colors from 'colors'; - import communitiesCollection from '../postman/collections/Communities.json'; import peopleCollection from '../postman/collections/People.json'; +import type { Collection, CollectionDefinition } from 'postman-collection'; const PeopleCollection: CollectionDefinition = peopleCollection as CollectionDefinition; const CommunitiesCollection: CollectionDefinition = communitiesCollection as CollectionDefinition; @@ -24,7 +23,7 @@ interface TestResult { url: string; query: string; assertion: string; - error?: string + error?: string; } const USERNAME = process.env.PN_MIIVERSE_API_TESTING_USERNAME?.trim() || ''; @@ -102,7 +101,7 @@ async function apiGetRequest(url: string, headers = {}): Promise> { const response = await axios.post(url, body, { headers: DEFAULT_HEADERS, - validateStatus: () => true, + validateStatus: () => true }); const data: Record = parseXML(response.data).end({ format: 'object' }); @@ -129,7 +128,7 @@ async function getAccessToken(username: string, passwordHash: string): Promise { const response = await apiGetRequest(SERVICE_TOKEN_URL, { 'X-Nintendo-Title-ID': '0005001010040100', - Authorization: `Bearer ${accessToken}` + 'Authorization': `Bearer ${accessToken}` }); return response.service_token.token; @@ -153,7 +152,7 @@ function runNewmanTest(collection: string | Collection | CollectionDefinition, v reporters: ['json'], envVar: Object.entries(variables).map(entry => ({ key: entry[0], value: entry[1] })), globals: variables, - globalVar: Object.entries(variables).map(entry => ({ key: entry[0], value: entry[1] })), + globalVar: Object.entries(variables).map(entry => ({ key: entry[0], value: entry[1] })) }, (error, summary) => { if (error) { reject(error); @@ -167,13 +166,13 @@ function runNewmanTest(collection: string | Collection | CollectionDefinition, v function communitiesRoutesTest(serviceToken: string): Promise { // TODO - Make this more dynamic? return runNewmanTest(CommunitiesCollection, { - DOMAIN: 'api.olv.pretendo.cc', - ServiceToken: serviceToken, + 'DOMAIN': 'api.olv.pretendo.cc', + 'ServiceToken': serviceToken, // TODO - Change these names. Should not be game-specific - PP_Splatoon: 'XHRpdGxlX2lkXDE0MDczNzUxNTM1MjI5NDRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc', - PP_MarioVsDK: 'XHRpdGxlX2lkXDE0MDczNzUxNTMzMzcwODhcYWNjZXNzX2tleVw2OTI0NzQ1MTBccGxhdGZvcm1faWRcMVxyZWdpb25faWRcMlxsYW5ndWFnZV9pZFwxXGNvdW50cnlfaWRcNDlcYXJlYV9pZFwwXG5ldHdvcmtfcmVzdHJpY3Rpb25cMFxmcmllbmRfcmVzdHJpY3Rpb25cMFxyYXRpbmdfcmVzdHJpY3Rpb25cMTdccmF0aW5nX29yZ2FuaXphdGlvblwxXHRyYW5zZmVyYWJsZV9pZFw3NjA4MjAyOTE2MDc1ODg0NDI1XHR6X25hbWVcUGFjaWZpYy9NaWR3YXlcdXRjX29mZnNldFwtMzk2MDBc', - PP_Bad_TID: 'XHRpdGxlX2lkXDEyMzRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc', - PP_ACPlaza: 'XHRpdGxlX2lkXDE0MDczNzUxNTMzMjE0NzJcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc', + 'PP_Splatoon': 'XHRpdGxlX2lkXDE0MDczNzUxNTM1MjI5NDRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc', + 'PP_MarioVsDK': 'XHRpdGxlX2lkXDE0MDczNzUxNTMzMzcwODhcYWNjZXNzX2tleVw2OTI0NzQ1MTBccGxhdGZvcm1faWRcMVxyZWdpb25faWRcMlxsYW5ndWFnZV9pZFwxXGNvdW50cnlfaWRcNDlcYXJlYV9pZFwwXG5ldHdvcmtfcmVzdHJpY3Rpb25cMFxmcmllbmRfcmVzdHJpY3Rpb25cMFxyYXRpbmdfcmVzdHJpY3Rpb25cMTdccmF0aW5nX29yZ2FuaXphdGlvblwxXHRyYW5zZmVyYWJsZV9pZFw3NjA4MjAyOTE2MDc1ODg0NDI1XHR6X25hbWVcUGFjaWZpYy9NaWR3YXlcdXRjX29mZnNldFwtMzk2MDBc', + 'PP_Bad_TID': 'XHRpdGxlX2lkXDEyMzRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc', + 'PP_ACPlaza': 'XHRpdGxlX2lkXDE0MDczNzUxNTMzMjE0NzJcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc', 'PP_Bad Format': 'XHR' }); } @@ -184,7 +183,7 @@ function peopleRoutesTest(serviceToken: string): Promise { DOMAIN: 'api.olv.pretendo.cc', ServiceToken: serviceToken, // TODO - Change this name. Should not be game-specific - PP_Splatoon: 'XHRpdGxlX2lkXDE0MDczNzUxNTM1MjI5NDRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc', + PP_Splatoon: 'XHRpdGxlX2lkXDE0MDczNzUxNTM1MjI5NDRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc' }); } @@ -275,7 +274,7 @@ function createTestResults(summary: newman.NewmanRunSummary): TestResult[] { collection: summary.collection.name, name: execution.item.name, url: `${request.url.protocol}://${request.url.host?.join('.')}/${request.url.path?.join('/')}`, - query: qs.stringify(request.url.query.all().reduce((object: Record, item: { disabled?: boolean; key: string | null; value: string | null; }) => { + query: qs.stringify(request.url.query.all().reduce((object: Record, item: { disabled?: boolean; key: string | null; value: string | null }) => { if (!item.disabled && item.key && item.value) { object[item.key] = item.value; } @@ -293,4 +292,4 @@ function createTestResults(summary: newman.NewmanRunSummary): TestResult[] { } return results; -} \ No newline at end of file +}