diff --git a/packages/pl-api/lib/entities/instance.ts b/packages/pl-api/lib/entities/instance.ts index 82db2793c..4945ba9c0 100644 --- a/packages/pl-api/lib/entities/instance.ts +++ b/packages/pl-api/lib/entities/instance.ts @@ -97,20 +97,19 @@ const instanceV1ToV2 = (data: any) => { }; }; +const software: Array<[string, string]> = [['takahe', 'Takahe'], ['neodb', 'NeoDB'], ['egregoros', 'Egregoros']]; + const fixVersion = (version: string) => { // Handle Mastodon release candidates if (new RegExp(/[0-9.]+rc[0-9]+/g).test(version)) { 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)})`; + // Set Takahē and NeoDB versions to a Pleroma-like string + for (const [key, name] of software) { + if (version.startsWith(`${key}/`)) { + return `0.0.0 (compatible; ${name} ${version.slice(key.length + 1)})`; + } } const wordPressMatch = WORDPRESS_REGEX.exec(version); diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index 919e04a0c..b336cc23d 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -16,6 +16,14 @@ const any = (arr: Array): boolean => arr.some(Boolean); */ const DITTO = 'Ditto'; +/** + * Egregoros, a fediverse server pulled from the akashic records [TODO: fact check this claim ~nicole]. + * + * @category Software + * @see {@link https://github.com/egregoros-social/egregoros} + */ +const EGREGOROS = 'Egregoros'; + /** * Firefish, a fork of Misskey. Formerly known as Calckey. * @@ -164,7 +172,7 @@ const AKKOMA = 'Akkoma'; const GLITCH = 'glitch'; /** - * glitch-soc, fork of Mastodon that provides local posting and a wider range of content types. + * Hometown, fork of Mastodon that provides local posting and a wider range of content types. * * @category Software * @see {@link https://github.com/hometown-fork/hometown} @@ -1887,6 +1895,7 @@ const parseVersion = (version: string): Backend => { export { AKKOMA, DITTO, + EGREGOROS, FIREFISH, FRIENDICA, GOTOSOCIAL,