for frick sake

This commit is contained in:
Ben
2018-09-14 19:07:47 +01:00
parent 3455bbc14b
commit 7e5f13e114
5 changed files with 49 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ export class AuthMiddleWare extends MiddleWare {
}
req.user = user;
Logger.debug(`User ${user.id} authenticated`);
next();
}
}

View File

@@ -16,9 +16,15 @@ export class NoteController extends ControllerHandler {
let user = req.user || undefined;
if (!creatorid) errors.addError(403, 'Forbidden');
if (!creatorid || !user) errors.addError(403, 'Forbidden');
if (errors.count() > 0) {
errors.endpoint();
next();
return;
}
// what the hecking heck is this code supoased to do you hecking idiot
next();
}

View File

@@ -1,5 +1,4 @@
const colours = require('colors/safe');
const StackTrace = require('stacktrace-js');
const fs = require('fs');
let LogLevel = 1;
@@ -48,7 +47,7 @@ export class Logger {
static debug(message) {
if (LogLevel > 1) return;
let d = new Date();
fs.appendFileSync(logPath, `[${d.toLocaleString()}] [DEBUG] [${StackTrace.getSync()[1].fileName + ':' + StackTrace.getSync()[1].lineNumber}] ${message} \n`);
fs.appendFileSync(logPath, `[${d.toLocaleString()}] [DEBUG] ${message} \n`);
console.log('[' + d.toLocaleString() + '] ['
+ colours.cyan('DEBUG') + '] ' + message);
}