mirror of
https://github.com/PretendoNetwork/BOSS.git
synced 2026-03-21 17:34:19 -05:00
refactor: remove authentication middleware - unneeded and caused eslint to complain
This commit is contained in:
parent
7e37300884
commit
ab0a6cc151
|
|
@ -1,11 +0,0 @@
|
|||
import express from 'express';
|
||||
import { getNEXDataByPID } from '@/util';
|
||||
|
||||
export default async function authenticationMiddleware(request: express.Request, response: express.Response, next: express.NextFunction): Promise<void> {
|
||||
if (request.pid) {
|
||||
// TODO - Get users PNIDs
|
||||
request.nexAccount = await getNEXDataByPID(request.pid);
|
||||
}
|
||||
|
||||
return next();
|
||||
}
|
||||
|
|
@ -10,10 +10,7 @@ import { startGRPCServer } from '@/services/grpc/server';
|
|||
import RequestException from '@/request-exception';
|
||||
import { LOG_INFO, LOG_SUCCESS } from '@/logger';
|
||||
import { config } from '@/config-manager';
|
||||
|
||||
import parseUserAgentMiddleware from '@/middleware/parse-user-agent';
|
||||
import authenticationMiddleware from '@/middleware/authentication';
|
||||
|
||||
import nppl from '@/services/nppl';
|
||||
import npts from '@/services/npts';
|
||||
import npdi from '@/services/npdi';
|
||||
|
|
@ -31,7 +28,6 @@ app.use(express.urlencoded({
|
|||
}));
|
||||
|
||||
app.use(parseUserAgentMiddleware);
|
||||
app.use(authenticationMiddleware);
|
||||
|
||||
app.use(nppl);
|
||||
app.use(npts);
|
||||
|
|
|
|||
|
|
@ -69,13 +69,19 @@ spr.post('/relay/0', multipartParser, async (request, response) => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!request.pid || !request.nexAccount) {
|
||||
if (!request.pid) {
|
||||
response.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
|
||||
const nexAccount = await getNEXDataByPID(request.pid);
|
||||
if (!nexAccount) {
|
||||
response.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
|
||||
// * Check that the account is a 3DS and isn't banned
|
||||
if (!request.nexAccount.friendCode || request.nexAccount.accessLevel < 0) {
|
||||
if (!nexAccount.friendCode || nexAccount.accessLevel < 0) {
|
||||
response.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
13
src/types/express.d.ts
vendored
13
src/types/express.d.ts
vendored
|
|
@ -1,11 +1,6 @@
|
|||
import { GetNEXDataResponse } from '@pretendonetwork/grpc/account/get_nex_data_rpc';
|
||||
|
||||
declare global {
|
||||
namespace Express {
|
||||
interface Request {
|
||||
files?: Record<string, any>;
|
||||
pid: number;
|
||||
nexAccount: GetNEXDataResponse | null;
|
||||
}
|
||||
declare namespace Express {
|
||||
interface Request {
|
||||
files?: Record<string, any>;
|
||||
pid: number;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user