Headers, endpoints, preparing for dashboard

This commit is contained in:
bingus_violet 2024-01-16 18:46:34 +00:00
parent e4de5a91ee
commit a61b5aab79
2 changed files with 15 additions and 2 deletions

View file

@ -18,15 +18,24 @@ if (!directory) {
return return
} }
app.use(express.static(directory)) app.use('/b', express.static(directory))
app.listen(PORT, () => { app.listen(PORT, () => {
console.log("Now listening on PORT: " + 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 file = req.params[0]
var absPath = path.join(directory, file) var absPath = path.join(directory, file)
res.setHeader('Content-Type', 'text/html')
try { try {
var dirContents = fs.readdirSync(absPath) var dirContents = fs.readdirSync(absPath)
} catch (error) { } catch (error) {
@ -47,3 +56,7 @@ app.get("/*", (req, res) => {
res.end() res.end()
}) })
app.get("/", (req, res) => {
res.redirect("/b")
})

0
resources/dashboard.html Normal file
View file