Added about page, cleaned up web config.

This commit is contained in:
Andrew Lalis 2023-01-28 18:48:34 +01:00
parent 75c0fdcff6
commit c7e327ff1e
10 changed files with 60 additions and 9 deletions

View File

@ -13,13 +13,15 @@ import java.util.Arrays;
@Configuration @Configuration
public class WebConfig { public class WebConfig {
@Value("${app.web-origin}")
private String webOrigin;
@Bean @Bean
public CorsFilter corsFilter() { public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
final CorsConfiguration config = new CorsConfiguration(); final CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true); config.setAllowCredentials(true);
// Don't do this in production, use a proper list of allowed origins config.addAllowedOriginPattern(webOrigin);
config.addAllowedOriginPattern("*");
config.setAllowedHeaders(Arrays.asList("Origin", "Content-Type", "Accept")); config.setAllowedHeaders(Arrays.asList("Origin", "Content-Type", "Accept"));
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH")); config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH"));
source.registerCorsConfiguration("/**", config); source.registerCorsConfiguration("/**", config);

View File

@ -8,3 +8,5 @@ spring.jpa.show-sql=false
spring.task.execution.pool.core-size=3 spring.task.execution.pool.core-size=3
spring.task.execution.pool.max-size=10 spring.task.execution.pool.max-size=10
app.web-origin=http://localhost:9000

View File

@ -0,0 +1,28 @@
export default {
mainLayout: {
language: 'Sprache',
pages: 'Seiten',
},
indexPage: {
searchHint: 'Suche nach einem Gym',
},
gymPage: {
home: 'Home',
submit: 'Einreichen',
leaderboard: 'Bestenliste',
homePage: {
overview: 'Überblick über dieses Fitnessstudio:',
recentLifts: 'Letzten Aufzüge'
},
submitPage: {
name: 'Dein Name',
exercise: 'Übung',
weight: 'Gewicht',
reps: 'Wiederholungen',
date: 'Datum',
upload: 'Videodatei zum Hochladen',
submit: 'Einreichen',
},
},
};

View File

@ -1,7 +1,9 @@
import enUS from './en-US'; import enUS from './en-US';
import nlNL from './nl-NL'; import nlNL from './nl-NL';
import de from './de';
export default { export default {
'en-US': enUS, 'en-US': enUS,
'nl-NL': nlNL, 'nl-NL': nlNL,
'de': de,
}; };

View File

@ -41,8 +41,9 @@
<q-item-label header> <q-item-label header>
{{ $t('mainLayout.pages') }} {{ $t('mainLayout.pages') }}
</q-item-label> </q-item-label>
<q-item clickable>Gyms</q-item> <q-item clickable to="/">Gyms</q-item>
<q-item clickable>Global Leaderboard</q-item> <q-item clickable>Global Leaderboard</q-item>
<q-item clickable to="/about">About</q-item>
</q-list> </q-list>
</q-drawer> </q-drawer>
@ -60,6 +61,7 @@ const i18n = useI18n({ useScope: 'global' });
const localeOptions = [ const localeOptions = [
{ value: 'en-US', label: 'English' }, { value: 'en-US', label: 'English' },
{ value: 'nl-NL', label: 'Nederlands' }, { value: 'nl-NL', label: 'Nederlands' },
{ value: 'de', label: 'Deutsch' },
]; ];
const leftDrawerOpen = ref(false); const leftDrawerOpen = ref(false);

View File

@ -0,0 +1,11 @@
<template>
<StandardCenteredPage>
<h3 class="text-center">About Gymboard</h3>
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Error fugit quia laboriosam eaque? Deserunt, accusantium dicta assumenda debitis incidunt eius provident magnam, est quasi officia voluptas, nam neque omnis reiciendis.
</p>
</StandardCenteredPage>
</template>
<script setup lang="ts">
import StandardCenteredPage from 'src/components/StandardCenteredPage.vue';
</script>

View File

@ -1,16 +1,14 @@
<template> <template>
<div <div
class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center" class="fullscreen text-center q-pa-md flex flex-center"
> >
<div> <div>
<div style="font-size: 30vh">404</div> <div style="font-size: 30vh">404</div>
<div class="text-h2" style="opacity: 0.4">Oops. Nothing here...</div> <div class="text-h2" style="opacity: 0.4">Page not found.</div>
<q-btn <q-btn
class="q-mt-xl" class="q-mt-xl"
color="white"
text-color="blue"
unelevated unelevated
to="/" to="/"
label="Go Home" label="Go Home"

View File

@ -1,6 +1,7 @@
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
import MainLayout from 'layouts/MainLayout.vue'; import MainLayout from 'layouts/MainLayout.vue';
import IndexPage from 'pages/IndexPage.vue'; import IndexPage from 'pages/IndexPage.vue';
import AboutPage from 'pages/AboutPage.vue';
import GymPage from 'pages/gym/GymPage.vue'; import GymPage from 'pages/gym/GymPage.vue';
import GymSubmissionPage from 'pages/gym/GymSubmissionPage.vue'; import GymSubmissionPage from 'pages/gym/GymSubmissionPage.vue';
import GymHomePage from 'pages/gym/GymHomePage.vue'; import GymHomePage from 'pages/gym/GymHomePage.vue';
@ -21,6 +22,7 @@ const routes: RouteRecordRaw[] = [
{ path: 'leaderboard', component: GymLeaderboardsPage }, { path: 'leaderboard', component: GymLeaderboardsPage },
], ],
}, },
{ path: 'about', component: AboutPage }
], ],
}, },

View File

@ -1,7 +1,9 @@
package nl.andrewlalis.gymboardsearch.config; package nl.andrewlalis.gymboardsearch.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter; import org.springframework.web.filter.CorsFilter;
@ -10,14 +12,15 @@ import java.util.Arrays;
@Configuration @Configuration
public class WebConfig { public class WebConfig {
@Value("${app.web-origin}")
private String webOrigin;
@Bean @Bean
public CorsFilter corsFilter() { public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
final CorsConfiguration config = new CorsConfiguration(); final CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true); config.setAllowCredentials(true);
// Don't do this in production, use a proper list of allowed origins config.addAllowedOriginPattern(webOrigin);
config.addAllowedOriginPattern("*");
config.setAllowedHeaders(Arrays.asList("Origin", "Content-Type", "Accept")); config.setAllowedHeaders(Arrays.asList("Origin", "Content-Type", "Accept"));
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH")); config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH"));
source.registerCorsConfiguration("/**", config); source.registerCorsConfiguration("/**", config);

View File

@ -1 +1,2 @@
server.port=8081 server.port=8081
app.web-origin=http://localhost:9000