pl-api: Support Mitra' import follows/followers

Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
Nicole Mikołajczyk
2025-04-08 15:09:15 +02:00
parent 9a74a3cbeb
commit de9927ebef
2 changed files with 30 additions and 1 deletions

View File

@ -1537,6 +1537,12 @@ class PlApiClient {
contentType: '',
});
break;
case MITRA:
response = await this.request('/api/v1/settings/import_follows', {
method: 'POST',
body: { follows_csv: typeof list === 'string' ? list : await list.text() },
});
break;
default:
response = await this.request('/api/pleroma/follow_import', {
method: 'POST',
@ -1548,6 +1554,20 @@ class PlApiClient {
return response.json;
},
/**
* Move followers from remote alias. (experimental?)
*
* Requires features{@link Features['importFollowers']}.
*/
importFollowers: async (list: File | string, actorId: string) => {
const response = await this.request('/api/v1/settings/import_followers', {
method: 'POST',
body: { from_actor_id: actorId, followers_csv: typeof list === 'string' ? list : await list.text() },
});
return response.json;
},
/**
* Imports your blocks.
*

View File

@ -832,15 +832,24 @@ const getFeatures = (instance: Instance) => {
v.software === PLEROMA,
]),
/**
* Move followers from remote alias.
* @see POST /api/v1/settings/import_followers
*/
importFollowers: any([
v.software === MITRA && gte(v.version, '2.18.0'),
]),
/**
* Import a .csv file with a list of followed users.
* @see POST /api/pleroma/follow_import
* @see POST /api/v1/settings/import_follows
* @see POST /api/v1/import
*/
importFollows: any([
v.software === AKKOMA,
v.software === GOTOSOCIAL && gte(v.version, '0.17.0'),
v.software === MITRA && gte(v.version, '1.10.0'),
v.software === PLEROMA,
]),