Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webui): refreshing when not on / would result in 404 #92

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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