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
}
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")
})

0
resources/dashboard.html Normal file
View file