mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-25 15:06: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)
|
let file = files.getFilePointer(req.params.fileId)
|
||||||
res.setHeader("Access-Control-Allow-Origin", "*")
|
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")
|
ServeError(res, 404, "file not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
}
|
app.head(["/file/:fileId", "/cpt/:fileId/*", "/:fileId"], (req: express.Request, res:express.Response) => {
|
||||||
|
|
||||||
let fgwh = (req: express.Request, res:express.Response) => {
|
|
||||||
let file = files.getFilePointer(req.params.fileId)
|
let file = files.getFilePointer(req.params.fileId)
|
||||||
res.setHeader("Access-Control-Allow-Origin", "*")
|
res.setHeader("Access-Control-Allow-Origin", "*")
|
||||||
if (req.query.attachment == "1") res.setHeader("Content-Disposition", "attachment")
|
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")
|
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:
|
routes should be in this order:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue