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:
parent
da59af34a2
commit
81b130f5b3
@ -125,6 +125,20 @@ const app = express()
|
|||||||
app.use(loggingMiddleware)
|
app.use(loggingMiddleware)
|
||||||
app.use("/_wf", webFeaturesRouter)
|
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
|
// make sure all responses have a default content-type set
|
||||||
app.use(function (_req, res, next) {
|
app.use(function (_req, res, next) {
|
||||||
res.contentType("text/plain")
|
res.contentType("text/plain")
|
||||||
@ -136,18 +150,6 @@ if (getFlag("loadoutSaving") === "PROFILES") {
|
|||||||
app.use("/loadouts", loadoutRouter)
|
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(
|
app.get(
|
||||||
"/config/:audience/:serverVersion(\\d+_\\d+_\\d+)",
|
"/config/:audience/:serverVersion(\\d+_\\d+_\\d+)",
|
||||||
(req: RequestWithJwt<{ issuer: string }>, res) => {
|
(req: RequestWithJwt<{ issuer: string }>, res) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user