pl-api: support familiar followers on pixelfed

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2024-12-25 15:36:40 +01:00
parent efd9f87122
commit d9f4b8d594
2 changed files with 16 additions and 2 deletions

View File

@ -725,9 +725,22 @@ class PlApiClient {
* @see {@link https://docs.joinmastodon.org/methods/accounts/#familiar_followers}
*/
getFamiliarFollowers: async (accountIds: string[]) => {
const response = await this.request('/api/v1/accounts/familiar_followers', { params: { id: accountIds } });
let response: any;
return v.parse(filteredArray(familiarFollowersSchema), response.json);
if (this.features.version.software === PIXELFED) {
response = [];
for (const accountId of accountIds) {
const accounts = (await this.request(`/api/v1.1/accounts/mutuals/${accountId}`)).json;
response.push({
id: accountId,
accounts,
});
}
} else {
response = (await this.request('/api/v1/accounts/familiar_followers', { params: { id: accountIds } })).json;
}
return v.parse(filteredArray(familiarFollowersSchema), response);
},
/**

View File

@ -569,6 +569,7 @@ const getFeatures = (instance: Instance) => {
familiarFollowers: any([
v.software === DITTO,
v.software === MASTODON,
v.software === PIXELFED,
v.software === PLEROMA && gte(v.version, '2.6.0') && v.build === REBASED,
v.software === PLEROMA && gte(v.version, '2.7.0'),
v.software === TAKAHE,