From 524192c4f04380a8b5fbf5cbf22290a4d1be60ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 10 Sep 2024 12:11:52 +0200 Subject: [PATCH] pl-api: Allow reblogging to a given scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-api/lib/client.ts | 4 ++-- packages/pl-api/lib/features.ts | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/pl-api/lib/client.ts b/packages/pl-api/lib/client.ts index b94415319..d4cfe78c5 100644 --- a/packages/pl-api/lib/client.ts +++ b/packages/pl-api/lib/client.ts @@ -1896,8 +1896,8 @@ class PlApiClient { * Reshare a status on your own profile. * @see {@link https://docs.joinmastodon.org/methods/statuses/#reblog} */ - reblogStatus: async (statusId: string) => { - const response = await this.request(`/api/v1/statuses/${statusId}/reblog`, { method: 'POST' }); + reblogStatus: async (statusId: string, visibility?: string) => { + const response = await this.request(`/api/v1/statuses/${statusId}/reblog`, { method: 'POST', body: { visibility } }); return statusSchema.parse(response.json); }, diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index bbf8a6978..5d9616134 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -85,19 +85,18 @@ const AKKOMA = 'akkoma'; */ const GLITCH = 'glitch'; -/** - * Rebased, the recommended backend for Soapbox. - * @see {@link https://gitlab.com/soapbox-pub/rebased} - */ -// NOTE: Rebased is named 'soapbox' for legacy reasons. -const REBASED = 'soapbox'; - /** * Pl, fork of Pleroma developed by pl-api author. * @see {@link https://github.com/mkljczk/pl} */ const PL = 'pl'; +/** + * Rebased, fork of Pleroma developed by Soapbox author. + * @see {@link https://gitlab.com/soapbox-pub/rebased} + */ +const REBASED = 'soapbox'; + /** Backend name reserved only for tests. */ const UNRELEASED = 'unreleased'; @@ -948,6 +947,15 @@ const getFeatures = (instance?: Instance) => { instance?.feature_quote === true, ]), + /** + * Ability to boost a status to a selected scope. + * @see POST /api/v1/statuses/:id/reblog + */ + reblogVisibility: any([ + v.software === MASTODON, + v.software === PLEROMA, + ]), + /** * Interact with statuses from another instance while logged-out. * @see POST /api/v1/pleroma/remote_interaction