fix: v1 instance api
This commit is contained in:
parent
c5573cb10b
commit
c7f4b33bf1
|
@ -41,7 +41,7 @@ export function fetchAccountById(id?: string | null): Promise<mastodon.v1.Accoun
|
||||||
const cached = cache.get(key)
|
const cached = cache.get(key)
|
||||||
if (cached)
|
if (cached)
|
||||||
return cached
|
return cached
|
||||||
const domain = currentInstance.value?.domain
|
const domain = currentInstance.value?.uri
|
||||||
const promise = useMasto().v1.accounts.fetch(id)
|
const promise = useMasto().v1.accounts.fetch(id)
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
if (r.acct && !r.acct.includes('@') && domain)
|
if (r.acct && !r.acct.includes('@') && domain)
|
||||||
|
@ -60,7 +60,7 @@ export async function fetchAccountByHandle(acct: string): Promise<mastodon.v1.Ac
|
||||||
const cached = cache.get(key)
|
const cached = cache.get(key)
|
||||||
if (cached)
|
if (cached)
|
||||||
return cached
|
return cached
|
||||||
const domain = currentInstance.value?.domain
|
const domain = currentInstance.value?.uri
|
||||||
const account = useMasto().v1.accounts.lookup({ acct })
|
const account = useMasto().v1.accounts.lookup({ acct })
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
if (r.acct && !r.acct.includes('@') && domain)
|
if (r.acct && !r.acct.includes('@') && domain)
|
||||||
|
|
|
@ -17,7 +17,7 @@ export function getServerName(account: mastodon.v1.Account) {
|
||||||
if (account.acct?.includes('@'))
|
if (account.acct?.includes('@'))
|
||||||
return account.acct.split('@')[1]
|
return account.acct.split('@')[1]
|
||||||
// We should only lack the server name if we're on the same server as the account
|
// We should only lack the server name if we're on the same server as the account
|
||||||
return currentInstance.value?.domain || ''
|
return currentInstance.value?.uri || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFullHandle(account: mastodon.v1.Account) {
|
export function getFullHandle(account: mastodon.v1.Account) {
|
||||||
|
@ -38,7 +38,7 @@ export function toShortHandle(fullHandle: string) {
|
||||||
|
|
||||||
export function extractAccountHandle(account: mastodon.v1.Account) {
|
export function extractAccountHandle(account: mastodon.v1.Account) {
|
||||||
let handle = getFullHandle(account).slice(1)
|
let handle = getFullHandle(account).slice(1)
|
||||||
const uri = currentInstance.value?.domain ?? currentServer.value
|
const uri = currentInstance.value?.uri ?? currentServer.value
|
||||||
if (currentInstance.value && handle.endsWith(`@${uri}`))
|
if (currentInstance.value && handle.endsWith(`@${uri}`))
|
||||||
handle = handle.slice(0, -uri.length - 1)
|
handle = handle.slice(0, -uri.length - 1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue