fix: replace deprecated v1.instance (#3183)
This commit is contained in:
parent
4cbafc5f56
commit
9f4945bad8
2 changed files with 41 additions and 10 deletions
|
@ -20,14 +20,13 @@ const mock = process.mock
|
|||
const users: Ref<UserLogin[]> | RemovableRef<UserLogin[]> = import.meta.server ? ref<UserLogin[]>([]) : ref<UserLogin[]>([]) as RemovableRef<UserLogin[]>
|
||||
const nodes = useLocalStorage<Record<string, any>>(STORAGE_KEY_NODES, {}, { deep: true })
|
||||
export const currentUserHandle = useLocalStorage<string>(STORAGE_KEY_CURRENT_USER_HANDLE, mock ? mock.user.account.id : '')
|
||||
export const instanceStorage = useLocalStorage<Record<string, mastodon.v1.Instance>>(STORAGE_KEY_SERVERS, mock ? mock.server : {}, { deep: true })
|
||||
export const instanceStorage = useLocalStorage<Record<string, mastodon.v2.Instance>>(STORAGE_KEY_SERVERS, mock ? mock.server : {}, { deep: true })
|
||||
|
||||
export type ElkInstance = Partial<mastodon.v1.Instance> & {
|
||||
uri: string
|
||||
export type ElkInstance = Partial<mastodon.v2.Instance> & {
|
||||
/** support GoToSocial */
|
||||
accountDomain?: string | null
|
||||
}
|
||||
export function getInstanceCache(server: string): mastodon.v1.Instance | undefined {
|
||||
export function getInstanceCache(server: string): mastodon.v2.Instance | undefined {
|
||||
return instanceStorage.value[server]
|
||||
}
|
||||
|
||||
|
@ -52,7 +51,7 @@ export const currentInstance = computed<null | ElkInstance>(() => {
|
|||
})
|
||||
|
||||
export function getInstanceDomain(instance: ElkInstance) {
|
||||
return instance.accountDomain || withoutProtocol(instance.uri)
|
||||
return instance.accountDomain || withoutProtocol(instance.domain || '')
|
||||
}
|
||||
|
||||
export const publicServer = ref('')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue