pl-api: Add software definition for snac2
Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
@ -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;
|
||||
};
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user