diff --git a/app/soapbox/__fixtures__/akkoma-instance.json b/app/soapbox/__fixtures__/akkoma-instance.json new file mode 100644 index 000000000..a4da0dc94 --- /dev/null +++ b/app/soapbox/__fixtures__/akkoma-instance.json @@ -0,0 +1,105 @@ +{ + "approval_required": false, + "avatar_upload_limit": 2000000, + "background_image": "https://fe.disroot.org/images/city.jpg", + "background_upload_limit": 4000000, + "banner_upload_limit": 4000000, + "description": "FEDIsroot - Federated social network powered by Pleroma (open beta)", + "description_limit": 5000, + "email": "admin@example.lan", + "languages": [ + "en" + ], + "max_toot_chars": 5000, + "pleroma": { + "metadata": { + "account_activation_required": false, + "features": [ + "pleroma_api", + "akkoma_api", + "mastodon_api", + "mastodon_api_streaming", + "polls", + "v2_suggestions", + "pleroma_explicit_addressing", + "shareable_emoji_packs", + "multifetch", + "pleroma:api/v1/notifications:include_types_filter", + "editing", + "media_proxy", + "relay", + "pleroma_emoji_reactions", + "exposable_reactions", + "profile_directory", + "custom_emoji_reactions", + "pleroma:get:main/ostatus" + ], + "federation": { + "enabled": true, + "exclusions": false, + "mrf_hashtag": { + "federated_timeline_removal": [], + "reject": [], + "sensitive": [ + "nsfw" + ] + }, + "mrf_object_age": { + "actions": [ + "delist", + "strip_followers" + ], + "threshold": 604800 + }, + "mrf_policies": [ + "ObjectAgePolicy", + "TagPolicy", + "HashtagPolicy", + "InlineQuotePolicy" + ], + "quarantined_instances": [], + "quarantined_instances_info": { + "quarantined_instances": {} + } + }, + "fields_limits": { + "max_fields": 10, + "max_remote_fields": 20, + "name_length": 512, + "value_length": 2048 + }, + "post_formats": [ + "text/plain", + "text/html", + "text/markdown", + "text/bbcode", + "text/x.misskeymarkdown" + ], + "privileged_staff": false + }, + "stats": { + "mau": 83 + }, + "vapid_public_key": null + }, + "poll_limits": { + "max_expiration": 31536000, + "max_option_chars": 200, + "max_options": 20, + "min_expiration": 0 + }, + "registrations": false, + "stats": { + "domain_count": 6972, + "status_count": 8081, + "user_count": 357 + }, + "thumbnail": "https://fe.disroot.org/instance/thumbnail.jpeg", + "title": "FEDIsroot", + "upload_limit": 16000000, + "uri": "https://fe.disroot.org", + "urls": { + "streaming_api": "wss://fe.disroot.org" + }, + "version": "2.7.2 (compatible; Akkoma 3.3.1-0-gaf90a4e51)" +} diff --git a/app/soapbox/normalizers/__tests__/instance.test.ts b/app/soapbox/normalizers/__tests__/instance.test.ts index ab51c9159..0df95fcb3 100644 --- a/app/soapbox/normalizers/__tests__/instance.test.ts +++ b/app/soapbox/normalizers/__tests__/instance.test.ts @@ -192,4 +192,12 @@ describe('normalizeInstance()', () => { const result = normalizeInstance(instance); expect(result.title).toBe('pixelfed'); }); + + it('renames Akkoma to Pleroma', () => { + const instance = require('soapbox/__fixtures__/akkoma-instance.json'); + const result = normalizeInstance(instance); + + expect(result.version).toEqual('2.7.2 (compatible; Pleroma 2.4.5+akkoma)'); + + }); }); diff --git a/app/soapbox/normalizers/instance.ts b/app/soapbox/normalizers/instance.ts index e137c2165..ff55ef4a5 100644 --- a/app/soapbox/normalizers/instance.ts +++ b/app/soapbox/normalizers/instance.ts @@ -98,6 +98,17 @@ const normalizeVersion = (instance: ImmutableMap) => { }); }; +/** Rename Akkoma to Pleroma+akkoma */ +const fixAkkoma = (instance: ImmutableMap) => { + const version: string = instance.get('version', ''); + + if (version.includes('Akkoma')) { + return instance.set('version', '2.7.2 (compatible; Pleroma 2.4.5+akkoma)'); + } else { + return instance; + } +}; + // Normalize instance (Pleroma, Mastodon, etc.) to Mastodon's format export const normalizeInstance = (instance: Record) => { return InstanceRecord( @@ -117,6 +128,7 @@ export const normalizeInstance = (instance: Record) => { // Normalize version normalizeVersion(instance); + fixAkkoma(instance); // Merge defaults instance.mergeDeepWith(mergeDefined, InstanceRecord()); diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index 823f8df1a..3cb7e98dc 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -57,6 +57,12 @@ export const SOAPBOX = 'soapbox'; */ export const GLITCH = 'glitch'; +/** + * Akkoma, a Pleroma fork. + * @see {@link https://akkoma.dev/AkkomaGang/akkoma} + */ +export const AKKOMA = 'akkoma'; + /** Parse features for the given instance */ const getInstanceFeatures = (instance: Instance) => { const v = parseVersion(instance.version); @@ -202,7 +208,7 @@ const getInstanceFeatures = (instance: Instance) => { * Pleroma chats API. * @see {@link https://docs.pleroma.social/backend/development/API/chats/} */ - chats: v.software === PLEROMA && gte(v.version, '2.1.0'), + chats: v.software === PLEROMA && gte(v.version, '2.1.0') && v.build !== AKKOMA, /** * Paginated chats API.