mirror of
https://github.com/PretendoNetwork/miiverse-api.git
synced 2026-04-26 08:37:20 -05:00
style: lint ALL the files
This commit is contained in:
parent
47d799b339
commit
5998e511ea
|
|
@ -24,4 +24,4 @@ export default class Cache<T> {
|
||||||
get(): T | undefined {
|
get(): T | undefined {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import mongoose from 'mongoose';
|
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import { LOG_INFO, LOG_WARN, LOG_ERROR } from '@/logger';
|
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();
|
dotenv.config();
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ if (!config.cdn_url) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new URL(config.cdn_url);
|
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');
|
LOG_ERROR('Invalid CDN URL, URL must be a valid URL with a protocol (http/https) and domain');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
@ -138,4 +138,4 @@ if (!config.grpc.account.api_key) {
|
||||||
if (!config.aes_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');
|
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);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@ import { Endpoint } from '@/models/endpoint';
|
||||||
import { Post } from '@/models/post';
|
import { Post } from '@/models/post';
|
||||||
import { Settings } from '@/models/settings';
|
import { Settings } from '@/models/settings';
|
||||||
import { config } from '@/config-manager';
|
import { config } from '@/config-manager';
|
||||||
import { HydratedCommunityDocument } from '@/types/mongoose/community';
|
import type { HydratedConversationDocument } from '@/types/mongoose/conversation';
|
||||||
import { HydratedPostDocument, IPost } from '@/types/mongoose/post';
|
import type { HydratedContentDocument } from '@/types/mongoose/content';
|
||||||
import { HydratedEndpointDocument } from '@/types/mongoose/endpoint';
|
import type { HydratedSettingsDocument } from '@/types/mongoose/settings';
|
||||||
import { HydratedSettingsDocument } from '@/types/mongoose/settings';
|
import type { HydratedEndpointDocument } from '@/types/mongoose/endpoint';
|
||||||
import { HydratedContentDocument } from '@/types/mongoose/content';
|
import type { HydratedPostDocument, IPost } from '@/types/mongoose/post';
|
||||||
import { HydratedConversationDocument } from '@/types/mongoose/conversation';
|
import type { HydratedCommunityDocument } from '@/types/mongoose/community';
|
||||||
|
|
||||||
const { mongoose: mongooseConfig } = config;
|
const { mongoose: mongooseConfig } = config;
|
||||||
|
|
||||||
|
|
@ -176,4 +176,4 @@ export async function getFriendMessages(pid: string, search_key: string[], limit
|
||||||
parent: null,
|
parent: null,
|
||||||
removed: false
|
removed: false
|
||||||
}).sort({ created_at: 1 }).limit(limit);
|
}).sort({ created_at: 1 }).limit(limit);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,4 @@ export function LOG_INFO(input: string): void {
|
||||||
streams.info.write(`${input}\n`);
|
streams.info.write(`${input}\n`);
|
||||||
|
|
||||||
console.log(`${input}`.cyan.bold);
|
console.log(`${input}`.cyan.bold);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import express from 'express';
|
|
||||||
import xmlbuilder from 'xmlbuilder';
|
import xmlbuilder from 'xmlbuilder';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { z } from 'zod';
|
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 { 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({
|
const ParamPackSchema = z.object({
|
||||||
title_id: z.string(),
|
title_id: z.string(),
|
||||||
|
|
@ -112,7 +112,6 @@ async function auth(request: express.Request, response: express.Response, next:
|
||||||
} else {
|
} else {
|
||||||
return badAuth(response, 7, 'PNID_PERM_BAN');
|
return badAuth(response, 7, 'PNID_PERM_BAN');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
import express from 'express';
|
|
||||||
import xmlbuilder from 'xmlbuilder';
|
import xmlbuilder from 'xmlbuilder';
|
||||||
import { getValueFromHeaders } from '@/util';
|
import { getValueFromHeaders } from '@/util';
|
||||||
|
import type express from 'express';
|
||||||
|
|
||||||
const VALID_CLIENT_ID_SECRET_PAIRS: { [key: string]: string } = {
|
const VALID_CLIENT_ID_SECRET_PAIRS: { [key: string]: string } = {
|
||||||
// * 'Key' is the client ID, 'Value' is the client secret
|
// * 'Key' is the client ID, 'Value' is the client secret
|
||||||
'a2efa818a34fa16b8afbc8a74eba3eda': 'c91cdb5658bd4954ade78533a339cf9a', // * Possibly WiiU exclusive?
|
a2efa818a34fa16b8afbc8a74eba3eda: 'c91cdb5658bd4954ade78533a339cf9a', // * Possibly WiiU exclusive?
|
||||||
'daf6227853bcbdce3d75baee8332b': '3eff548eac636e2bf45bb7b375e7b6b0', // * Possibly 3DS exclusive?
|
daf6227853bcbdce3d75baee8332b: '3eff548eac636e2bf45bb7b375e7b6b0', // * Possibly 3DS exclusive?
|
||||||
'ea25c66c26b403376b4c5ed94ab9cdea': 'd137be62cb6a2b831cad8c013b92fb55', // * Possibly 3DS exclusive?
|
ea25c66c26b403376b4c5ed94ab9cdea: 'd137be62cb6a2b831cad8c013b92fb55' // * Possibly 3DS exclusive?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function nintendoClientHeaderCheck(request: express.Request, response: express.Response, next: express.NextFunction): void {
|
function nintendoClientHeaderCheck(request: express.Request, response: express.Response, next: express.NextFunction): void {
|
||||||
response.type('text/xml');
|
response.type('text/xml');
|
||||||
response.set('Server', 'Nintendo 3DS (http)');
|
response.set('Server', 'Nintendo 3DS (http)');
|
||||||
|
|
@ -41,4 +40,4 @@ function nintendoClientHeaderCheck(request: express.Request, response: express.R
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default nintendoClientHeaderCheck;
|
export default nintendoClientHeaderCheck;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from 'mongoose';
|
||||||
import { CommunityData } from '@/types/miiverse/community';
|
import type { CommunityData } from '@/types/miiverse/community';
|
||||||
import { ICommunity, ICommunityMethods, CommunityModel, ICommunityPermissions, HydratedCommunityDocument } from '@/types/mongoose/community';
|
import type { ICommunity, ICommunityMethods, CommunityModel, ICommunityPermissions, HydratedCommunityDocument } from '@/types/mongoose/community';
|
||||||
|
|
||||||
const PermissionsSchema = new Schema<ICommunityPermissions>({
|
const PermissionsSchema = new Schema<ICommunityPermissions>({
|
||||||
open: {
|
open: {
|
||||||
|
|
@ -18,7 +18,7 @@ const PermissionsSchema = new Schema<ICommunityPermissions>({
|
||||||
minimum_new_community_access_level: {
|
minimum_new_community_access_level: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const CommunitySchema = new Schema<ICommunity, CommunityModel, ICommunityMethods>({
|
const CommunitySchema = new Schema<ICommunity, CommunityModel, ICommunityMethods>({
|
||||||
|
|
@ -54,7 +54,7 @@ const CommunitySchema = new Schema<ICommunity, CommunityModel, ICommunityMethods
|
||||||
owner: Number,
|
owner: Number,
|
||||||
created_at: {
|
created_at: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: new Date(),
|
default: new Date()
|
||||||
},
|
},
|
||||||
empathy_count: {
|
empathy_count: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
@ -120,4 +120,4 @@ CommunitySchema.method<HydratedCommunityDocument>('json', function json(): Commu
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Community = model<ICommunity, CommunityModel>('Community', CommunitySchema);
|
export const Community = model<ICommunity, CommunityModel>('Community', CommunitySchema);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from 'mongoose';
|
||||||
import { IContent, ContentModel } from '@/types/mongoose/content';
|
import type { IContent, ContentModel } from '@/types/mongoose/content';
|
||||||
|
|
||||||
const ContentSchema = new Schema<IContent, ContentModel>({
|
const ContentSchema = new Schema<IContent, ContentModel>({
|
||||||
pid: Number,
|
pid: Number,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from 'mongoose';
|
||||||
import { Snowflake } from 'node-snowflake';
|
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<IConversation, ConversationModel, IConversationMethods>({
|
const ConversationSchema = new Schema<IConversation, ConversationModel, IConversationMethods>({
|
||||||
id: {
|
id: {
|
||||||
|
|
@ -9,11 +9,11 @@ const ConversationSchema = new Schema<IConversation, ConversationModel, IConvers
|
||||||
},
|
},
|
||||||
created_at: {
|
created_at: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: new Date(),
|
default: new Date()
|
||||||
},
|
},
|
||||||
last_updated: {
|
last_updated: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: new Date(),
|
default: new Date()
|
||||||
},
|
},
|
||||||
message_preview: {
|
message_preview: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
@ -42,4 +42,4 @@ ConversationSchema.method<HydratedConversationDocument>('newMessage', async func
|
||||||
await this.save();
|
await this.save();
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Conversation = model<IConversation, ConversationModel>('Conversation', ConversationSchema);
|
export const Conversation = model<IConversation, ConversationModel>('Conversation', ConversationSchema);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from 'mongoose';
|
||||||
import { IEndpoint, EndpointModel } from '@/types/mongoose/endpoint';
|
import type { IEndpoint, EndpointModel } from '@/types/mongoose/endpoint';
|
||||||
|
|
||||||
const endpointSchema = new Schema<IEndpoint, EndpointModel>({
|
const endpointSchema = new Schema<IEndpoint, EndpointModel>({
|
||||||
status: Number,
|
status: Number,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from 'mongoose';
|
||||||
import { INotification, NotificationModel } from '@/types/mongoose/notification';
|
import type { INotification, NotificationModel } from '@/types/mongoose/notification';
|
||||||
|
|
||||||
const NotificationSchema = new Schema<INotification, NotificationModel>({
|
const NotificationSchema = new Schema<INotification, NotificationModel>({
|
||||||
pid: String,
|
pid: String,
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ import crypto from 'node:crypto';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from 'mongoose';
|
||||||
import { INVALID_POST_BODY_REGEX } from '@/util';
|
import { INVALID_POST_BODY_REGEX } from '@/util';
|
||||||
import { HydratedPostDocument, IPost, IPostMethods, PostModel } from '@/types/mongoose/post';
|
import type { HydratedPostDocument, IPost, IPostMethods, PostModel } from '@/types/mongoose/post';
|
||||||
import { HydratedCommunityDocument } from '@/types/mongoose/community';
|
import type { HydratedCommunityDocument } from '@/types/mongoose/community';
|
||||||
import { PostToJSONOptions } from '@/types/mongoose/post-to-json-options';
|
import type { PostToJSONOptions } from '@/types/mongoose/post-to-json-options';
|
||||||
import { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/types/miiverse/post';
|
import type { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/types/miiverse/post';
|
||||||
|
|
||||||
const PostSchema = new Schema<IPost, PostModel, IPostMethods>({
|
const PostSchema = new Schema<IPost, PostModel, IPostMethods>({
|
||||||
id: String,
|
id: String,
|
||||||
|
|
@ -88,7 +88,6 @@ const PostSchema = new Schema<IPost, PostModel, IPostMethods>({
|
||||||
id: false // * Disables the .id() getter used by Mongoose in TypeScript. Needed to have our own .id field
|
id: false // * Disables the .id() getter used by Mongoose in TypeScript. Needed to have our own .id field
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
PostSchema.method<HydratedPostDocument>('del', async function del(reason: string) {
|
PostSchema.method<HydratedPostDocument>('del', async function del(reason: string) {
|
||||||
this.removed = true;
|
this.removed = true;
|
||||||
this.removed_reason = reason;
|
this.removed_reason = reason;
|
||||||
|
|
@ -178,7 +177,7 @@ PostSchema.method<HydratedPostDocument>('json', function json(options: PostToJSO
|
||||||
screen_name: this.screen_name,
|
screen_name: this.screen_name,
|
||||||
screenshot: this.formatScreenshot(),
|
screenshot: this.formatScreenshot(),
|
||||||
topic_tag: undefined, // * Conditionally set later
|
topic_tag: undefined, // * Conditionally set later
|
||||||
title_id: this.title_id,
|
title_id: this.title_id
|
||||||
};
|
};
|
||||||
|
|
||||||
if (options.app_data) {
|
if (options.app_data) {
|
||||||
|
|
@ -206,7 +205,7 @@ PostSchema.method<HydratedPostDocument>('json', function json(options: PostToJSO
|
||||||
return post;
|
return post;
|
||||||
});
|
});
|
||||||
|
|
||||||
PostSchema.pre('save', async function(next) {
|
PostSchema.pre('save', async function (next) {
|
||||||
if (!this.id) {
|
if (!this.id) {
|
||||||
await this.generatePostUID(21);
|
await this.generatePostUID(21);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from 'mongoose';
|
||||||
import { IReport, ReportModel } from '@/types/mongoose/report';
|
import type { IReport, ReportModel } from '@/types/mongoose/report';
|
||||||
|
|
||||||
const ReportSchema = new Schema<IReport, ReportModel>({
|
const ReportSchema = new Schema<IReport, ReportModel>({
|
||||||
pid: String,
|
pid: String,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from 'mongoose';
|
||||||
import { SettingsData } from '@/types/miiverse/settings';
|
import type { SettingsData } from '@/types/miiverse/settings';
|
||||||
import { HydratedSettingsDocument, ISettings, ISettingsMethods, SettingsModel } from '@/types/mongoose/settings';
|
import type { HydratedSettingsDocument, ISettings, ISettingsMethods, SettingsModel } from '@/types/mongoose/settings';
|
||||||
|
|
||||||
const SettingsSchema = new Schema<ISettings, SettingsModel, ISettingsMethods>({
|
const SettingsSchema = new Schema<ISettings, SettingsModel, ISettingsMethods>({
|
||||||
pid: Number,
|
pid: Number,
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,18 @@
|
||||||
process.title = 'Pretendo - Miiverse';
|
|
||||||
process.on('SIGTERM', () => {
|
|
||||||
process.exit(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import morgan from 'morgan';
|
import morgan from 'morgan';
|
||||||
import xmlbuilder from 'xmlbuilder';
|
import xmlbuilder from 'xmlbuilder';
|
||||||
import { connect as connectDatabase } from '@/database';
|
import { connect as connectDatabase } from '@/database';
|
||||||
import { LOG_INFO, LOG_SUCCESS } from '@/logger';
|
import { LOG_INFO, LOG_SUCCESS } from '@/logger';
|
||||||
import auth from '@/middleware/auth';
|
import auth from '@/middleware/auth';
|
||||||
|
|
||||||
import discovery from '@/services/discovery';
|
import discovery from '@/services/discovery';
|
||||||
import api from '@/services/api';
|
import api from '@/services/api';
|
||||||
|
|
||||||
import { config } from '@/config-manager';
|
import { config } from '@/config-manager';
|
||||||
|
|
||||||
|
process.title = 'Pretendo - Miiverse';
|
||||||
|
process.on('SIGTERM', () => {
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
|
||||||
const { http: { port } } = config;
|
const { http: { port } } = config;
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import subdomain from 'express-subdomain';
|
import subdomain from 'express-subdomain';
|
||||||
import { LOG_INFO } from '@/logger';
|
import { LOG_INFO } from '@/logger';
|
||||||
|
|
||||||
import postsHandlers from '@/services/api/routes/posts';
|
import postsHandlers from '@/services/api/routes/posts';
|
||||||
import friendMessagesHandlers from '@/services/api/routes/friend_messages';
|
import friendMessagesHandlers from '@/services/api/routes/friend_messages';
|
||||||
import communitiesHandlers from '@/services/api/routes/communities';
|
import communitiesHandlers from '@/services/api/routes/communities';
|
||||||
|
|
@ -32,4 +31,4 @@ api.use('/v1/topics/', topicsHandlers);
|
||||||
api.use('/v1/users/', usersHandlers);
|
api.use('/v1/users/', usersHandlers);
|
||||||
api.use('/v1/status/', statusHandlers);
|
api.use('/v1/status/', statusHandlers);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,23 @@ import express from 'express';
|
||||||
import xmlbuilder from 'xmlbuilder';
|
import xmlbuilder from 'xmlbuilder';
|
||||||
import multer from 'multer';
|
import multer from 'multer';
|
||||||
import { z } from 'zod';
|
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 {
|
import {
|
||||||
getMostPopularCommunities,
|
getMostPopularCommunities,
|
||||||
getNewCommunities,
|
getNewCommunities,
|
||||||
getCommunityByTitleID,
|
getCommunityByTitleID,
|
||||||
getUserContent,
|
getUserContent
|
||||||
} from '@/database';
|
} from '@/database';
|
||||||
import { getValueFromQueryString, getUserAccountData } from '@/util';
|
import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
||||||
import { LOG_WARN } from '@/logger';
|
import type { HydratedCommunityDocument } from '@/types/mongoose/community';
|
||||||
import { Community } from '@/models/community';
|
import type { SubCommunityQuery } from '@/types/mongoose/subcommunity-query';
|
||||||
import { Post } from '@/models/post';
|
import type { CommunityPostsQuery } from '@/types/mongoose/community-posts-query';
|
||||||
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
import type { HydratedPostDocument, IPost } from '@/types/mongoose/post';
|
||||||
import { HydratedCommunityDocument } from '@/types/mongoose/community';
|
import type { ParamPack } from '@/types/common/param-pack';
|
||||||
import { SubCommunityQuery } from '@/types/mongoose/subcommunity-query';
|
import type { CommunitiesResult, CommunityPostsResult } from '@/types/miiverse/community';
|
||||||
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';
|
|
||||||
|
|
||||||
const createNewCommunitySchema = z.object({
|
const createNewCommunitySchema = z.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
|
|
@ -46,7 +46,6 @@ function respondCommunityNotFound(response: express.Response): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function commonGetSubCommunity(paramPack: ParamPack, communityID: string | undefined): Promise<HydratedCommunityDocument | null> {
|
async function commonGetSubCommunity(paramPack: ParamPack, communityID: string | undefined): Promise<HydratedCommunityDocument | null> {
|
||||||
|
|
||||||
const parentCommunity = await getCommunityByTitleID(paramPack.title_id);
|
const parentCommunity = await getCommunityByTitleID(paramPack.title_id);
|
||||||
|
|
||||||
if (!parentCommunity) {
|
if (!parentCommunity) {
|
||||||
|
|
@ -191,7 +190,7 @@ router.get('/:communityID/posts', async function (request: express.Request, resp
|
||||||
query.is_spoiler = 0;
|
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') {
|
if (postType === 'memo') {
|
||||||
query.painting = { $ne: null };
|
query.painting = { $ne: null };
|
||||||
}
|
}
|
||||||
|
|
@ -272,8 +271,8 @@ router.post('/', multer().none(), async function (request: express.Request, resp
|
||||||
let pnid: GetUserDataResponse;
|
let pnid: GetUserDataResponse;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
pnid = await getUserAccountData(request.pid);
|
pnid = await getUserAccountData(request.pid);
|
||||||
} catch (error) {
|
} catch (ignored) {
|
||||||
// TODO - Log this error
|
// TODO - Log this error
|
||||||
response.sendStatus(403);
|
response.sendStatus(403);
|
||||||
return;
|
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<void> {
|
router.post('/:community_id', multer().none(), async function (request: express.Request, response: express.Response): Promise<void> {
|
||||||
response.type('application/xml');
|
response.type('application/xml');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { Snowflake } from 'node-snowflake';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import xmlbuilder from 'xmlbuilder';
|
import xmlbuilder from 'xmlbuilder';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
|
||||||
import {
|
import {
|
||||||
getUserFriendPIDs,
|
getUserFriendPIDs,
|
||||||
getUserAccountData,
|
getUserAccountData,
|
||||||
|
|
@ -17,8 +16,9 @@ import { getConversationByUsers, getUserSettings, getFriendMessages } from '@/da
|
||||||
import { LOG_WARN } from '@/logger';
|
import { LOG_WARN } from '@/logger';
|
||||||
import { Post } from '@/models/post';
|
import { Post } from '@/models/post';
|
||||||
import { Conversation } from '@/models/conversation';
|
import { Conversation } from '@/models/conversation';
|
||||||
import { FormattedMessage } from '@/types/common/formatted-message';
|
|
||||||
import { config } from '@/config-manager';
|
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({
|
const sendMessageSchema = z.object({
|
||||||
body: z.string().optional(),
|
body: z.string().optional(),
|
||||||
|
|
@ -28,7 +28,7 @@ const sendMessageSchema = z.object({
|
||||||
feeling_id: z.string(),
|
feeling_id: z.string(),
|
||||||
is_autopost: z.string(),
|
is_autopost: z.string(),
|
||||||
number: z.string(),
|
number: z.string(),
|
||||||
message_to_pid: z.string().transform(Number),
|
message_to_pid: z.string().transform(Number)
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
@ -62,7 +62,7 @@ router.post('/', upload.none(), async function (request: express.Request, respon
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sender = await getUserAccountData(request.pid);
|
sender = await getUserAccountData(request.pid);
|
||||||
} catch (error) {
|
} catch (ignored) {
|
||||||
LOG_WARN('[Messages] Cannot find sender');
|
LOG_WARN('[Messages] Cannot find sender');
|
||||||
response.sendStatus(422);
|
response.sendStatus(422);
|
||||||
return;
|
return;
|
||||||
|
|
@ -79,7 +79,7 @@ router.post('/', upload.none(), async function (request: express.Request, respon
|
||||||
|
|
||||||
try {
|
try {
|
||||||
recipient = await getUserAccountData(recipientPID);
|
recipient = await getUserAccountData(recipientPID);
|
||||||
} catch (error) {
|
} catch (ignored) {
|
||||||
// TODO - Log this error
|
// TODO - Log this error
|
||||||
LOG_WARN('[Messages] Cannot find recipient');
|
LOG_WARN('[Messages] Cannot find recipient');
|
||||||
response.type('application/xml');
|
response.type('application/xml');
|
||||||
|
|
@ -121,7 +121,7 @@ router.post('/', upload.none(), async function (request: express.Request, respon
|
||||||
pid: recipient.pid,
|
pid: recipient.pid,
|
||||||
official: (recipient.accessLevel === 2 || recipient.accessLevel === 3),
|
official: (recipient.accessLevel === 2 || recipient.accessLevel === 3),
|
||||||
read: false
|
read: false
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -330,4 +330,4 @@ router.post('/:post_id/empathies', upload.none(), async function (_request: expr
|
||||||
*/
|
*/
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import moment from 'moment';
|
||||||
import { getUserContent, getFollowedUsers } from '@/database';
|
import { getUserContent, getFollowedUsers } from '@/database';
|
||||||
import { getValueFromQueryString, getUserFriendPIDs } from '@/util';
|
import { getValueFromQueryString, getUserFriendPIDs } from '@/util';
|
||||||
import { Post } from '@/models/post';
|
import { Post } from '@/models/post';
|
||||||
import { CommunityPostsQuery } from '@/types/mongoose/community-posts-query';
|
import type { CommunityPostsQuery } from '@/types/mongoose/community-posts-query';
|
||||||
import { HydratedPostDocument, IPost } from '@/types/mongoose/post';
|
import type { HydratedPostDocument, IPost } from '@/types/mongoose/post';
|
||||||
import { PeopleFollowingResult, PeoplePostsResult } from '@/types/miiverse/people';
|
import type { PeopleFollowingResult, PeoplePostsResult } from '@/types/miiverse/people';
|
||||||
|
|
||||||
const router = express.Router();
|
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));
|
posts = unhydratedPosts.map((post: IPost) => Post.hydrate(post));
|
||||||
} else if (request.query.is_hot === '1') {
|
} 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 {
|
} 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 = {
|
const result: PeoplePostsResult = {
|
||||||
|
|
@ -148,4 +148,4 @@ router.get('/:pid/following', async function (request: express.Request, response
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import express from 'express';
|
||||||
import multer from 'multer';
|
import multer from 'multer';
|
||||||
import xmlbuilder from 'xmlbuilder';
|
import xmlbuilder from 'xmlbuilder';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
|
||||||
import {
|
import {
|
||||||
getUserAccountData,
|
getUserAccountData,
|
||||||
processPainting,
|
processPainting,
|
||||||
|
|
@ -22,9 +21,10 @@ import {
|
||||||
import { LOG_WARN } from '@/logger';
|
import { LOG_WARN } from '@/logger';
|
||||||
import { Post } from '@/models/post';
|
import { Post } from '@/models/post';
|
||||||
import { Community } from '@/models/community';
|
import { Community } from '@/models/community';
|
||||||
import { HydratedPostDocument } from '@/types/mongoose/post';
|
|
||||||
import { PostRepliesResult } from '@/types/miiverse/post';
|
|
||||||
import { config } from '@/config-manager';
|
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({
|
const newPostSchema = z.object({
|
||||||
community_id: z.string().optional(),
|
community_id: z.string().optional(),
|
||||||
|
|
@ -220,7 +220,7 @@ async function newPost(request: express.Request, response: express.Response): Pr
|
||||||
|
|
||||||
try {
|
try {
|
||||||
user = await getUserAccountData(request.pid);
|
user = await getUserAccountData(request.pid);
|
||||||
} catch (error) {
|
} catch (ignored) {
|
||||||
// TODO - Log this error
|
// TODO - Log this error
|
||||||
response.sendStatus(403);
|
response.sendStatus(403);
|
||||||
return;
|
return;
|
||||||
|
|
@ -429,4 +429,4 @@ async function newPost(request: express.Request, response: express.Response): Pr
|
||||||
}).end({ pretty: true, allowEmpty: true }));
|
}).end({ pretty: true, allowEmpty: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ import { getEndpoints } from '@/database';
|
||||||
|
|
||||||
const router = express.Router();
|
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!');
|
response.send('Pong!');
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/database', async function(_request: express.Request, response: express.Response): Promise<void> {
|
router.get('/database', async function (_request: express.Request, response: express.Response): Promise<void> {
|
||||||
const endpoints = await getEndpoints();
|
const endpoints = await getEndpoints();
|
||||||
|
|
||||||
if (endpoints && endpoints.length <= 0) {
|
if (endpoints && endpoints.length <= 0) {
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import xmlbuilder from 'xmlbuilder';
|
||||||
import Cache from '@/cache';
|
import Cache from '@/cache';
|
||||||
import { Post } from '@/models/post';
|
import { Post } from '@/models/post';
|
||||||
import { Community } from '@/models/community';
|
import { Community } from '@/models/community';
|
||||||
import { IPost } from '@/types/mongoose/post';
|
import type { IPost } from '@/types/mongoose/post';
|
||||||
import { HydratedCommunityDocument } from '@/types/mongoose/community';
|
import type { HydratedCommunityDocument } from '@/types/mongoose/community';
|
||||||
import { WWPResult, WWPTopic } from '@/types/miiverse/wara-wara-plaza';
|
import type { WWPResult, WWPTopic } from '@/types/miiverse/wara-wara-plaza';
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const ONE_HOUR = 60 * 60 * 1000;
|
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
|
// * usable and thus break this request. This is
|
||||||
// * done as a quick/hacky fix around that
|
// * done as a quick/hacky fix around that
|
||||||
// TODO - Re-enable this and filter out the current users posts
|
// TODO - Re-enable this and filter out the current users posts
|
||||||
//let user: GetUserDataResponse;
|
// let user: GetUserDataResponse;
|
||||||
//
|
//
|
||||||
//try {
|
// try {
|
||||||
// user = await getUserAccountData(request.pid);
|
// user = await getUserAccountData(request.pid);
|
||||||
//} catch (error) {
|
// } catch (error) {
|
||||||
// // TODO - Log this error
|
// // TODO - Log this error
|
||||||
// response.sendStatus(403);
|
// response.sendStatus(403);
|
||||||
// return;
|
// return;
|
||||||
//}
|
// }
|
||||||
//
|
//
|
||||||
//let discovery: HydratedEndpointDocument | null;
|
// let discovery: HydratedEndpointDocument | null;
|
||||||
//
|
//
|
||||||
//if (user) {
|
// if (user) {
|
||||||
// discovery = await getEndpoint(user.serverAccessLevel);
|
// discovery = await getEndpoint(user.serverAccessLevel);
|
||||||
//} else {
|
// } else {
|
||||||
// discovery = await getEndpoint('prod');
|
// discovery = await getEndpoint('prod');
|
||||||
//}
|
// }
|
||||||
//
|
//
|
||||||
//if (!discovery || !discovery.topics) {
|
// if (!discovery || !discovery.topics) {
|
||||||
// response.sendStatus(404);
|
// response.sendStatus(404);
|
||||||
// return;
|
// return;
|
||||||
//}
|
// }
|
||||||
|
|
||||||
if (!WARA_WARA_PLAZA_CACHE.valid()) {
|
if (!WARA_WARA_PLAZA_CACHE.valid()) {
|
||||||
const communities = await calculateMostPopularCommunities(24, 10);
|
const communities = await calculateMostPopularCommunities(24, 10);
|
||||||
|
|
@ -80,7 +80,7 @@ async function generateTopicsData(communities: HydratedCommunityDocument[]): Pro
|
||||||
for (let i = 0; i < communities.length; i++) {
|
for (let i = 0; i < communities.length; i++) {
|
||||||
const community = communities[i];
|
const community = communities[i];
|
||||||
|
|
||||||
const empathies = await Post.aggregate<{ _id: null; total: number; }>([
|
const empathies = await Post.aggregate<{ _id: null; total: number }>([
|
||||||
{
|
{
|
||||||
$match: {
|
$match: {
|
||||||
community_id: community.olive_community_id
|
community_id: community.olive_community_id
|
||||||
|
|
@ -109,10 +109,10 @@ async function generateTopicsData(communities: HydratedCommunityDocument[]): Pro
|
||||||
is_recommended: community.is_recommended ? 1 : 0,
|
is_recommended: community.is_recommended ? 1 : 0,
|
||||||
name: community.name,
|
name: community.name,
|
||||||
people: [],
|
people: [],
|
||||||
position: i+1
|
position: i + 1
|
||||||
};
|
};
|
||||||
|
|
||||||
community.title_id.forEach(title_id => {
|
community.title_id.forEach((title_id) => {
|
||||||
// * Just in case
|
// * Just in case
|
||||||
if (title_id) {
|
if (title_id) {
|
||||||
topic.title_ids.push({ 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');
|
throw new Error('Invalid date');
|
||||||
}
|
}
|
||||||
|
|
||||||
const validCommunities = await Community.aggregate<{ _id: null; communities: string[]; }>([
|
const validCommunities = await Community.aggregate<{ _id: null; communities: string[] }>([
|
||||||
{
|
{
|
||||||
$match: {
|
$match: {
|
||||||
type: 0,
|
type: 0,
|
||||||
|
|
@ -242,7 +242,7 @@ async function calculateMostPopularCommunities(hours: number, limit: number): Pr
|
||||||
throw new Error('No communities found');
|
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: {
|
$match: {
|
||||||
created_at: {
|
created_at: {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { getValueFromQueryString } from '@/util';
|
||||||
|
|
||||||
const router = express.Router();
|
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 type = getValueFromQueryString(request.query, 'type')[0];
|
||||||
const titleID = getValueFromQueryString(request.query, 'title_id')[0];
|
const titleID = getValueFromQueryString(request.query, 'title_id')[0];
|
||||||
const pid = getValueFromQueryString(request.query, 'pid')[0];
|
const pid = getValueFromQueryString(request.query, 'pid')[0];
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import subdomain from 'express-subdomain';
|
import subdomain from 'express-subdomain';
|
||||||
import { LOG_INFO } from '@/logger';
|
import { LOG_INFO } from '@/logger';
|
||||||
|
|
||||||
import discoveryHandlers from '@/services/discovery/routes/discovery';
|
import discoveryHandlers from '@/services/discovery/routes/discovery';
|
||||||
|
|
||||||
// Main router for endpointsindex.js
|
// Main router for endpointsindex.js
|
||||||
|
|
@ -19,4 +18,4 @@ router.use(subdomain('discovery-dev.olv', discovery));
|
||||||
// Setup routes
|
// Setup routes
|
||||||
discovery.use('/v1/endpoint', discoveryHandlers);
|
discovery.use('/v1/endpoint', discoveryHandlers);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import xmlbuilder from 'xmlbuilder';
|
import xmlbuilder from 'xmlbuilder';
|
||||||
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
|
||||||
import { getUserAccountData } from '@/util';
|
import { getUserAccountData } from '@/util';
|
||||||
import { getEndpoint } from '@/database';
|
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();
|
const router = express.Router();
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ router.get('/', async function (request: express.Request, response: express.Resp
|
||||||
|
|
||||||
try {
|
try {
|
||||||
user = await getUserAccountData(request.pid);
|
user = await getUserAccountData(request.pid);
|
||||||
} catch (error) {
|
} catch (ignored) {
|
||||||
// TODO - Log this error
|
// TODO - Log this error
|
||||||
response.sendStatus(404);
|
response.sendStatus(404);
|
||||||
return;
|
return;
|
||||||
|
|
@ -52,7 +52,7 @@ router.get('/', async function (request: express.Request, response: express.Resp
|
||||||
}
|
}
|
||||||
}).end({ pretty: true }));
|
}).end({ pretty: true }));
|
||||||
|
|
||||||
return ;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
message = 'SYSTEM_UPDATE_REQUIRED';
|
message = 'SYSTEM_UPDATE_REQUIRED';
|
||||||
errorCode = 1;
|
errorCode = 1;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import mongoose from 'mongoose';
|
import type mongoose from 'mongoose';
|
||||||
|
|
||||||
export interface Config {
|
export interface Config {
|
||||||
http: {
|
http: {
|
||||||
|
|
@ -30,4 +30,4 @@ export interface Config {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
aes_key: string;
|
aes_key: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ export interface FormattedMessage {
|
||||||
screen_name: string;
|
screen_name: string;
|
||||||
topic_tag: {
|
topic_tag: {
|
||||||
name: string;
|
name: string;
|
||||||
title_id: number
|
title_id: number;
|
||||||
};
|
};
|
||||||
title_id: string;
|
title_id: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,4 @@ export interface ParamPack {
|
||||||
transferable_id: string;
|
transferable_id: string;
|
||||||
tz_name: string;
|
tz_name: string;
|
||||||
utc_offset: string;
|
utc_offset: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@ export interface Token {
|
||||||
access_level: number;
|
access_level: number;
|
||||||
title_id: bigint;
|
title_id: bigint;
|
||||||
expire_time: bigint;
|
expire_time: bigint;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
src/types/express-subdomain.d.ts
vendored
2
src/types/express-subdomain.d.ts
vendored
|
|
@ -13,4 +13,4 @@ declare module 'express-subdomain'{
|
||||||
subdomain: string,
|
subdomain: string,
|
||||||
fn: Router
|
fn: Router
|
||||||
): (req: Request, res: Response, next: () => void) => void | typeof fn;
|
): (req: Request, res: Response, next: () => void) => void | typeof fn;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
src/types/express.d.ts
vendored
6
src/types/express.d.ts
vendored
|
|
@ -1,10 +1,10 @@
|
||||||
import { ParamPack } from '@/types/common/param-pack';
|
import type { ParamPack } from '@/types/common/param-pack';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace Express {
|
namespace Express {
|
||||||
interface Request {
|
interface Request {
|
||||||
pid: number;
|
pid: number;
|
||||||
paramPack: ParamPack
|
paramPack: ParamPack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { PostData } from '@/types/miiverse/post';
|
import type { PostData } from '@/types/miiverse/post';
|
||||||
|
|
||||||
export type CommunityData = {
|
export type CommunityData = {
|
||||||
community_id: string;
|
community_id: string;
|
||||||
|
|
@ -30,4 +30,4 @@ export type CommunityPostsResult = {
|
||||||
posts: {
|
posts: {
|
||||||
post: PostData;
|
post: PostData;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { PostData } from '@/types/miiverse/post';
|
import type { PostData } from '@/types/miiverse/post';
|
||||||
import { SettingsData } from '@/types/miiverse/settings';
|
import type { SettingsData } from '@/types/miiverse/settings';
|
||||||
|
|
||||||
export type PersonPosts = {
|
export type PersonPosts = {
|
||||||
person: {
|
person: {
|
||||||
posts: {
|
posts: {
|
||||||
post: PostData;
|
post: PostData;
|
||||||
}[];
|
}[];
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PeoplePostsResult = {
|
export type PeoplePostsResult = {
|
||||||
|
|
@ -24,4 +24,4 @@ export type PeopleFollowingResult = {
|
||||||
people: {
|
people: {
|
||||||
person: SettingsData;
|
person: SettingsData;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,4 +50,4 @@ export type PostRepliesResult = {
|
||||||
posts: {
|
posts: {
|
||||||
post: PostData;
|
post: PostData;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export type SettingsData = {
|
export type SettingsData = {
|
||||||
pid: number;
|
pid: number;
|
||||||
screen_name: string;
|
screen_name: string;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { PersonPosts } from '@/types/miiverse/people';
|
import type { PersonPosts } from '@/types/miiverse/people';
|
||||||
|
|
||||||
export type WWPTopic = {
|
export type WWPTopic = {
|
||||||
empathy_count: number;
|
empathy_count: number;
|
||||||
|
|
@ -24,4 +24,3 @@ export type WWPResult = {
|
||||||
topic: WWPTopic;
|
topic: WWPTopic;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,6 @@ export interface CommunityPostsQuery {
|
||||||
$in: number[];
|
$in: number[];
|
||||||
};
|
};
|
||||||
parent?: {
|
parent?: {
|
||||||
$eq: null
|
$eq: null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Model, Types, HydratedDocument } from 'mongoose';
|
import type { Model, Types, HydratedDocument } from 'mongoose';
|
||||||
import { CommunityData } from '@/types/miiverse/community';
|
import type { CommunityData } from '@/types/miiverse/community';
|
||||||
|
|
||||||
enum COMMUNITY_TYPE {
|
enum COMMUNITY_TYPE {
|
||||||
Main = 0,
|
Main = 0,
|
||||||
|
|
@ -37,7 +37,7 @@ export interface ICommunity {
|
||||||
is_recommended: number;
|
is_recommended: number;
|
||||||
app_data: string;
|
app_data: string;
|
||||||
user_favorites: Types.Array<number>;
|
user_favorites: Types.Array<number>;
|
||||||
permissions: ICommunityPermissions
|
permissions: ICommunityPermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICommunityMethods {
|
export interface ICommunityMethods {
|
||||||
|
|
@ -48,4 +48,4 @@ export interface ICommunityMethods {
|
||||||
|
|
||||||
export type CommunityModel = Model<ICommunity, object, ICommunityMethods>;
|
export type CommunityModel = Model<ICommunity, object, ICommunityMethods>;
|
||||||
|
|
||||||
export type HydratedCommunityDocument = HydratedDocument<ICommunity, ICommunityMethods>;
|
export type HydratedCommunityDocument = HydratedDocument<ICommunity, ICommunityMethods>;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { Model, Types, HydratedDocument } from 'mongoose';
|
import type { Model, Types, HydratedDocument } from 'mongoose';
|
||||||
|
|
||||||
export interface IContent {
|
export interface IContent {
|
||||||
pid: number;
|
pid: number;
|
||||||
followed_communities: Types.Array<string>;
|
followed_communities: Types.Array<string>;
|
||||||
followed_users: Types.Array<number>;
|
followed_users: Types.Array<number>;
|
||||||
following_users: Types.Array<number>;
|
following_users: Types.Array<number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ContentModel = Model<IContent>;
|
export type ContentModel = Model<IContent>;
|
||||||
|
|
||||||
export type HydratedContentDocument = HydratedDocument<IContent>;
|
export type HydratedContentDocument = HydratedDocument<IContent>;
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
import { Model, Types, HydratedDocument } from 'mongoose';
|
import type { Model, Types, HydratedDocument } from 'mongoose';
|
||||||
|
|
||||||
export type ConversationUser = {
|
export type ConversationUser = {
|
||||||
pid: number;
|
pid: number;
|
||||||
official: boolean;
|
official: boolean;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IConversation {
|
export interface IConversation {
|
||||||
id: string;
|
id: string;
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
last_updated: Date;
|
last_updated: Date;
|
||||||
message_preview: string,
|
message_preview: string;
|
||||||
users: Types.Array<ConversationUser>;
|
users: Types.Array<ConversationUser>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConversationMethods {
|
export interface IConversationMethods {
|
||||||
|
|
@ -20,4 +20,4 @@ export interface IConversationMethods {
|
||||||
|
|
||||||
export type ConversationModel = Model<IConversation, object, IConversationMethods>;
|
export type ConversationModel = Model<IConversation, object, IConversationMethods>;
|
||||||
|
|
||||||
export type HydratedConversationDocument = HydratedDocument<IConversation, IConversationMethods>;
|
export type HydratedConversationDocument = HydratedDocument<IConversation, IConversationMethods>;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
import { Model, HydratedDocument } from 'mongoose';
|
import type { Model, HydratedDocument } from 'mongoose';
|
||||||
|
|
||||||
export interface IEndpoint {
|
export interface IEndpoint {
|
||||||
status: number;
|
status: number;
|
||||||
server_access_level: string;
|
server_access_level: string;
|
||||||
topics: boolean;
|
topics: boolean;
|
||||||
guest_access: boolean;
|
guest_access: boolean;
|
||||||
host: string;
|
host: string;
|
||||||
api_host: string;
|
api_host: string;
|
||||||
portal_host: string;
|
portal_host: string;
|
||||||
n3ds_host: string;
|
n3ds_host: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EndpointModel = Model<IEndpoint>;
|
export type EndpointModel = Model<IEndpoint>;
|
||||||
|
|
||||||
export type HydratedEndpointDocument = HydratedDocument<IEndpoint>;
|
export type HydratedEndpointDocument = HydratedDocument<IEndpoint>;
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
import { Model, Types, HydratedDocument } from 'mongoose';
|
import type { Model, Types, HydratedDocument } from 'mongoose';
|
||||||
|
|
||||||
export type NotificationUser = {
|
export type NotificationUser = {
|
||||||
user: string;
|
user: string;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
}
|
};
|
||||||
|
|
||||||
export interface INotification {
|
export interface INotification {
|
||||||
pid: string;
|
pid: string;
|
||||||
type: string;
|
type: string;
|
||||||
link: string;
|
link: string;
|
||||||
objectID: string;
|
objectID: string;
|
||||||
users: Types.Array<NotificationUser>;
|
users: Types.Array<NotificationUser>;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
lastUpdated: number;
|
lastUpdated: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NotificationModel = Model<INotification>;
|
export type NotificationModel = Model<INotification>;
|
||||||
|
|
||||||
export type HydratedNotificationDocument = HydratedDocument<INotification>;
|
export type HydratedNotificationDocument = HydratedDocument<INotification>;
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@ export interface PostToJSONOptions {
|
||||||
with_mii: boolean;
|
with_mii: boolean;
|
||||||
app_data?: boolean;
|
app_data?: boolean;
|
||||||
topic_tag?: boolean;
|
topic_tag?: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Model, Types, HydratedDocument } from 'mongoose';
|
import type { Model, Types, HydratedDocument } from 'mongoose';
|
||||||
import { HydratedCommunityDocument } from '@/types/mongoose/community';
|
import type { HydratedCommunityDocument } from '@/types/mongoose/community';
|
||||||
import { PostToJSONOptions } from '@/types/mongoose/post-to-json-options';
|
import type { PostToJSONOptions } from '@/types/mongoose/post-to-json-options';
|
||||||
import { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/types/miiverse/post';
|
import type { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/types/miiverse/post';
|
||||||
|
|
||||||
export interface IPost {
|
export interface IPost {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -54,4 +54,4 @@ export interface IPostMethods {
|
||||||
|
|
||||||
export type PostModel = Model<IPost, object, IPostMethods>;
|
export type PostModel = Model<IPost, object, IPostMethods>;
|
||||||
|
|
||||||
export type HydratedPostDocument = HydratedDocument<IPost, IPostMethods>;
|
export type HydratedPostDocument = HydratedDocument<IPost, IPostMethods>;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { Model, HydratedDocument } from 'mongoose';
|
import type { Model, HydratedDocument } from 'mongoose';
|
||||||
|
|
||||||
export interface IReport {
|
export interface IReport {
|
||||||
pid: string;
|
pid: string;
|
||||||
post_id: string;
|
post_id: string;
|
||||||
reason: number;
|
reason: number;
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ReportModel = Model<IReport>;
|
export type ReportModel = Model<IReport>;
|
||||||
|
|
||||||
export type HydratedReportDocument = HydratedDocument<IReport>;
|
export type HydratedReportDocument = HydratedDocument<IReport>;
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
import { Model, HydratedDocument } from 'mongoose';
|
import type { Model, HydratedDocument } from 'mongoose';
|
||||||
import { SettingsData } from '@/types/miiverse/settings';
|
import type { SettingsData } from '@/types/miiverse/settings';
|
||||||
|
|
||||||
export interface ISettings {
|
export interface ISettings {
|
||||||
pid: number;
|
pid: number;
|
||||||
screen_name: string;
|
screen_name: string;
|
||||||
account_status: number;
|
account_status: number;
|
||||||
ban_lift_date: Date;
|
ban_lift_date: Date;
|
||||||
ban_reason: string;
|
ban_reason: string;
|
||||||
profile_comment: string;
|
profile_comment: string;
|
||||||
profile_comment_visibility: boolean;
|
profile_comment_visibility: boolean;
|
||||||
game_skill: number;
|
game_skill: number;
|
||||||
game_skill_visibility: boolean;
|
game_skill_visibility: boolean;
|
||||||
birthday_visibility: boolean;
|
birthday_visibility: boolean;
|
||||||
relationship_visibility: boolean;
|
relationship_visibility: boolean;
|
||||||
country_visibility: boolean;
|
country_visibility: boolean;
|
||||||
profile_favorite_community_visibility: boolean;
|
profile_favorite_community_visibility: boolean;
|
||||||
receive_notifications: boolean;
|
receive_notifications: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISettingsMethods {
|
export interface ISettingsMethods {
|
||||||
|
|
@ -24,4 +24,4 @@ export interface ISettingsMethods {
|
||||||
|
|
||||||
export type SettingsModel = Model<ISettings, object, ISettingsMethods>;
|
export type SettingsModel = Model<ISettings, object, ISettingsMethods>;
|
||||||
|
|
||||||
export type HydratedSettingsDocument = HydratedDocument<ISettings, ISettingsMethods>;
|
export type HydratedSettingsDocument = HydratedDocument<ISettings, ISettingsMethods>;
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ export interface SubCommunityQuery {
|
||||||
user_favorites?: number;
|
user_favorites?: number;
|
||||||
olive_community_id?: string;
|
olive_community_id?: string;
|
||||||
community_id?: string;
|
community_id?: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
src/types/node-snowflake.d.ts
vendored
2
src/types/node-snowflake.d.ts
vendored
|
|
@ -11,4 +11,4 @@ declare module 'node-snowflake' {
|
||||||
init: (config: SnowflakeInitConfig) => void;
|
init: (config: SnowflakeInitConfig) => void;
|
||||||
nextId: (workerId?: number, dataCenterId?: number, sequence?: number) => string;
|
nextId: (workerId?: number, dataCenterId?: number, sequence?: number) => string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
src/types/tga.d.ts
vendored
2
src/types/tga.d.ts
vendored
|
|
@ -55,4 +55,4 @@ declare module 'tga' {
|
||||||
|
|
||||||
public pixels: Uint8Array;
|
public pixels: Uint8Array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
src/util.ts
18
src/util.ts
|
|
@ -1,22 +1,20 @@
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
import { IncomingHttpHeaders } from 'node:http';
|
|
||||||
import TGA from 'tga';
|
import TGA from 'tga';
|
||||||
import BMP from 'bmp-js';
|
import BMP from 'bmp-js';
|
||||||
import pako from 'pako';
|
import pako from 'pako';
|
||||||
import { PNG } from 'pngjs';
|
import { PNG } from 'pngjs';
|
||||||
import aws from 'aws-sdk';
|
import aws from 'aws-sdk';
|
||||||
import { createChannel, createClient, Metadata } from 'nice-grpc';
|
import { createChannel, createClient, Metadata } from 'nice-grpc';
|
||||||
import { ParsedQs } from 'qs';
|
|
||||||
import crc32 from 'crc/crc32';
|
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 { FriendsDefinition } from '@pretendonetwork/grpc/friends/friends_service';
|
||||||
import { FriendRequest } from '@pretendonetwork/grpc/friends/friend_request';
|
|
||||||
|
|
||||||
import { AccountDefinition } from '@pretendonetwork/grpc/account/account_service';
|
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
|
// * nice-grpc doesn't export ChannelImplementation so this can't be typed
|
||||||
const gRPCFriendsChannel = createChannel(`${config.grpc.friends.ip}:${config.grpc.friends.port}`);
|
const gRPCFriendsChannel = createChannel(`${config.grpc.friends.ip}:${config.grpc.friends.port}`);
|
||||||
|
|
@ -224,4 +222,4 @@ export function getValueFromHeaders(headers: IncomingHttpHeaders, key: string):
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
31
test/test.ts
31
test/test.ts
|
|
@ -1,6 +1,5 @@
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
import newman from 'newman';
|
import newman from 'newman';
|
||||||
import { Collection, CollectionDefinition } from 'postman-collection';
|
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { create as parseXML } from 'xmlbuilder2';
|
import { create as parseXML } from 'xmlbuilder2';
|
||||||
|
|
@ -8,9 +7,9 @@ import { table } from 'table';
|
||||||
import ora from 'ora';
|
import ora from 'ora';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import colors from 'colors';
|
import colors from 'colors';
|
||||||
|
|
||||||
import communitiesCollection from '../postman/collections/Communities.json';
|
import communitiesCollection from '../postman/collections/Communities.json';
|
||||||
import peopleCollection from '../postman/collections/People.json';
|
import peopleCollection from '../postman/collections/People.json';
|
||||||
|
import type { Collection, CollectionDefinition } from 'postman-collection';
|
||||||
|
|
||||||
const PeopleCollection: CollectionDefinition = peopleCollection as CollectionDefinition;
|
const PeopleCollection: CollectionDefinition = peopleCollection as CollectionDefinition;
|
||||||
const CommunitiesCollection: CollectionDefinition = communitiesCollection as CollectionDefinition;
|
const CommunitiesCollection: CollectionDefinition = communitiesCollection as CollectionDefinition;
|
||||||
|
|
@ -24,7 +23,7 @@ interface TestResult {
|
||||||
url: string;
|
url: string;
|
||||||
query: string;
|
query: string;
|
||||||
assertion: string;
|
assertion: string;
|
||||||
error?: string
|
error?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const USERNAME = process.env.PN_MIIVERSE_API_TESTING_USERNAME?.trim() || '';
|
const USERNAME = process.env.PN_MIIVERSE_API_TESTING_USERNAME?.trim() || '';
|
||||||
|
|
@ -102,7 +101,7 @@ async function apiGetRequest(url: string, headers = {}): Promise<Record<string,
|
||||||
async function apiPostRequest(url: string, body: string): Promise<Record<string, any>> {
|
async function apiPostRequest(url: string, body: string): Promise<Record<string, any>> {
|
||||||
const response = await axios.post(url, body, {
|
const response = await axios.post(url, body, {
|
||||||
headers: DEFAULT_HEADERS,
|
headers: DEFAULT_HEADERS,
|
||||||
validateStatus: () => true,
|
validateStatus: () => true
|
||||||
});
|
});
|
||||||
|
|
||||||
const data: Record<string, any> = parseXML(response.data).end({ format: 'object' });
|
const data: Record<string, any> = parseXML(response.data).end({ format: 'object' });
|
||||||
|
|
@ -129,7 +128,7 @@ async function getAccessToken(username: string, passwordHash: string): Promise<s
|
||||||
grant_type: 'password',
|
grant_type: 'password',
|
||||||
user_id: username,
|
user_id: username,
|
||||||
password: passwordHash,
|
password: passwordHash,
|
||||||
password_type: 'hash',
|
password_type: 'hash'
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await apiPostRequest(ACCESS_TOKEN_URL, data);
|
const response = await apiPostRequest(ACCESS_TOKEN_URL, data);
|
||||||
|
|
@ -140,7 +139,7 @@ async function getAccessToken(username: string, passwordHash: string): Promise<s
|
||||||
async function getMiiverseServiceToken(accessToken: string): Promise<string> {
|
async function getMiiverseServiceToken(accessToken: string): Promise<string> {
|
||||||
const response = await apiGetRequest(SERVICE_TOKEN_URL, {
|
const response = await apiGetRequest(SERVICE_TOKEN_URL, {
|
||||||
'X-Nintendo-Title-ID': '0005001010040100',
|
'X-Nintendo-Title-ID': '0005001010040100',
|
||||||
Authorization: `Bearer ${accessToken}`
|
'Authorization': `Bearer ${accessToken}`
|
||||||
});
|
});
|
||||||
|
|
||||||
return response.service_token.token;
|
return response.service_token.token;
|
||||||
|
|
@ -153,7 +152,7 @@ function runNewmanTest(collection: string | Collection | CollectionDefinition, v
|
||||||
reporters: ['json'],
|
reporters: ['json'],
|
||||||
envVar: Object.entries(variables).map(entry => ({ key: entry[0], value: entry[1] })),
|
envVar: Object.entries(variables).map(entry => ({ key: entry[0], value: entry[1] })),
|
||||||
globals: variables,
|
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) => {
|
}, (error, summary) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
|
|
@ -167,13 +166,13 @@ function runNewmanTest(collection: string | Collection | CollectionDefinition, v
|
||||||
function communitiesRoutesTest(serviceToken: string): Promise<TestResult[]> {
|
function communitiesRoutesTest(serviceToken: string): Promise<TestResult[]> {
|
||||||
// TODO - Make this more dynamic?
|
// TODO - Make this more dynamic?
|
||||||
return runNewmanTest(CommunitiesCollection, {
|
return runNewmanTest(CommunitiesCollection, {
|
||||||
DOMAIN: 'api.olv.pretendo.cc',
|
'DOMAIN': 'api.olv.pretendo.cc',
|
||||||
ServiceToken: serviceToken,
|
'ServiceToken': serviceToken,
|
||||||
// TODO - Change these names. Should not be game-specific
|
// TODO - Change these names. Should not be game-specific
|
||||||
PP_Splatoon: 'XHRpdGxlX2lkXDE0MDczNzUxNTM1MjI5NDRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc',
|
'PP_Splatoon': 'XHRpdGxlX2lkXDE0MDczNzUxNTM1MjI5NDRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc',
|
||||||
PP_MarioVsDK: 'XHRpdGxlX2lkXDE0MDczNzUxNTMzMzcwODhcYWNjZXNzX2tleVw2OTI0NzQ1MTBccGxhdGZvcm1faWRcMVxyZWdpb25faWRcMlxsYW5ndWFnZV9pZFwxXGNvdW50cnlfaWRcNDlcYXJlYV9pZFwwXG5ldHdvcmtfcmVzdHJpY3Rpb25cMFxmcmllbmRfcmVzdHJpY3Rpb25cMFxyYXRpbmdfcmVzdHJpY3Rpb25cMTdccmF0aW5nX29yZ2FuaXphdGlvblwxXHRyYW5zZmVyYWJsZV9pZFw3NjA4MjAyOTE2MDc1ODg0NDI1XHR6X25hbWVcUGFjaWZpYy9NaWR3YXlcdXRjX29mZnNldFwtMzk2MDBc',
|
'PP_MarioVsDK': 'XHRpdGxlX2lkXDE0MDczNzUxNTMzMzcwODhcYWNjZXNzX2tleVw2OTI0NzQ1MTBccGxhdGZvcm1faWRcMVxyZWdpb25faWRcMlxsYW5ndWFnZV9pZFwxXGNvdW50cnlfaWRcNDlcYXJlYV9pZFwwXG5ldHdvcmtfcmVzdHJpY3Rpb25cMFxmcmllbmRfcmVzdHJpY3Rpb25cMFxyYXRpbmdfcmVzdHJpY3Rpb25cMTdccmF0aW5nX29yZ2FuaXphdGlvblwxXHRyYW5zZmVyYWJsZV9pZFw3NjA4MjAyOTE2MDc1ODg0NDI1XHR6X25hbWVcUGFjaWZpYy9NaWR3YXlcdXRjX29mZnNldFwtMzk2MDBc',
|
||||||
PP_Bad_TID: 'XHRpdGxlX2lkXDEyMzRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc',
|
'PP_Bad_TID': 'XHRpdGxlX2lkXDEyMzRcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc',
|
||||||
PP_ACPlaza: 'XHRpdGxlX2lkXDE0MDczNzUxNTMzMjE0NzJcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc',
|
'PP_ACPlaza': 'XHRpdGxlX2lkXDE0MDczNzUxNTMzMjE0NzJcYWNjZXNzX2tleVwwXHBsYXRmb3JtX2lkXDFccmVnaW9uX2lkXDJcbGFuZ3VhZ2VfaWRcMVxjb3VudHJ5X2lkXDExMFxhcmVhX2lkXDBcbmV0d29ya19yZXN0cmljdGlvblwwXGZyaWVuZF9yZXN0cmljdGlvblwwXHJhdGluZ19yZXN0cmljdGlvblwyMFxyYXRpbmdfb3JnYW5pemF0aW9uXDBcdHJhbnNmZXJhYmxlX2lkXDEyNzU2MTQ0ODg0NDUzODk4NzgyXHR6X25hbWVcQW1lcmljYS9OZXdfWW9ya1x1dGNfb2Zmc2V0XC0xNDQwMFxyZW1hc3Rlcl92ZXJzaW9uXDBc',
|
||||||
'PP_Bad Format': 'XHR'
|
'PP_Bad Format': 'XHR'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +183,7 @@ function peopleRoutesTest(serviceToken: string): Promise<TestResult[]> {
|
||||||
DOMAIN: 'api.olv.pretendo.cc',
|
DOMAIN: 'api.olv.pretendo.cc',
|
||||||
ServiceToken: serviceToken,
|
ServiceToken: serviceToken,
|
||||||
// TODO - Change this name. Should not be game-specific
|
// 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,
|
collection: summary.collection.name,
|
||||||
name: execution.item.name,
|
name: execution.item.name,
|
||||||
url: `${request.url.protocol}://${request.url.host?.join('.')}/${request.url.path?.join('/')}`,
|
url: `${request.url.protocol}://${request.url.host?.join('.')}/${request.url.path?.join('/')}`,
|
||||||
query: qs.stringify(request.url.query.all().reduce((object: Record<string, string>, item: { disabled?: boolean; key: string | null; value: string | null; }) => {
|
query: qs.stringify(request.url.query.all().reduce((object: Record<string, string>, item: { disabled?: boolean; key: string | null; value: string | null }) => {
|
||||||
if (!item.disabled && item.key && item.value) {
|
if (!item.disabled && item.key && item.value) {
|
||||||
object[item.key] = item.value;
|
object[item.key] = item.value;
|
||||||
}
|
}
|
||||||
|
|
@ -293,4 +292,4 @@ function createTestResults(summary: newman.NewmanRunSummary): TestResult[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user