From b8330fc8558fdf07a72c8552a0e86f8f6748bebe Mon Sep 17 00:00:00 2001 From: wukko Date: Sun, 9 Apr 2023 10:42:18 +0600 Subject: [PATCH] minor clean up --- src/cobalt.js | 18 +++++++++--------- src/modules/pageRender/page.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cobalt.js b/src/cobalt.js index 8e65b08..b0f0a33 100644 --- a/src/cobalt.js +++ b/src/cobalt.js @@ -21,15 +21,15 @@ import { changelogHistory } from "./modules/pageRender/onDemand.js"; import { sha256 } from "./modules/sub/crypto.js"; import findRendered from "./modules/pageRender/findRendered.js"; -const commitHash = shortCommit(); -const branch = getCurrentBranch(); -const app = express(); - -const corsConfig = process.env.cors === '0' ? { origin: process.env.selfURL, optionsSuccessStatus: 200 } : {}; - -app.disable('x-powered-by'); - if (process.env.selfURL && process.env.streamSalt && process.env.port) { + const commitHash = shortCommit(); + const branch = getCurrentBranch(); + const app = express(); + + app.disable('x-powered-by'); + + const corsConfig = process.env.cors === '0' ? { origin: process.env.selfURL, optionsSuccessStatus: 200 } : {}; + const apiLimiter = rateLimit({ windowMs: 60000, max: 25, @@ -64,7 +64,7 @@ if (process.env.selfURL && process.env.streamSalt && process.env.port) { app.use('/', express.static('./src/front')); app.use((req, res, next) => { - try { decodeURIComponent(req.path) } catch (e) { return res.redirect(process.env.selfURL) } + try { decodeURIComponent(req.path) } catch (e) { return res.redirect('/') } next(); }); app.use((req, res, next) => { diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js index 2576de4..b8e0a40 100644 --- a/src/modules/pageRender/page.js +++ b/src/modules/pageRender/page.js @@ -51,7 +51,7 @@ export default function(obj) { - +