From 2b42c2f1a747d6e71121b5638d00eb580f626310 Mon Sep 17 00:00:00 2001 From: Mystikfluu Date: Mon, 25 Jul 2022 19:03:42 +0200 Subject: [PATCH] add basic startup logging --- routes/api/options.js | 14 +++++++------- server.js | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/routes/api/options.js b/routes/api/options.js index 717e0f2..53ab37a 100644 --- a/routes/api/options.js +++ b/routes/api/options.js @@ -44,13 +44,13 @@ module.exports = { // res.status(200).send("") // }) - allowAllTraffic("/api/pid") - allowAllTraffic("/api/post","POST") - allowAllTraffic("/api/getotheruser") - allowAllTraffic("/api/getPost") - allowAllTraffic("/api/getPostsLowerThan") - allowAllTraffic("/api/settings") - allowAllTraffic("/api/settings","POST") + allowAllTraffic(router,"/api/pid") + allowAllTraffic(router,"/api/post","POST") + allowAllTraffic(router,"/api/getotheruser") + allowAllTraffic(router,"/api/getPost") + allowAllTraffic(router,"/api/getPostsLowerThan") + allowAllTraffic(router,"/api/settings") + allowAllTraffic(router,"/api/settings","POST") } diff --git a/server.js b/server.js index ca75014..b41ce14 100644 --- a/server.js +++ b/server.js @@ -61,6 +61,10 @@ console.log = log_info +console.log(5,"starting up") + + + const http = require('http'); const https = require('https'); const crypto = require("crypto"); @@ -71,15 +75,14 @@ const bodyParser = require("body-parser"); const cookieParser = require('cookie-parser'); const signature = require('cookie-signature') const mysql = require('mysql'); -const csurf = require("csurf"); const WebSocket = require("ws").Server; const Jimp = require('jimp'); +console.log(5,"loaded dependencies") + const router = express.Router(); const app = express(); -const csrfProtection = csurf({ cookie: true }) - const HASHES_DB = config.cookies.server_hashes const HASHES_COOKIE = config.cookies.client_hashes const HASHES_DIFF = HASHES_DB - HASHES_COOKIE @@ -320,6 +323,8 @@ function increaseUSERCall(req,res,next) { return true } +console.log(5,"loading routes") + app.use(useragent.express()); app.use(fileUpload()) app.use(bodyParser.json({ limit: "100mb" })); @@ -394,6 +399,8 @@ router.get("/",function(req,res) { res.sendFile(dir+"views/index.html") }) +console.log(5,"finished loading user routes, starting with api routes") + /* START /API/* @@ -1067,6 +1074,8 @@ router.post("/login",async function(req,res) { }); }) +console.log(5,"finished loading routes") + app.use(router) const httpServer = http.createServer(app); @@ -1118,3 +1127,5 @@ wss.on("connection", function connection(ws) { } }) }) + +console.log(5,"starting up all services")