diff --git a/composables/users.ts b/composables/users.ts index 8f466850..0c0e751e 100644 --- a/composables/users.ts +++ b/composables/users.ts @@ -1,3 +1,4 @@ +import { withoutProtocol } from 'ufo' import type { mastodon } from 'masto' import type { EffectScope, Ref } from 'vue' import type { MaybeComputedRef, RemovableRef } from '@vueuse/core' @@ -68,7 +69,7 @@ const publicInstance = ref(null) export const currentInstance = computed(() => currentUser.value ? instances.value[currentUser.value.server] ?? null : publicInstance.value) export function getInstanceDomain(instance: ElkInstance) { - return instance.accountDomain || instance.uri + return instance.accountDomain || withoutProtocol(instance.uri) } export const publicServer = ref('') @@ -322,7 +323,7 @@ export function clearUserLocalStorage(account?: mastodon.v1.Account) { if (!account) return - const id = `${account.acct}@${currentInstance.value?.uri || currentServer.value}` + const id = `${account.acct}@${currentInstance.value ? getInstanceDomain(currentInstance.value) : currentServer.value}` // @ts-expect-error bind value to the function const cacheMap = useUserLocalStorage._ as Map | undefined