Add preliminary Pixelfed support

This commit is contained in:
Alex Gleason
2022-04-10 18:21:52 -05:00
parent 2ea13e2582
commit 41d49e0fe7
4 changed files with 84 additions and 0 deletions

View File

@ -23,6 +23,15 @@ describe('parseVersion', () => {
compatVersion: '3.0.0',
});
});
it('with a Pixelfed version string', () => {
const version = '2.7.2 (compatible; Pixelfed 0.11.2)';
expect(parseVersion(version)).toEqual({
software: 'Pixelfed',
version: '0.11.2',
compatVersion: '2.7.2',
});
});
});
describe('getFeatures', () => {

View File

@ -19,6 +19,7 @@ export const MASTODON = 'Mastodon';
export const PLEROMA = 'Pleroma';
export const MITRA = 'Mitra';
export const TRUTHSOCIAL = 'TruthSocial';
export const PIXELFED = 'Pixelfed';
const getInstanceFeatures = (instance: Instance) => {
const v = parseVersion(instance.version);
@ -41,6 +42,7 @@ const getInstanceFeatures = (instance: Instance) => {
bookmarks: any([
v.software === MASTODON && gte(v.compatVersion, '3.1.0'),
v.software === PLEROMA && gte(v.version, '0.9.9'),
v.software === PIXELFED,
]),
lists: any([
v.software === MASTODON && gte(v.compatVersion, '2.1.0'),
@ -73,6 +75,7 @@ const getInstanceFeatures = (instance: Instance) => {
conversations: any([
v.software === MASTODON && gte(v.compatVersion, '2.6.0'),
v.software === PLEROMA && gte(v.version, '0.9.9'),
v.software === PIXELFED,
]),
emojiReacts: v.software === PLEROMA && gte(v.version, '2.0.0'),
emojiReactsRGI: v.software === PLEROMA && gte(v.version, '2.2.49'),