1
mirror of https://github.com/thepeacockproject/Peacock synced 2024-11-29 09:15:11 +01:00

fix(webui): fixing content type that broke webui (#43)

This commit is contained in:
Alexandre Sanchez 2022-11-28 03:35:34 +01:00 committed by GitHub
parent da59af34a2
commit 81b130f5b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,6 +125,20 @@ const app = express()
app.use(loggingMiddleware)
app.use("/_wf", webFeaturesRouter)
app.get("/", (req: Request, res) => {
if (PEACOCK_DEV) {
res.send("dev active, you need to access the UI from port 3000")
} else {
const data = readFileSync("webui/dist/index.html").toString()
res.contentType("text/html")
res.send(data)
}
})
serveStatic.mime.define({ "application/javascript": ["js"] })
app.use("/assets", serveStatic("webui/dist/assets"))
// make sure all responses have a default content-type set
app.use(function (_req, res, next) {
res.contentType("text/plain")
@ -136,18 +150,6 @@ if (getFlag("loadoutSaving") === "PROFILES") {
app.use("/loadouts", loadoutRouter)
}
app.get("/", (req: Request, res) => {
if (PEACOCK_DEV) {
res.send("dev active, you need to access the UI from port 3000")
} else {
const data = readFileSync("webui/dist/index.html").toString()
res.send(data)
}
})
app.use("/assets", serveStatic("webui/dist/assets"))
app.get(
"/config/:audience/:serverVersion(\\d+_\\d+_\\d+)",
(req: RequestWithJwt<{ issuer: string }>, res) => {