diff --git a/public/config.json b/public/config.json index e89a2f4..1c24583 100644 --- a/public/config.json +++ b/public/config.json @@ -1,5 +1,5 @@ { - "apiBaseURL": "http://coder.local.merr.is:3001", + "apiBaseURL": "http://coder.local.merr.is:3000", "oidcAuthority": "https://auth.joes.moosenet.work", "oidcClientID": "255988227184328707@isekai:_slow_life_calculator", "oidcProjectID": "255987963094106115" diff --git a/src/components/GlobalHeader.vue b/src/components/GlobalHeader.vue index 4ae83ce..fd1edfb 100644 --- a/src/components/GlobalHeader.vue +++ b/src/components/GlobalHeader.vue @@ -1,22 +1,7 @@ diff --git a/src/main.ts b/src/main.ts index 4ece5fa..18da9f9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -24,7 +24,7 @@ const vuetify = createVuetify({ }) getConfig().then((conf: Config | null) => { - configureOidc().then((oidcAuth) => { + configureOidc().then((authentikAuth) => { if (conf === null) { throw new Error('config was null') } @@ -32,9 +32,9 @@ getConfig().then((conf: Config | null) => { app.provide(apiBaseURL, conf.apiBaseURL) - oidcAuth.startup().then((ok: boolean) => { + authentikAuth.startup().then((ok: boolean) => { if (ok) { - app.provide(oidc, oidcAuth) + app.provide(oidc, authentikAuth) const pinia = createPinia() diff --git a/src/router/index.ts b/src/router/index.ts index daa4c0d..0836a91 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,7 +1,6 @@ import { configureOidc } from '@/services/authentikAuth' import { getConfig } from '@/services/siteConfig' import type { Config } from '@/types/Config' -import { LOGIN_RETURN_URL_STORAGE } from '@/types/ConfigSymbols' import type { OidcAuth } from 'vue-oidc-client/vue3' import { createRouter, createWebHistory } from 'vue-router' @@ -35,43 +34,30 @@ const router = createRouter({ path: '/intimacy-power', name: 'intimacy-power', component: () => import('@/views/IntimacyPowerView.vue') - }, - { - path: '/test', - name: 'test', - component: () => - hasRole('admin') ? import('@/views/TestView.vue') : import('@/views/NoAccess.vue') - }, - - { - path: '/login', - name: 'login', - meta: { - authName: oidcAuth.authName - }, - component: () => import('@/views/LoginView.vue') - }, - { - path: '/admin', - name: 'admin', - meta: { - authName: oidcAuth.authName - }, - component: () => - hasRole('admin') ? import('@/views/Admin.vue') : import('@/views/NoAccess.vue') - }, - { - path: '/postLogin', - name: 'postLogin', - redirect: () => { - let redirectUrl = sessionStorage.getItem(LOGIN_RETURN_URL_STORAGE) - if (redirectUrl === "" || redirectUrl === null) { - redirectUrl = "/" - } - sessionStorage.removeItem(LOGIN_RETURN_URL_STORAGE) - return { path: redirectUrl } - } } + // { + // path: '/test', + // name: 'test', + // component: () => import('@/views/TestView.vue') + // }, + + // { + // path: '/login', + // name: 'login', + // meta: { + // authName: oidcAuth.authName + // }, + // component: () => import('@/views/LoginView.vue') + // }, + // { + // path: '/admin', + // name: 'admin', + // meta: { + // authName: oidcAuth.authName + // }, + // component: () => + // hasRole('admin') ? import('@/views/Admin.vue') : import('@/views/NoAccess.vue') + // } ] }) diff --git a/src/stores/general.ts b/src/stores/general.ts deleted file mode 100644 index 945062e..0000000 --- a/src/stores/general.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineStore } from 'pinia' -import { ref } from 'vue' - -export const useGeneralState = defineStore('general', () => { - const LOGIN_RETURN_URL_STORAGE = 'LOGIN_RETURN_URL_STORAGE' - - const loginReturnUrl = ref("") - - function setLoginReturnUrl(url: string) { - loginReturnUrl.value = url - localStorage.setItem( - LOGIN_RETURN_URL_STORAGE, - loginReturnUrl.value, - ) - } - - function getLoginReturnUrl(): string { - const storedUrl = localStorage.getItem(LOGIN_RETURN_URL_STORAGE) - if (storedUrl === null || storedUrl === undefined || storedUrl === "") { - localStorage.removeItem(LOGIN_RETURN_URL_STORAGE) - const res = loginReturnUrl.value - loginReturnUrl.value == null - return res - } - localStorage.removeItem(LOGIN_RETURN_URL_STORAGE) - loginReturnUrl.value == null - return storedUrl - } - - return { - setLoginReturnUrl, - getLoginReturnUrl - } -}) \ No newline at end of file diff --git a/src/stores/powerItems.ts b/src/stores/powerItems.ts index d2c25c1..c35a8a1 100644 --- a/src/stores/powerItems.ts +++ b/src/stores/powerItems.ts @@ -5,8 +5,6 @@ import { computed, ref, toRaw } from 'vue' import axiosRetry from 'axios-retry' import { apiBaseURL as apiBaseURLKey } from '@/types/ConfigSymbols' import { inject } from 'vue' -import { getConfig } from '@/services/siteConfig' -import type { Config } from '@/types/Config' const BLESSING = 1 const INTIMACY = 2 @@ -26,14 +24,7 @@ export const usePowerItems = defineStore('powerItems', () => { const BLESSING_POWER_ITEM_STORAGE = 'BLESSING_POWER_ITEM_STORAGE' const FELLOW_POWER_ITEM_STORAGE = 'FELLOW_POWER_ITEM_STORAGE' const INTIMACY_POWER_ITEM_STORAGE = 'INTIMACY_POWER_ITEM_STORAGE' - let apiBaseURL = inject(apiBaseURLKey)! - if (apiBaseURL === undefined) { - getConfig().then((conf: Config | null) => { - if (conf !== null) { - apiBaseURL = conf.apiBaseURL - } - }) - } + const apiBaseURL = inject(apiBaseURLKey)! //#endregion //#region state @@ -41,7 +32,7 @@ export const usePowerItems = defineStore('powerItems', () => { const fellowPowerItems = ref(new Map()) const intimacyPowerItems = ref(new Map()) //#endregion - + axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay diff --git a/src/types/ConfigSymbols.ts b/src/types/ConfigSymbols.ts index 0b9c80c..3d00a04 100644 --- a/src/types/ConfigSymbols.ts +++ b/src/types/ConfigSymbols.ts @@ -5,11 +5,8 @@ const apiBaseURL = Symbol() as InjectionKey const oidcProjectID = Symbol() as InjectionKey const oidc = Symbol() as InjectionKey -const LOGIN_RETURN_URL_STORAGE = "LOGIN_RETURN_URL_STORAGE" - export { apiBaseURL, oidcProjectID, - oidc, - LOGIN_RETURN_URL_STORAGE + oidc } \ No newline at end of file diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue index f0fe530..93d3724 100644 --- a/src/views/LoginView.vue +++ b/src/views/LoginView.vue @@ -27,37 +27,37 @@ } } + diff --git a/src/views/PostLoginView.vue b/src/views/PostLoginView.vue deleted file mode 100644 index 3f9cbf3..0000000 --- a/src/views/PostLoginView.vue +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/src/views/TestView.vue b/src/views/TestView.vue index b5b51fd..2da0bb4 100644 --- a/src/views/TestView.vue +++ b/src/views/TestView.vue @@ -1,5 +1,6 @@