pl-api: support importing mutes on gotosocial
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -1581,14 +1581,27 @@ class PlApiClient {
|
||||
* Imports your mutes.
|
||||
*
|
||||
* Requires features{@link Features['importMutes']}.
|
||||
* `overwrite` mode requires features{@link Features['importOverwrite']}.
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/pleroma_api/#apipleromamutes_import}
|
||||
*/
|
||||
importMutes: async (list: File | string) => {
|
||||
const response = await this.request('/api/pleroma/mutes_import', {
|
||||
method: 'POST',
|
||||
body: { list },
|
||||
contentType: '',
|
||||
});
|
||||
importMutes: async (list: File | string, mode?: 'merge' | 'overwrite') => {
|
||||
let response;
|
||||
|
||||
switch (this.features.version.software) {
|
||||
case GOTOSOCIAL:
|
||||
response = await this.request('/api/v1/import', {
|
||||
method: 'POST',
|
||||
body: { data: list, type: 'blocks', mode },
|
||||
contentType: '',
|
||||
});
|
||||
break;
|
||||
default:
|
||||
response = await this.request('/api/pleroma/mutes_import', {
|
||||
method: 'POST',
|
||||
body: { list },
|
||||
contentType: '',
|
||||
});
|
||||
}
|
||||
|
||||
return response.json;
|
||||
},
|
||||
|
||||
@ -837,9 +837,11 @@ const getFeatures = (instance: Instance) => {
|
||||
/**
|
||||
* Import a .csv file with a list of muted users.
|
||||
* @see POST /api/pleroma/mutes_import
|
||||
* @see POST /api/v1/import
|
||||
*/
|
||||
importMutes: any([
|
||||
v.software === AKKOMA,
|
||||
v.software === GOTOSOCIAL && gte(v.version, '0.19.0'),
|
||||
v.software === PLEROMA,
|
||||
]),
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pl-api",
|
||||
"version": "1.0.0-rc.39",
|
||||
"version": "1.0.0-rc.40",
|
||||
"type": "module",
|
||||
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
||||
"repository": {
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
"multiselect-react-dropdown": "^2.0.25",
|
||||
"mutative": "^1.1.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"pl-api": "^1.0.0-rc.39",
|
||||
"pl-api": "^1.0.0-rc.40",
|
||||
"postcss": "^8.4.49",
|
||||
"process": "^0.11.10",
|
||||
"punycode": "^2.1.1",
|
||||
|
||||
@ -42,7 +42,7 @@ const ImportData = () => {
|
||||
<Column label={intl.formatMessage(messages.heading)}>
|
||||
{features.importFollows && <DataImporter action={importFollows} messages={followMessages} allowOverwrite={features.importOverwrite} />}
|
||||
{features.importBlocks && <DataImporter action={importBlocks} messages={blockMessages} allowOverwrite={features.importOverwrite} />}
|
||||
{features.importMutes && <DataImporter action={importMutes} messages={muteMessages} />}
|
||||
{features.importMutes && <DataImporter action={importMutes} messages={muteMessages} allowOverwrite={features.importOverwrite} />}
|
||||
</Column>
|
||||
);
|
||||
};
|
||||
|
||||
@ -6833,10 +6833,10 @@ pkg-dir@^4.1.0:
|
||||
dependencies:
|
||||
find-up "^4.0.0"
|
||||
|
||||
pl-api@^1.0.0-rc.39:
|
||||
version "1.0.0-rc.39"
|
||||
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.39.tgz#47ed57e0ea0602c45b7105d1727b3ff52e09dbba"
|
||||
integrity sha512-5U1ni9+HQrG9xVcNdlw4VSUJoxcqdgLXUttAH7gxo9jdMMqPLK/c4WLKbyERTM0jn1HubrTPSnDCFZpyvO68hA==
|
||||
pl-api@^1.0.0-rc.40:
|
||||
version "1.0.0-rc.40"
|
||||
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.40.tgz#ae2596a15d28a8662d1a5de083b9596a8b6c00b3"
|
||||
integrity sha512-4X7va+KXOcXAOD02W+4e6NHgD+pbxhIoeHxT9rcWdHDjxmWiCapBoxxxa88ASPZKZFoiXZAktsFRSEs9yM3Z6A==
|
||||
dependencies:
|
||||
blurhash "^2.0.5"
|
||||
http-link-header "^1.1.3"
|
||||
|
||||
Reference in New Issue
Block a user