GoToSocial: support avatar/header descriptions, RSS fields

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-07-26 14:20:33 +02:00
parent ed81e73003
commit ebb5f30eac
37 changed files with 330 additions and 70 deletions

View File

@ -1,3 +1,5 @@
import range from 'lodash/range';
import type { Account } from 'soapbox/schemas';
const getDomainFromURL = (account: Pick<Account, 'url'>): string => {
@ -41,6 +43,7 @@ const isDefaultHeader = (url: string) => DEFAULT_HEADERS.some(header => url.ends
const DEFAULT_AVATARS = [
'/avatars/original/missing.png', // Mastodon
'/images/avi.png', // Pleroma
...(range(1, 6).map(i => `/assets/default_avatars/GoToSocial_icon${i}.webp`)), // GoToSocial
'/assets/default_avatars/GoToSocial_icon2.webp', // GoToSocial
require('soapbox/assets/images/avatar-missing.png'), // avatar not provided by backend
];

View File

@ -26,6 +26,12 @@ const FIREFISH = 'Firefish';
*/
const FRIENDICA = 'Friendica';
/**
* GoToSocial, an ActivityPub server writter in Golang.
* @see {@link https://gotosocial.org/}
*/
const GOTOSOCIAL = 'GoToSocial';
/**
* Iceshrimp, yet another Misskey fork.
* @see {@link https://iceshrimp.dev/}
@ -62,6 +68,12 @@ const PLEROMA = 'Pleroma';
*/
const TAKAHE = 'Takahe';
/**
* Toki, a C# Fediverse server.
* @see {@link https://github.com/purifetchi/Toki}
*/
const TOKI = 'Toki';
/**
* Akkoma, a Pleroma fork.
* @see {@link https://akkoma.dev/AkkomaGang/akkoma}
@ -81,18 +93,6 @@ const GLITCH = 'glitch';
// NOTE: Rebased is named 'soapbox' for legacy reasons.
const REBASED = 'soapbox';
/**
* GoToSocial, an ActivityPub server writter in Golang.
* @see {@link https://gotosocial.org/}
*/
const GOTOSOCIAL = 'GoToSocial';
/**
* Toki, a C# Fediverse server.
* @see {@link https://github.com/purifetchi/Toki}
*/
const TOKI = 'Toki';
/** Backend name reserved only for tests. */
const UNRELEASED = 'unreleased';
@ -109,6 +109,12 @@ const getInstanceFeatures = (instance: Instance) => {
*/
accountAliases: v.software === PLEROMA,
/**
* Ability to set description of profile avatar and header.
* @see PATCH /api/v1/accounts/update_credentials
*/
accountAvatarDescription: v.software === GOTOSOCIAL,
/**
* The accounts API allows an acct instead of an ID.
* @see GET /api/v1/accounts/:acct_or_id
@ -839,7 +845,7 @@ const getInstanceFeatures = (instance: Instance) => {
rssFeeds: any([
v.software === MASTODON,
v.software === PLEROMA,
// v.software === GOTOSOCIAL, // TODO
v.software === GOTOSOCIAL,
]),
/**
@ -1005,12 +1011,14 @@ const parseVersion = (version: string): Backend => {
export {
FIREFISH,
FRIENDICA,
GOTOSOCIAL,
ICESHRIMP,
MASTODON,
MITRA,
PIXELFED,
PLEROMA,
TAKAHE,
TOKI,
AKKOMA,
GLITCH,
REBASED,