mirror of
https://github.com/PretendoNetwork/BOSS.git
synced 2026-03-21 17:34:19 -05:00
style: run new eslint on PR affected files
This commit is contained in:
parent
60df36abd3
commit
45d2be809c
|
|
@ -52,4 +52,4 @@ export function LOG_INFO(input: string): void {
|
|||
streams.info.write(`${input}\n`);
|
||||
|
||||
console.log(`${input}`.cyan.bold);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
process.title = 'Pretendo - BOSS';
|
||||
process.on('SIGTERM', () => {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
import express from 'express';
|
||||
import morgan from 'morgan';
|
||||
import { connect as connectDatabase } from '@/database';
|
||||
|
|
@ -18,6 +13,11 @@ import npfl from '@/services/npfl';
|
|||
import npdl from '@/services/npdl';
|
||||
import spr from '@/services/spr';
|
||||
|
||||
process.title = 'Pretendo - BOSS';
|
||||
process.on('SIGTERM', () => {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
const app = express();
|
||||
|
||||
LOG_INFO('Setting up Middleware');
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ npdi.get('/p01/data/1/:titleHash/:dataID/:fileHash', (request, response) => {
|
|||
// * The misspelling here is intentional, it's what the official server sets
|
||||
'Content-Type': 'applicatoin/octet-stream',
|
||||
'Content-Disposition': 'attachment',
|
||||
'Content-Transfer-Encoding': 'binary',
|
||||
'Content-Transfer-Encoding': 'binary'
|
||||
}
|
||||
}, fileErrCallback(response));
|
||||
});
|
||||
|
|
@ -23,4 +23,4 @@ const router = express.Router();
|
|||
|
||||
router.use(subdomain('npdi.cdn', npdi));
|
||||
|
||||
export default router;
|
||||
export default router;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { Stream } from 'node:stream';
|
||||
import express from 'express';
|
||||
import subdomain from 'express-subdomain';
|
||||
import { getTaskFile } from '@/database';
|
||||
import { getCDNFileStream } from '@/util';
|
||||
import { Stream } from 'node:stream';
|
||||
import { LOG_ERROR } from '@/logger';
|
||||
|
||||
const npdl = express.Router();
|
||||
|
|
@ -18,9 +18,9 @@ npdl.get([
|
|||
languageCode?: string;
|
||||
fileName: string;
|
||||
}, any, any, {
|
||||
ap?: string;
|
||||
tm?: string;
|
||||
}>, response) => {
|
||||
ap?: string;
|
||||
tm?: string;
|
||||
}>, response) => {
|
||||
const { appID, taskID, countryCode, languageCode, fileName } = request.params;
|
||||
|
||||
const file = await getTaskFile(appID, taskID, fileName, countryCode, languageCode);
|
||||
|
|
|
|||
|
|
@ -31,4 +31,4 @@ const router = express.Router();
|
|||
|
||||
router.use(subdomain('npts.app', npts));
|
||||
|
||||
export default router;
|
||||
export default router;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import { getDuplicateCECData, getRandomCECData } from '@/database';
|
|||
import { getFriends, getNEXDataByPID } from '@/util';
|
||||
import { CECData } from '@/models/cec-data';
|
||||
import { CECSlot } from '@/models/cec-slot';
|
||||
import { SendMode, SPRSlot } from '@/types/common/spr-slot';
|
||||
import { SendMode } from '@/types/common/spr-slot';
|
||||
import type { SPRSlot } from '@/types/common/spr-slot';
|
||||
|
||||
const spr = express.Router();
|
||||
|
||||
|
|
@ -33,7 +34,7 @@ function multipartParser(request: express.Request, response: express.Response, n
|
|||
let fileBuffer = Buffer.alloc(0);
|
||||
let fileName = '';
|
||||
|
||||
part.on('header', header => {
|
||||
part.on('header', (header) => {
|
||||
const contentDisposition = header['content-disposition' as keyof object];
|
||||
const regexResult = RE_FILE_NAME.exec(contentDisposition);
|
||||
|
||||
|
|
@ -208,7 +209,7 @@ spr.post('/relay/0', multipartParser, async (request, response) => {
|
|||
sendMode,
|
||||
gameID,
|
||||
size,
|
||||
data,
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -240,7 +241,7 @@ spr.post('/relay/0', multipartParser, async (request, response) => {
|
|||
await CECSlot.findOneAndUpdate({
|
||||
creator_pid: request.pid,
|
||||
game_id: slotData.game_id
|
||||
}, {latest_data_id: slotData.id}, {upsert: true});
|
||||
}, { latest_data_id: slotData.id }, { upsert: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +271,6 @@ spr.post('/relay/0', multipartParser, async (request, response) => {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
response.send(sprData);
|
||||
});
|
||||
|
||||
|
|
|
|||
23
src/util.ts
23
src/util.ts
|
|
@ -1,18 +1,21 @@
|
|||
import crypto from 'node:crypto';
|
||||
import path from 'node:path';
|
||||
import { Readable } from 'node:stream';
|
||||
import fs from 'fs-extra';
|
||||
import { createChannel, createClient, Metadata } from 'nice-grpc';
|
||||
import { GetObjectCommand, PutObjectCommand, S3, S3Client } from '@aws-sdk/client-s3';
|
||||
import { AccountClient, AccountDefinition } from '@pretendonetwork/grpc/account/account_service';
|
||||
import { FriendsClient, FriendsDefinition } from '@pretendonetwork/grpc/friends/friends_service';
|
||||
import { GetNEXDataResponse } from '@pretendonetwork/grpc/account/get_nex_data_rpc';
|
||||
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
||||
import { GetUserFriendPIDsResponse } from '@pretendonetwork/grpc/friends/get_user_friend_pids_rpc';
|
||||
import { GetObjectCommand, PutObjectCommand, S3 } from '@aws-sdk/client-s3';
|
||||
import { AccountDefinition } from '@pretendonetwork/grpc/account/account_service';
|
||||
import { FriendsDefinition } from '@pretendonetwork/grpc/friends/friends_service';
|
||||
import { config, disabledFeatures } from '@/config-manager';
|
||||
import { NodeJsClient } from '@smithy/types';
|
||||
import { Response } from 'express';
|
||||
import { LOG_ERROR } from '@/logger';
|
||||
import type { FriendsClient } from '@pretendonetwork/grpc/friends/friends_service';
|
||||
import type { AccountClient } from '@pretendonetwork/grpc/account/account_service';
|
||||
import type { S3Client } from '@aws-sdk/client-s3';
|
||||
import type { GetNEXDataResponse } from '@pretendonetwork/grpc/account/get_nex_data_rpc';
|
||||
import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
||||
import type { GetUserFriendPIDsResponse } from '@pretendonetwork/grpc/friends/get_user_friend_pids_rpc';
|
||||
import type { NodeJsClient } from '@smithy/types';
|
||||
import type { Response } from 'express';
|
||||
import type { Readable } from 'node:stream';
|
||||
|
||||
let s3: NodeJsClient<S3Client>;
|
||||
|
||||
|
|
@ -172,7 +175,7 @@ export async function getCDNFileStream(key: string): Promise<Readable | null> {
|
|||
|
||||
return response.Body;
|
||||
}
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user