diff --git a/client/nuxt.config.ts b/client/nuxt.config.ts index 090c9de..d9e29d1 100644 --- a/client/nuxt.config.ts +++ b/client/nuxt.config.ts @@ -13,4 +13,15 @@ export default defineNuxtConfig({ app: { baseURL: '/__nuxt-oidc-auth', }, + unocss: { + shortcuts: { + // General Tokens + 'bg-base': 'n-bg-base', + 'bg-active': 'n-bg-active', + 'border-base': 'n-border-base', + 'text-secondary': 'color-black/50 dark:color-white/50', + // Reusable + 'x-divider': 'h-1px w-full bg-gray/15', + } + } }) diff --git a/client/pages/index.vue b/client/pages/index.vue index ead7b80..47a6a50 100644 --- a/client/pages/index.vue +++ b/client/pages/index.vue @@ -10,22 +10,24 @@ export interface OidcConfig { } const devtoolsClient: NuxtDevtoolsIframeClient | null = ref(null) - +const devAuthToken = ref(localStorage.getItem('__nuxt_dev_token__')) const oidcRuntimeConfig = ref() const oidcConfig = ref() const selectedProvider = ref('') const oidcState = ref({}) const clientWindow = computed(() => devtoolsClient.value.host?.app) const oidcSecrets = ref({}) +const isDevAuthed = ref(false) onDevtoolsClientConnected(async (client: NuxtDevtoolsIframeClient) => { // Getting devtools client devtoolsClient.value = client // Settings refs - oidcRuntimeConfig.value = (await devtoolsClient.value.devtools.rpc.getServerRuntimeConfig()).oidc - oidcConfig.value = (await devtoolsClient.value.devtools.rpc.getServerConfig()).oidc + isDevAuthed.value = await devtoolsClient.value.devtools.rpc.verifyAuthToken(devAuthToken.value) + oidcRuntimeConfig.value = isDevAuthed.value ? (await devtoolsClient.value.devtools.rpc.getServerRuntimeConfig()).oidc : {} + oidcConfig.value = isDevAuthed.value ? (await devtoolsClient.value.devtools.rpc.getServerConfig()).oidc : {} oidcState.value = devtoolsClient.value.host.nuxt.payload.state['$snuxt-oidc-auth-session'] || {} - oidcSecrets.value = await devtoolsClient.value.devtools.extendClientRpc('nuxt-oidc-auth-rpc').getNuxtOidcAuthSecrets() + oidcSecrets.value = isDevAuthed.value ? await devtoolsClient.value.devtools.extendClientRpc('nuxt-oidc-auth-rpc').getNuxtOidcAuthSecrets() : {} }) async function login(provider?: string) { @@ -38,8 +40,8 @@ async function logout(provider?: string) {