mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-22 05:46:26 -08:00
1.1.4 - also not really a patch, but whatever
This commit is contained in:
parent
362f1a158f
commit
240d12d887
11
src/index.ts
11
src/index.ts
|
@ -12,7 +12,8 @@ let app = express()
|
||||||
|
|
||||||
const multerSetup = multer({storage:memoryStorage()})
|
const multerSetup = multer({storage:memoryStorage()})
|
||||||
|
|
||||||
let config = require("../config.json")
|
let config = require(`${process.cwd()}/config.json`)
|
||||||
|
app.use("/static",express.static("assets"))
|
||||||
app.use(bodyParser.text({limit:(config.maxDiscordFileSize*config.maxDiscordFiles)+1048576,type:["application/json","text/plain"]}))
|
app.use(bodyParser.text({limit:(config.maxDiscordFileSize*config.maxDiscordFiles)+1048576,type:["application/json","text/plain"]}))
|
||||||
let files:{[key:string]:{filename:string,mime:string,messageids:string[]}} = {}
|
let files:{[key:string]:{filename:string,mime:string,messageids:string[]}} = {}
|
||||||
|
|
||||||
|
@ -146,7 +147,7 @@ app.get("/download/:fileId",(req,res) => {
|
||||||
res.send(buf.toString().replace(/\$FileName/g,file.filename).replace(/\$FileId/g,req.params.fileId).replace(/\$Version/g,pkg.version))
|
res.send(buf.toString().replace(/\$FileName/g,file.filename).replace(/\$FileId/g,req.params.fileId).replace(/\$Version/g,pkg.version))
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ThrowError(res,404,"File not found. <a href=\"javascript:history.back()\">Back</a> <a href=\"/\">Home</a>")
|
ThrowError(res,404,"File not found.")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -182,8 +183,12 @@ app.get("/file/:fileId",async (req,res) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.get("/server",(req,res) => {
|
||||||
|
res.send(JSON.stringify({...config,version:pkg.version}))
|
||||||
|
})
|
||||||
|
|
||||||
app.get("*",(req,res) => {
|
app.get("*",(req,res) => {
|
||||||
ThrowError(res,404,"Page not found. <a href=\"javascript:history.back()\">Back</a> <a href=\"/\">Home</a>")
|
ThrowError(res,404,"Page not found.")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue