From dc20d55be66b86e654e6b4da39ebecb8c09ad176 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 20 May 2025 15:48:02 +0200 Subject: [PATCH] fix(desktop): use app.use to serve frontend files This fix avoids route patterns and instead uses a middleware to serve frontend files in express. The route pattern was causing errors in the path-to-regexp package used by express. Resolves https://github.com/go-vikunja/vikunja/issues/687 Resolves https://community.vikunja.io/t/the-state-of-the-windows-desktop-app/3618/4 --- desktop/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index d3978dbd9..27c107620 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -35,9 +35,9 @@ function createWindow() { // Start a local express server to serve static files eApp.use(express.static(path.join(__dirname, frontendPath))) - // Handle urls set by the frontend - eApp.get('*', (request, response, next) => { - response.sendFile(`${__dirname}/${frontendPath}index.html`); + // Handle urls set by the frontend - use app.use as catch-all instead of route pattern + eApp.use((request, response) => { + response.sendFile(path.join(__dirname, frontendPath, 'index.html')) }) const server = eApp.listen(port, '127.0.0.1', () => { console.log(`Server started on port ${server.address().port}`)