From a21a1d481e864679a32b20e87c584dc8183c9570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Fri, 27 Jun 2025 12:24:58 +0200 Subject: [PATCH] pl-api: Support NeoDB and Incarnator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/pl-api/lib/entities/instance.ts | 5 ++++ packages/pl-api/lib/features.ts | 38 +++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/packages/pl-api/lib/entities/instance.ts b/packages/pl-api/lib/entities/instance.ts index c0ba80b46..0d7918cec 100644 --- a/packages/pl-api/lib/entities/instance.ts +++ b/packages/pl-api/lib/entities/instance.ts @@ -96,10 +96,15 @@ const fixVersion = (version: string) => { return version.split('rc').join('-rc'); } + // Set Takahē version to a Pleroma-like string if (version.startsWith('takahe/')) { return `0.0.0 (compatible; Takahe ${version.slice(7)})`; } + // Set NeoDB version to a Pleroma-like string + if (version.startsWith('neodb/')) { + return `0.0.0 (compatible; NeoDB ${version.slice(7)})`; + } const wordPressMatch = WORDPRESS_REGEX.exec(version); diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index 2de9bb539..01071f5be 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -71,6 +71,14 @@ const MASTODON = 'Mastodon'; */ const MITRA = 'Mitra'; +/** + * NeoDB, 'mark the things you love'. + * + * @category Software + * @see {@link https://neodb.net/} + */ +const NEODB = 'NeoDB'; + /** * Pixelfed, a federated image sharing platform. * @@ -105,6 +113,8 @@ const SNAC = 'snac'; /** * Takahē, backend with support for serving multiple domains. + * Takahē 0.12.0 and newer refer to its fork — Incarnator + * @see {@link https://github.com/avaraline/incarnator} * * @category Software * @see {@link https://jointakahe.org/} @@ -174,6 +184,7 @@ const UNRELEASED = 'unreleased'; const getFeatures = (instance: Instance) => { const v = parseVersion(instance.version || ''); const federation = !!instance.pleroma.metadata.federation.enabled; + console.log(v); return { version: v, @@ -267,6 +278,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA, + v.software === NEODB, v.software === PLEROMA && gte(v.version, '2.5.0'), v.software === SHARKEY, v.software === SNAC, @@ -367,6 +379,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP, v.software === ICESHRIMP_NET, v.software === MASTODON, + v.software === NEODB, v.software === PLEROMA, v.software === SHARKEY, v.software === SNAC, @@ -435,6 +448,7 @@ const getFeatures = (instance: Instance) => { v.software === FRIENDICA, v.software === MASTODON, v.software === MITRA && gte(v.version, '3.3.0'), + v.software === NEODB, v.software === PIXELFED, v.software === PLEROMA, v.software === SHARKEY, @@ -522,6 +536,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP, v.software === ICESHRIMP_NET, v.software === MASTODON, + v.software === NEODB, v.software === PIXELFED, v.software === PLEROMA, v.software === SHARKEY, @@ -651,6 +666,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA, + v.software === NEODB, v.software === PIXELFED, v.software === PLEROMA, v.software === TAKAHE && gte(v.version, '0.7.0'), @@ -669,6 +685,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA, + v.software === NEODB, v.software === TAKAHE && gte(v.version, '0.8.0'), instance.api_versions['editing.pleroma.pl-api'] >= 1, ]), @@ -779,6 +796,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA && gte(v.version, '4.5.0'), + v.software === NEODB, v.software === SHARKEY, v.software === TAKAHE && gte(v.version, '0.6.1'), v.software === TOKI, @@ -792,6 +810,7 @@ const getFeatures = (instance: Instance) => { familiarFollowers: any([ v.software === DITTO, v.software === MASTODON, + v.software === NEODB, v.software === PIXELFED, v.software === PLEROMA && gte(v.version, '2.7.0'), v.software === TAKAHE, @@ -804,7 +823,11 @@ const getFeatures = (instance: Instance) => { * @see DELETE /api/v1/featured_tags * @see GET /api/v1/featured_tags/suggestions */ - featuredTags: v.software === MASTODON, + featuredTags: any([ + v.software === MASTODON, + v.software === NEODB, + v.software === TAKAHE && gte(v.version, '0.12.0'), + ]), /** Whether the instance federates. */ federating: federation, @@ -852,6 +875,7 @@ const getFeatures = (instance: Instance) => { v.software === AKKOMA, v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), v.software === MASTODON && gte(v.compatVersion, '4.1.0'), + v.software === NEODB, v.software === PIXELFED, v.software === PLEROMA && gte(v.version, '2.9.0'), v.software === TAKAHE && gte(v.version, '0.9.0'), @@ -866,6 +890,7 @@ const getFeatures = (instance: Instance) => { v.software === AKKOMA, v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), v.software === MASTODON && gte(v.compatVersion, '4.0.0'), + v.software === NEODB, v.software === PIXELFED, v.software === PLEROMA && gte(v.version, '2.9.0'), v.software === TAKAHE && gte(v.version, '0.9.0'), @@ -1047,9 +1072,11 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA, + v.software === NEODB, v.software === PLEROMA, v.software === SHARKEY, v.software === SNAC, + v.software === TAKAHE && gte(v.version, '0.12.0'), ]), /** @@ -1172,6 +1199,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA, + v.software === NEODB, v.software === PLEROMA, v.software === TAKAHE, v.software === TOKI, @@ -1208,6 +1236,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA, + v.software === NEODB, v.software === PIXELFED, v.software === PLEROMA, v.software === SHARKEY, @@ -1225,6 +1254,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP, v.software === ICESHRIMP_NET, v.software === MASTODON, + v.software === NEODB, v.software === PLEROMA, v.software === TAKAHE, ]), @@ -1277,6 +1307,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP, v.software === ICESHRIMP_NET, v.software === MASTODON, + v.software === NEODB, v.software === PLEROMA && gte(v.version, '2.5.0'), v.software === TAKAHE && gte(v.version, '0.6.2'), v.software === GOTOSOCIAL, @@ -1359,6 +1390,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA && gte(v.version, '3.15.0'), + v.software === NEODB, v.software === SHARKEY, v.software === TAKAHE && gte(v.version, '0.8.0'), instance.api_versions['polls.pleroma.pl-api'] >= 1, @@ -1412,6 +1444,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA, + v.software === NEODB, v.software === PLEROMA, v.software === SHARKEY, v.software === SNAC, @@ -1442,6 +1475,7 @@ const getFeatures = (instance: Instance) => { v.software === ICESHRIMP_NET, v.software === MASTODON, v.software === MITRA, + v.software === NEODB, v.software === PLEROMA, v.software === SNAC, v.software === TAKAHE, @@ -1717,8 +1751,10 @@ const getFeatures = (instance: Instance) => { v.software === FRIENDICA && gte(v.version, '2022.12.0'), v.software === ICESHRIMP, v.software === MASTODON, + v.software === NEODB, v.software === PIXELFED, v.software === SHARKEY, + v.software === TAKAHE && gte(v.version, '0.12.0'), ]), /**