fix body json+token #3

Closed
orzMaster wants to merge 8 commits from main into main
4 changed files with 1302 additions and 2 deletions

2
irc/makefile Normal file
View File

@ -0,0 +1,2 @@
run:
python miniircd.py --debug --ports 6699 --ssl-cert-file ..\static\certs\cert.pem --ssl-key-file ..\static\certs\key.pem

1288
irc/miniircd.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,17 @@ const unknownEndpointHandler = (request: Request, response: Response) => {
const requestLogger = (request: Request, _response: Response, next: NextFunction) => {
console.log("Method:", request.method);
console.log("Path: ", request.path);
console.log("Body: ", request.body);
if (Buffer.isBuffer(request.body)) {
const str = request.body.toString();
const index = str.lastIndexOf("}");
const jsonSubstring = str.substring(0, index + 1);
console.log("Body: ", jsonSubstring);
request.body = jsonSubstring;
if (str.length > jsonSubstring.length) {
const token = str.substring(index + 1, str.length).trim();
console.log("Token: ", token);
}
}
console.log("---");
next();
};

View File

@ -28,6 +28,6 @@ export const NRS = ["104.237.145.11", "139.144.69.73", "170.187.231.80", "45.33.
export const DTLS = 99;
export const IRC = ["localhost"];
export const IRC = ["localhost:6699"];
export const HUB = "https://arbiter.warframe.com/api/";