feat(webui): scope cookies to the instance and show non-default instance names
This commit is contained in:
14 files changed
+89
-53
No files matched your search
+2
-2
@@ -20,9 +20,9 @@ const route = useRoute();
|
||||
const workflowsPage = computed(() => route.path === "/workflows");
|
||||
const hidden = computed(() => hiddenPaths(session.sections));
|
||||
const main = ref<HTMLElement | null>(null);
|
||||
watch(() => route.path, () => {
|
||||
watch(() => [route.path, accounts.instance], () => {
|
||||
const scope = route.meta.org ? "Organisation" : route.meta.settings ? "Instance" : "";
|
||||
document.title = [route.meta.label || "Page not found", scope, "Archie"].filter(Boolean).join(" | ");
|
||||
document.title = [route.meta.label || "Page not found", scope, "Archie", accounts.instance].filter(Boolean).join(" | ");
|
||||
}, { immediate: true });
|
||||
watch(() => route.path, async () => {
|
||||
await nextTick();
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { api } from "@/lib/api";
|
||||
|
||||
export interface AccountUser {id:string;display_name:string;kind:string}
|
||||
interface AuthStatus {setup_required:boolean;user:AccountUser|null;oidc:boolean;public_url:string}
|
||||
interface AuthStatus {setup_required:boolean;user:AccountUser|null;oidc:boolean;public_url:string;instance?:string}
|
||||
export const useAccountsStore=defineStore("accounts",()=>{
|
||||
const status=ref<AuthStatus|null>(null);
|
||||
const error=ref("");
|
||||
async function load():Promise<void>{try{status.value=await api.authStatus<AuthStatus>();error.value=""}catch(cause){error.value=String((cause as Error).message||cause)}}
|
||||
async function signOut():Promise<void>{await api.signOut();window.location.assign("/")}
|
||||
return {status,error,load,signOut};
|
||||
// Empty for the default instance, which needs no label.
|
||||
const instance=computed(()=>{const name=status.value?.instance||"";return name==="archie"?"":name});
|
||||
return {status,error,instance,load,signOut};
|
||||
});
|
||||
|
||||
export function passkeysAvailable(publicURL:string):boolean{
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import Logo from "./Logo.vue";
|
||||
import BrandName from "./BrandName.vue";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { useAccountsStore } from "@/accounts/accounts";
|
||||
|
||||
const accounts = useAccountsStore();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -10,5 +14,6 @@ import BrandName from "./BrandName.vue";
|
||||
>
|
||||
<Logo />
|
||||
<BrandName class="hidden sm:inline" />
|
||||
<Badge v-if="accounts.instance" variant="info">{{ accounts.instance }}</Badge>
|
||||
</RouterLink>
|
||||
</template>
|
||||
Reference in new issue
Block a user