fix: remove protocol from instance uri

pull/1325/head
三咲智子 Kevin Deng 2023-01-20 00:20:56 +08:00
rodzic c200abcc90
commit eb966976db
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 69992F2250DFD93E
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -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<ElkInstance | null>(null)
export const currentInstance = computed<null | ElkInstance>(() => 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<string, UseUserLocalStorageCache> | undefined