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 }} - - + + {{ t(item.name) }} diff --git a/frontend/src/css/fonts.css b/frontend/src/css/fonts.css index ec0b1f25..3e37edbd 100644 --- a/frontend/src/css/fonts.css +++ b/frontend/src/css/fonts.css @@ -12,7 +12,7 @@ font-style: normal; font-weight: 400; font-display: swap; - src: local('Open Sans Regular'), local('OpenSans-Regular'), url('/fonts/opensans-regular.reduced.woff2') format('woff2'); + src: local('Open Sans Regular'), local('OpenSans-Regular'), url('../fonts/opensans-regular.reduced.woff2') format('woff2'); unicode-range: U+0020-007F,U+00C4,U+00E4,U+00D6,U+00F6,U+00DC,U+00FC,U+00DF,U+20AC; } @@ -25,7 +25,7 @@ font-style: normal; font-weight: 400; font-display: swap; - src: url('/fonts/quicksand-regular.reduced.woff2') format('woff2'); + src: url('../fonts/quicksand-regular.reduced.woff2') format('woff2'); unicode-range: U+0020-007F,U+00C4,U+00E4,U+00D6,U+00F6,U+00DC,U+00FC,U+00DF,U+20AC; } @@ -38,7 +38,7 @@ font-style: normal; font-weight: 500; font-display: swap; - src: url('/fonts/quicksand-medium.reduced.woff2') format('woff2'); + src: url('../fonts/quicksand-medium.reduced.woff2') format('woff2'); unicode-range: U+0020-007F,U+00C4,U+00E4,U+00D6,U+00F6,U+00DC,U+00FC,U+00DF,U+20AC; } @@ -51,6 +51,6 @@ font-style: normal; font-weight: 700; font-display: swap; - src: url('/fonts/quicksand-bold.reduced.woff2') format('woff2'); + src: url('../fonts/quicksand-bold.reduced.woff2') format('woff2'); unicode-range: U+0043,U+0052,U+0059,U+0050,U+0054,U+004F,U+004D,U+0041,U+0020,U+0048,U+0055,U+0042; } diff --git a/frontend/public/fonts/OFL.txt b/frontend/src/fonts/OFL.txt similarity index 100% rename from frontend/public/fonts/OFL.txt rename to frontend/src/fonts/OFL.txt diff --git a/frontend/public/fonts/opensans-regular.reduced.woff2 b/frontend/src/fonts/opensans-regular.reduced.woff2 similarity index 100% rename from frontend/public/fonts/opensans-regular.reduced.woff2 rename to frontend/src/fonts/opensans-regular.reduced.woff2 diff --git a/frontend/public/fonts/opensans-regular.woff2 b/frontend/src/fonts/opensans-regular.woff2 similarity index 100% rename from frontend/public/fonts/opensans-regular.woff2 rename to frontend/src/fonts/opensans-regular.woff2 diff --git a/frontend/public/fonts/quicksand-bold.reduced.woff2 b/frontend/src/fonts/quicksand-bold.reduced.woff2 similarity index 100% rename from frontend/public/fonts/quicksand-bold.reduced.woff2 rename to frontend/src/fonts/quicksand-bold.reduced.woff2 diff --git a/frontend/public/fonts/quicksand-bold.woff2 b/frontend/src/fonts/quicksand-bold.woff2 similarity index 100% rename from frontend/public/fonts/quicksand-bold.woff2 rename to frontend/src/fonts/quicksand-bold.woff2 diff --git a/frontend/public/fonts/quicksand-medium.reduced.woff2 b/frontend/src/fonts/quicksand-medium.reduced.woff2 similarity index 100% rename from frontend/public/fonts/quicksand-medium.reduced.woff2 rename to frontend/src/fonts/quicksand-medium.reduced.woff2 diff --git a/frontend/public/fonts/quicksand-medium.woff2 b/frontend/src/fonts/quicksand-medium.woff2 similarity index 100% rename from frontend/public/fonts/quicksand-medium.woff2 rename to frontend/src/fonts/quicksand-medium.woff2 diff --git a/frontend/public/fonts/quicksand-regular.reduced.woff2 b/frontend/src/fonts/quicksand-regular.reduced.woff2 similarity index 100% rename from frontend/public/fonts/quicksand-regular.reduced.woff2 rename to frontend/src/fonts/quicksand-regular.reduced.woff2 diff --git a/frontend/public/fonts/quicksand-regular.woff2 b/frontend/src/fonts/quicksand-regular.woff2 similarity index 100% rename from frontend/public/fonts/quicksand-regular.woff2 rename to frontend/src/fonts/quicksand-regular.woff2 diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 70c4b68f..84a8a2f8 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -6,15 +6,28 @@ import { defineConfig } from 'vite'; // https://vitejs.dev/config/ export default defineConfig({ - base: '/', + base: './', // we use a tag, which all other urls need to be relative to plugins: [ vue(), vueI18n({ include: path.resolve(__dirname, './src/i18n/*.json') - })], + }), + ], build: { minify: 'esbuild', - target: 'esnext' + target: 'esnext', + assetsInlineLimit: 0, + rollupOptions: { + output: { + manualChunks: (id: string) => { + if (id.includes('node_modules')) { + return 'vendor'; + } else { + return 'main'; + } + } + } + } }, server: { proxy: {
/%hub.public-root-path%/
<base href="/">
hub.public-root-path