Skip to content

Commit

Permalink
Merge branch 'release/1.0.0' into feature/identicon
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Sep 26, 2022
2 parents f3c9e10 + 0f3582d commit e7f7ccc
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.io.PrintWriter;

/**
* Replaces occurences of <code>/%hub.public-root-path%/</code> with the corresponding configuration value.
* Replaces occurences of <code>&lt;base href="/"&gt;</code> with the corresponding configuration value from <code>hub.public-root-path</code>.
*/
public class FrontendRootPathFilter extends HttpFilter {

Expand All @@ -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("<base href=\"/\"/>", "<base href=\"%s\"/>".formatted(publicRootPath.get()));
res.setContentLength(replacedContent.length());
res.getWriter().write(replacedContent);
res.getWriter().flush();
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/resources/META-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<filter-name>rootPathFilter</filter-name>
<url-pattern>/index.html</url-pattern>
<url-pattern>/app/*</url-pattern>
<url-pattern>/assets/*</url-pattern>
<url-pattern>/</url-pattern>
</filter-mapping>

<filter>
Expand Down
1 change: 1 addition & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/"/>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/common/config.ts
Original file line number Diff line number Diff line change
@@ -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/`;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<span class="text-sm font-semibold">{{ me.name }}</span>
</div>
<div v-for="(itemGroup, index) in profileDropdown" :key="`itemGroup-${index}`" class="px-3.5 py-1.5">
<router-link v-for="item in itemGroup" :key="item.name" v-slot="{ href, navigate }" :to="item.to" >
<MenuItem v-slot="{ active }" :href="href" @click="navigate">
<router-link v-for="item in itemGroup" :key="item.name" v-slot="{ navigate }" :to="item.to" >
<MenuItem v-slot="{ active }" @click="navigate">
<div :class="[active ? 'text-primary' : '', 'flex items-center py-1.5 text-sm text-gray-700']">
<component :is="item.icon" :class="[active ? 'text-primary' : '', 'flex-none h-5 w-5 text-gray-400 mr-3']" aria-hidden="true" />
{{ t(item.name) }}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/css/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 16 additions & 3 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,28 @@ import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
base: '/',
base: './', // we use a <base href="/"/> 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: {
Expand Down

0 comments on commit e7f7ccc

Please sign in to comment.