kopia lustrzana https://github.com/nolanlawson/pinafore
Query remote Mastodon server for follower list, on clicking follower go to their remote profile
rodzic
53803db5be
commit
2407d61ff2
|
@ -1,5 +1,7 @@
|
|||
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax.js'
|
||||
import { auth, basename } from './utils.js'
|
||||
import { getAccount } from '../_api/user.js'
|
||||
|
||||
|
||||
export async function getFollows (instanceName, accessToken, accountId, limit = 80) {
|
||||
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/following`
|
||||
|
@ -7,8 +9,24 @@ export async function getFollows (instanceName, accessToken, accountId, limit =
|
|||
return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT })
|
||||
}
|
||||
|
||||
export async function getFollowers (instanceName, accessToken, accountId, limit = 80) {
|
||||
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/followers`
|
||||
url += '?' + paramsString({ limit })
|
||||
return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT })
|
||||
export async function lookup (instanceName, accountName) {
|
||||
let url = `${basename(instanceName)}/api/v1/accounts/lookup?acct=${accountName}`
|
||||
return get(url, { timeout: DEFAULT_TIMEOUT })
|
||||
}
|
||||
|
||||
export async function getFollowers (instanceName, accessToken, accountId, limit = 80) {
|
||||
window.console.log(instanceName, accessToken, accountId, limit);
|
||||
|
||||
return getAccount(instanceName, accessToken, accountId).then(account => {
|
||||
let [accountName, remoteInstanceName] = account.acct.split('@');
|
||||
|
||||
return lookup(remoteInstanceName, accountName).then(remoteAccount => {
|
||||
let url = `${basename(remoteInstanceName)}/api/v1/accounts/${remoteAccount.id}/followers`
|
||||
url += '?' + paramsString({ limit })
|
||||
return get(url, { timeout: DEFAULT_TIMEOUT })
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<SearchResult href="/accounts/{account.id}">
|
||||
<SearchResult href="{account.url}">
|
||||
<div class="search-result-account">
|
||||
<div class="search-result-account-avatar">
|
||||
<Avatar {account} size="small" />
|
||||
|
|
Ładowanie…
Reference in New Issue