cleaned up some logs

pull/29/head
tycrek 3 years ago
parent bd273186e6
commit 4fae603d31
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -53,7 +53,6 @@ app.set('view engine', 'pug');
// Express logger middleware // Express logger middleware
app.use(log.express(true)); app.use(log.express(true));
app.use((_req, _res, next) => log.epoch().callback(() => next()));
// Helmet security middleware // Helmet security middleware
app.use(helmet.noSniff()); app.use(helmet.noSniff());

@ -21,7 +21,6 @@ const router = express.Router();
// Block unauthorized requests and attempt token sanitization // Block unauthorized requests and attempt token sanitization
router.post('/', (req, res, next) => { router.post('/', (req, res, next) => {
log.express().Header(req, 'authorization');
req.headers.authorization = req.headers.authorization || ''; req.headers.authorization = req.headers.authorization || '';
req.token = req.headers.authorization.replace(/[^\da-z]/gi, ''); // Strip anything that isn't a digit or ASCII letter req.token = req.headers.authorization.replace(/[^\da-z]/gi, ''); // Strip anything that isn't a digit or ASCII letter
!verify(req, users) ? res.sendStatus(CODE_UNAUTHORIZED) : next(); // skipcq: JS-0093 !verify(req, users) ? res.sendStatus(CODE_UNAUTHORIZED) : next(); // skipcq: JS-0093
@ -89,7 +88,7 @@ router.post('/', (req, res, next) => {
.setTimestamp(req.file.timestamp); .setTimestamp(req.file.timestamp);
// Send the embed to the webhook, then delete the client after to free resources // Send the embed to the webhook, then delete the client after to free resources
log.debug('Sending webhook to', ` to ${client}`); log.debug('Sending webhook to client', client);
whc.send(null, { whc.send(null, {
username: req.headers['x-ass-webhook-username'] || 'ass', username: req.headers['x-ass-webhook-username'] || 'ass',
avatarURL: req.headers['x-ass-webhook-avatar'] || ASS_LOGO, avatarURL: req.headers['x-ass-webhook-avatar'] || ASS_LOGO,
@ -108,7 +107,7 @@ router.post('/', (req, res, next) => {
users[req.token].count += 1; users[req.token].count += 1;
fs.writeJsonSync(path('auth.json'), { users }, { spaces: 4 }); fs.writeJsonSync(path('auth.json'), { users }, { spaces: 4 });
log.debug('Upload request flow completed', '').epoch(); log.debug('Upload request flow completed', '');
}); });
}).catch(next); }).catch(next);
}); });

Loading…
Cancel
Save