mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-21 21:36:26 -08:00
rid of pointless functions (thanks jack)
This commit is contained in:
parent
7651cd65ab
commit
6d6f8b1832
|
@ -198,7 +198,15 @@ app.get("/download/:fileId",(req,res) => {
|
|||
}
|
||||
})
|
||||
|
||||
let fgRQH = async (req:express.Request,res:express.Response) => {
|
||||
app.get("/server",(req,res) => {
|
||||
res.send(JSON.stringify({
|
||||
...config,
|
||||
version:pkg.version,
|
||||
files:Object.keys(files.files).length
|
||||
}))
|
||||
})
|
||||
|
||||
app.get(["/file/:fileId", "/cpt/:fileId/*", "/:fileId"],async (req:express.Request,res:express.Response) => {
|
||||
|
||||
let file = files.getFilePointer(req.params.fileId)
|
||||
res.setHeader("Access-Control-Allow-Origin", "*")
|
||||
|
@ -260,10 +268,9 @@ let fgRQH = async (req:express.Request,res:express.Response) => {
|
|||
ServeError(res, 404, "file not found")
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
let fgwh = (req: express.Request, res:express.Response) => {
|
||||
app.head(["/file/:fileId", "/cpt/:fileId/*", "/:fileId"], (req: express.Request, res:express.Response) => {
|
||||
let file = files.getFilePointer(req.params.fileId)
|
||||
res.setHeader("Access-Control-Allow-Origin", "*")
|
||||
if (req.query.attachment == "1") res.setHeader("Content-Disposition", "attachment")
|
||||
|
@ -279,24 +286,8 @@ let fgwh = (req: express.Request, res:express.Response) => {
|
|||
res.setHeader("Accept-Ranges", "bytes")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.get("/server",(req,res) => {
|
||||
res.send(JSON.stringify({
|
||||
...config,
|
||||
version:pkg.version,
|
||||
files:Object.keys(files.files).length
|
||||
}))
|
||||
})
|
||||
|
||||
app.get("/file/:fileId",fgRQH)
|
||||
app.get("/cpt/:fileId/*",fgRQH)
|
||||
app.get("/:fileId",fgRQH)
|
||||
|
||||
app.head("/file/:fileId",fgwh)
|
||||
app.head("/cpt/:fileId/*",fgwh)
|
||||
app.head("/:fileId",fgwh)
|
||||
|
||||
/*
|
||||
routes should be in this order:
|
||||
|
||||
|
|
Loading…
Reference in a new issue