pl-api: handle version string for Egregoros
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -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);
|
||||
|
||||
@ -16,6 +16,14 @@ const any = (arr: Array<any>): 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,
|
||||
|
||||
Reference in New Issue
Block a user