refactor: drop sub-directory routing

This commit is contained in:
Philipp Dormann 2024-12-02 16:47:07 +01:00
parent 595735ad00
commit 4bcbc67436
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314
8 changed files with 26 additions and 62 deletions

View File

@ -6,8 +6,4 @@ runner selfservice portal
- copy the `/public/env.sample.js` file to `/public/env.js`
- set the required environment variables
- `documentserver_key`: url to the [document server](https://git.odit.services/lfk/document-server) instance
- `baseurl`: url to the main lfk instance - WITH TRAILING SLASH
- see [@lfk/deployment](https://git.odit.services/lfk/deployment) for a complete deployment guide
- `baseurl_selfservice`: location of the selfservice instance - WITH TRAILING SLASH
- e.g. path: `/selfservice/`
- e.g. url: `https://example.com/selfservice/`
- `baseurl`: url to the main lfk instance - WITH TRAILING SLASH

View File

@ -3,14 +3,12 @@ const config = {
documentserver_key: '',
// required, with trailing slash
baseurl: '',
// optional, will fallback to /selfservice/
baseurl_selfservice: '/selfservice/',
// full url (including fqdn)
baseurl_documentserver: 'http://localhost:4010/documents',
// optional, will fallback to code128
code_format: 'ean13',
// optional, will fallback to baseurl_selfservice/imprint
// optional, will fallback to /imprint
url_imprint: '',
// optional, will fallback to baseurl_selfservice/privacy
// optional, will fallback to /privacy
url_privacy: '',
};

View File

@ -1,29 +0,0 @@
<template>
<section class="container px-4 py-32 mx-auto">
<div class="w-full mx-auto lg:w-1/3">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="h-20 feather feather-alert-triangle"
viewBox="0 0 24 24"
>
<path
d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01"
/>
</svg>
<p
class="mt-5 mb-3 text-xl font-bold text-black dark:text-gray-50 md:text-2xl"
>{{ $t('configuration_error') }}</p>
<p class="mb-3 text-base font-medium text-gray-700 dark:text-gray-400">
{{ $t('the_system_is_not_properly_configured_please_contact_the_system_administrator_for_help') }}
<br />
<br />
{{ $t('if_you_are_the_system_administrator_please_refer_to_the_official_product_documentation_readme_for_configuration_guidance') }}
</p>
</div>
</section>
</template>

View File

@ -19,8 +19,8 @@
export default {
data() {
return {
imprint_url: config.url_imprint || config.baseurl_selfservice + "imprint"
, privacy_url: config.url_privacy || config.baseurl_selfservice + "privacy"
imprint_url: config.url_imprint || "/imprint"
, privacy_url: config.url_privacy || "/privacy"
}
},
}

View File

@ -1,24 +1,23 @@
// import EnvError from './components/EnvError.vue';
import Home from './views/Home.vue';
import Imprint from './views/Imprint.vue';
import Privacy from './views/Privacy.vue';
import Register from './views/Register.vue';
import Profile from './views/Profile.vue';
import ProfileNone from './views/ProfileNone.vue';
import Home from "./views/Home.vue";
import Imprint from "./views/Imprint.vue";
import Privacy from "./views/Privacy.vue";
import Register from "./views/Register.vue";
import Profile from "./views/Profile.vue";
import ProfileNone from "./views/ProfileNone.vue";
console.log(config);
/** @type {import('vue-router').RouterOptions['routes']} */
export const routes = [
{ path: config.baseurl_selfservice + '', component: Home },
{ path: config.baseurl_selfservice + 'imprint', component: Imprint },
{ path: config.baseurl_selfservice + 'imprint/', component: Imprint },
{ path: config.baseurl_selfservice + 'privacy', component: Privacy },
{ path: config.baseurl_selfservice + 'privacy/', component: Privacy },
{ path: config.baseurl_selfservice + 'register', component: Register },
{ path: config.baseurl_selfservice + 'register/', component: Register },
{ path: config.baseurl_selfservice + 'register/:token', component: Register, props: true },
{ path: config.baseurl_selfservice + 'profile', component: Profile },
{ path: config.baseurl_selfservice + 'profile/', component: ProfileNone },
{ path: config.baseurl_selfservice + 'profile/:token', component: Profile, props: true }
{ path: "/", component: Home },
{ path: "/imprint", component: Imprint },
{ path: "/imprint/", component: Imprint },
{ path: "/privacy", component: Privacy },
{ path: "/privacy/", component: Privacy },
{ path: "/register", component: Register },
{ path: "/register/", component: Register },
{ path: "/register/:token", component: Register, props: true },
{ path: "/profile", component: Profile },
{ path: "/profile/", component: ProfileNone },
{ path: "/profile/:token", component: Profile, props: true },
];

View File

@ -11,8 +11,8 @@
Selfservice Portal</h2>
<p class="px-0 mb-6 text-md lg:px-24 font-medium">{{ $t('main_page_text') }}</p>
<a class="w-full block mx-auto md:w-3/4 px-6 py-3 border border-transparent text-base font-semibold rounded-md text-gray-900 bg-white shadow-sm hover:text-gray-600 focus:outline-none focus:text-gray-600 xl:text-lg xl:py-4"
href="/selfservice/register/">{{ $t('register_now') }}</a>
<a href="/selfservice/profile/"
href="/register/">{{ $t('register_now') }}</a>
<a href="/profile/"
class="md:mt-4 mt-2 w-full block mx-auto md:w-3/4 px-6 py-3 text-base font-semibold rounded-md bg-gray-800 shadow-sm hover:bg-gray-700 focus:outline-none focus:bg-gray-700 xl:text-lg xl:py-4 border border-gray-400">{{
$t('view_my_data') }}</a>
</div>

View File

@ -576,7 +576,7 @@ function delete_me() {
.then(() => {
toast.clear();
toast(t('alle_daten_geloescht'));
location.replace(`${config.baseurl_selfservice}`);
location.replace(`/`);
})
.catch((error) => {
toast.clear();

View File

@ -48,7 +48,7 @@
</div>
</div>
<div class="mt-2">
<a href="/selfservice/register/"
<a href="/register/"
class="text-white block w-full text-center py-2 px-3 border-2 border-gray-300 rounded-md p-1 bg-blue-800 font-medium hover:border-gray-400 focus:outline-none focus:border-gray-400 sm:text-sm">{{
$t('register_now_small') }}</a>
</div>