diff --git a/components/oauth/login.vue b/components/oauth/login.vue index 7f87d1c..bccbb24 100644 --- a/components/oauth/login.vue +++ b/components/oauth/login.vue @@ -61,7 +61,7 @@ for (const name of [ } const issuerRedirectUrl = (issuerId: string) => { - const url = new URL("/oauth/sso", useBaseUrl().value); + const url = new URL("/oauth/sso", client.value.url); for (const name of [ "redirect_uri", diff --git a/components/sidebars/account-switcher.vue b/components/sidebars/account-switcher.vue index b7ac182..6c6f8a8 100644 --- a/components/sidebars/account-switcher.vue +++ b/components/sidebars/account-switcher.vue @@ -21,7 +21,7 @@ {{ m.sunny_pink_hyena_walk() }} - @@ -47,7 +47,9 @@ identity.account.display_name }} @{{ - identity.account.acct + identity.account.username + }}@{{ + identity.instance.domain }} @@ -64,7 +66,7 @@ - + {{ m.sharp_big_mallard_reap() }} @@ -98,48 +100,7 @@ import { const appData = useAppData(); const isMobile = useMediaQuery("(max-width: 768px)"); -const signInAction = () => signIn(appData, new URL(useBaseUrl().value)); - -const signOut = async (userId?: string) => { - const id = toast.loading("Signing out..."); - - if (!(appData.value && identity.value)) { - toast.dismiss(id); - toast.error("No app or identity data to sign out"); - return; - } - - const identityToRevoke = userId - ? identities.value.find((i) => i.account.id === userId) - : identity.value; - - if (!identityToRevoke) { - toast.dismiss(id); - toast.error("No identity to revoke"); - return; - } - - // Don't do anything on error, as Versia Server doesn't implement the revoke endpoint yet - await client.value - ?.revokeToken( - appData.value.client_id, - identityToRevoke.tokens.access_token, - identityToRevoke.tokens.access_token, - ) - .catch(() => { - // Do nothing - }); - - if (!userId) { - identity.value = null; - await navigateTo("/"); - return; - } - - identities.value = identities.value.filter((i) => i.id !== userId); - toast.dismiss(id); - toast.success("Signed out"); -}; +const signInAction = async () => signIn(appData, await askForInstance()); const switchAccount = async (userId: string) => { if (userId === identity.value?.account.id) { diff --git a/components/sidebars/left-sidebar.vue b/components/sidebars/left-sidebar.vue index d53a252..5b0a30a 100644 --- a/components/sidebars/left-sidebar.vue +++ b/components/sidebars/left-sidebar.vue @@ -12,7 +12,7 @@
{{ instance?.title ?? m.short_zippy_felix_kick() }} - {{ m.top_active_ocelot_cure() }} + {{ instance?.description ?? m.top_active_ocelot_cure() }}
diff --git a/composables/BaseUrl.ts b/composables/BaseUrl.ts deleted file mode 100644 index ffa54e9..0000000 --- a/composables/BaseUrl.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const useBaseUrl = () => { - // Check if running on Onion URL - if (useRequestURL().hostname.endsWith(".onion")) { - return ref( - useRuntimeConfig().public.onionApiHost ?? useRequestURL().origin, - ); - } - - return ref(useRuntimeConfig().public.apiHost ?? useRequestURL().origin); -}; diff --git a/layouts/app.vue b/layouts/app.vue index 484b83a..c27a2c4 100644 --- a/layouts/app.vue +++ b/layouts/app.vue @@ -1,7 +1,7 @@