Skip to content

Commit

Permalink
fix(webui): refreshing when not on / would result in 404
Browse files Browse the repository at this point in the history
  • Loading branch information
bambanah committed Sep 13, 2024
1 parent 74bbed2 commit 39fe590
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-walls-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"deemix-webui": patch
---

Fix refreshing when not on homepage causing 404
1 change: 1 addition & 0 deletions webui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build:2-server": "tsc --build src/server/tsconfig.json",
"build:3-aliases": "tsc-alias -p src/server/tsconfig.json",
"build:4-version": "genversion -fe dist/helpers/web-version.js",
"start": "cross-env NODE_ENV=production node dist/main.js",
"test": "jest",
"test-watch": "jest --watch",
"testlang": "node ./tests/testlang.js",
Expand Down
3 changes: 3 additions & 0 deletions webui/src/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ const wss = new WebSocketServer({ server });
if (process.env.NODE_ENV === "production") {
const publicPath = join(dirname(fileURLToPath(import.meta.url)), "public");
app.use(express.static(publicPath));
app.get("*", (_, res) => {
res.sendFile(join(publicPath, "index.html"));
});
} else {
ViteExpress.bind(app, server);
}
Expand Down

0 comments on commit 39fe590

Please sign in to comment.