diff --git a/backend/src/main/java/org/cryptomator/hub/filters/FrontendRootPathFilter.java b/backend/src/main/java/org/cryptomator/hub/filters/FrontendRootPathFilter.java index f3d997bf..a2076653 100644 --- a/backend/src/main/java/org/cryptomator/hub/filters/FrontendRootPathFilter.java +++ b/backend/src/main/java/org/cryptomator/hub/filters/FrontendRootPathFilter.java @@ -18,7 +18,7 @@ import java.io.PrintWriter; /** - * Replaces occurences of /%hub.public-root-path%/ with the corresponding configuration value. + * Replaces occurences of <base href="/"> with the corresponding configuration value from hub.public-root-path. */ public class FrontendRootPathFilter extends HttpFilter { @@ -31,7 +31,7 @@ protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterC var capturedResponse = new CapturingResponseWrapper(res); chain.doFilter(req, capturedResponse); String content = capturedResponse.getCaptureAsString(); // This uses response character encoding. - String replacedContent = content.replace("/%hub.public-root-path%/", publicRootPath.get()); + String replacedContent = content.replace("", "".formatted(publicRootPath.get())); res.setContentLength(replacedContent.length()); res.getWriter().write(replacedContent); res.getWriter().flush(); diff --git a/backend/src/main/resources/META-INF/web.xml b/backend/src/main/resources/META-INF/web.xml index cb390314..23a87349 100644 --- a/backend/src/main/resources/META-INF/web.xml +++ b/backend/src/main/resources/META-INF/web.xml @@ -13,7 +13,7 @@ rootPathFilter /index.html /app/* - /assets/* + / diff --git a/frontend/index.html b/frontend/index.html index 70391303..f71ff158 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,6 +1,7 @@ + diff --git a/frontend/package.json b/frontend/package.json index d4deb27d..f9c9a16e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,7 +12,7 @@ "lint": "eslint -c .eslintrc.js", "test": "nyc --reporter lcov mocha -r ts-node/register test/**/*.spec.ts", "serve": "vite preview", - "dist": "vite build --sourcemap --base=\"/%hub.public-root-path%/\" --outDir=\"../backend/src/main/resources/META-INF/resources\" --emptyOutDir" + "dist": "vite build --sourcemap --outDir=\"../backend/src/main/resources/META-INF/resources\" --emptyOutDir" }, "directories": { "src": "./src", diff --git a/frontend/src/common/config.ts b/frontend/src/common/config.ts index 9da60746..956f503a 100644 --- a/frontend/src/common/config.ts +++ b/frontend/src/common/config.ts @@ -1,7 +1,7 @@ import AxiosStatic from 'axios'; // these URLs must end on '/': -export const baseURL = import.meta.env.BASE_URL; +export const baseURL = new URL(document.baseURI).pathname; export const frontendBaseURL = `${baseURL}app/`; export const absFrontendBaseURL = `${location.origin}${frontendBaseURL}`; export const backendBaseURL = `${baseURL}api/`; diff --git a/frontend/src/components/Navbar.vue b/frontend/src/components/Navbar.vue index f8c6a545..5f8c22fe 100644 --- a/frontend/src/components/Navbar.vue +++ b/frontend/src/components/Navbar.vue @@ -40,8 +40,8 @@ {{ me.name }}
- - + +