pl-api: Add software definition for snac2

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-03-20 12:22:31 +01:00
parent 265c005790
commit 9ed2b60c02
2 changed files with 17 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import { accountSchema } from './account';
import { ruleSchema } from './rule';
import { coerceObject, filteredArray, mimeSchema } from './utils';
const SNAC_REGEX = /^([0-9.]*) \(not true; really snac\/([\w.]*)\)/;
const WORDPRESS_REGEX = /^WordPress\/[\w+.-]*, EMA\/([\w+.-]*)/;
const getApiVersions = (instance: any): Record<string, number> => ({
@ -107,6 +108,12 @@ const fixVersion = (version: string) => {
return `0.0.0 (compatible; WordPress ${wordPressMatch[1]})`;
}
const snacMatch = SNAC_REGEX.exec(version);
if (snacMatch) {
return `${snacMatch[1]} (compatible; snac ${snacMatch[2]})`;
}
return version;
};

View File

@ -87,6 +87,14 @@ const PIXELFED = 'Pixelfed';
*/
const PLEROMA = 'Pleroma';
/**
* snac, a simple, minimalistic ActivityPub instance written in portable C
*
* @category Software
* @see {@link https://codeberg.org/grunfink/snac2/}
*/
const SNAC = 'snac';
/**
* Takahē, backend with support for serving multiple domains.
*
@ -1550,6 +1558,7 @@ const parseVersion = (version: string): Backend => {
};
export {
AKKOMA,
DITTO,
FIREFISH,
FRIENDICA,
@ -1560,10 +1569,10 @@ export {
MITRA,
PIXELFED,
PLEROMA,
SNAC,
TAKAHE,
TOKI,
WORDPRESS,
AKKOMA,
GLITCH,
HOMETOWN,
PL,