From a61b5aab79376a3a31e815c7cd29bdc566ebdca1 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Tue, 16 Jan 2024 18:46:34 +0000 Subject: [PATCH] Headers, endpoints, preparing for dashboard --- index.js | 17 +++++++++++++++-- resources/dashboard.html | 0 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 resources/dashboard.html diff --git a/index.js b/index.js index ab04f12..8e54695 100644 --- a/index.js +++ b/index.js @@ -18,15 +18,24 @@ if (!directory) { return } -app.use(express.static(directory)) +app.use('/b', express.static(directory)) app.listen(PORT, () => { console.log("Now listening on PORT: " + PORT) + + if (!passwd) { + console.log("Password variable not found. Uploading from site is not available.") + } else { + console.log("Password variable found! Uploads are now available on the site.") + } }) -app.get("/*", (req, res) => { +app.get("/b*", (req, res) => { var file = req.params[0] var absPath = path.join(directory, file) + + res.setHeader('Content-Type', 'text/html') + try { var dirContents = fs.readdirSync(absPath) } catch (error) { @@ -46,4 +55,8 @@ app.get("/*", (req, res) => { res.write(baseEnd) res.end() +}) + +app.get("/", (req, res) => { + res.redirect("/b") }) \ No newline at end of file diff --git a/resources/dashboard.html b/resources/dashboard.html new file mode 100644 index 0000000..e69de29