2022-04-23 13:54:57 -07:00
|
|
|
/* eslint sort-keys: "error" */
|
2021-08-23 12:14:47 -07:00
|
|
|
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
|
2021-07-06 11:06:21 -07:00
|
|
|
import { createSelector } from 'reselect';
|
2022-01-10 14:17:52 -08:00
|
|
|
import gte from 'semver/functions/gte';
|
|
|
|
import lt from 'semver/functions/lt';
|
2022-04-27 11:50:13 -07:00
|
|
|
import semverParse from 'semver/functions/parse';
|
2020-05-17 12:44:33 -07:00
|
|
|
|
2022-03-03 21:38:59 -08:00
|
|
|
import { custom } from 'soapbox/custom';
|
2022-03-03 21:05:37 -08:00
|
|
|
|
2022-03-26 12:23:29 -07:00
|
|
|
import type { Instance } from 'soapbox/types/entities';
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Import custom overrides, if exists */
|
2022-03-03 21:38:59 -08:00
|
|
|
const overrides = custom('features');
|
2022-03-03 21:05:37 -08:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Truthy array convenience function */
|
2022-03-26 12:23:29 -07:00
|
|
|
const any = (arr: Array<any>): boolean => arr.some(Boolean);
|
2021-09-18 12:27:15 -07:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
|
|
|
* Mastodon, the software upon which this is all based.
|
|
|
|
* @see {@link https://joinmastodon.org/}
|
|
|
|
*/
|
|
|
|
export const MASTODON = 'Mastodon';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pleroma, a feature-rich alternative written in Elixir.
|
|
|
|
* @see {@link https://pleroma.social/}
|
|
|
|
*/
|
|
|
|
export const PLEROMA = 'Pleroma';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mitra, a Rust backend with deep Ethereum integrations.
|
|
|
|
* @see {@link https://codeberg.org/silverpill/mitra}
|
|
|
|
*/
|
|
|
|
export const MITRA = 'Mitra';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pixelfed, a federated image sharing platform.
|
|
|
|
* @see {@link https://pixelfed.org/}
|
|
|
|
*/
|
|
|
|
export const PIXELFED = 'Pixelfed';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Truth Social, the Mastodon fork powering truthsocial.com
|
|
|
|
* @see {@link https://help.truthsocial.com/open-source}
|
|
|
|
*/
|
2022-03-26 12:06:25 -07:00
|
|
|
export const TRUTHSOCIAL = 'TruthSocial';
|
2021-09-18 12:27:15 -07:00
|
|
|
|
2022-04-27 11:50:13 -07:00
|
|
|
/**
|
|
|
|
* Soapbox BE, the recommended Pleroma fork for Soapbox.
|
|
|
|
* @see {@link https://gitlab.com/soapbox-pub/soapbox-be}
|
|
|
|
*/
|
|
|
|
export const SOAPBOX = 'soapbox';
|
|
|
|
|
2022-05-12 11:26:36 -07:00
|
|
|
/**
|
|
|
|
* glitch-soc, fork of Mastodon with a number of experimental features.
|
|
|
|
* @see {@link https://glitch-soc.github.io/docs/}
|
|
|
|
*/
|
|
|
|
export const GLITCH = 'glitch';
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Parse features for the given instance */
|
2022-03-26 12:23:29 -07:00
|
|
|
const getInstanceFeatures = (instance: Instance) => {
|
2022-03-30 14:30:04 -07:00
|
|
|
const v = parseVersion(instance.version);
|
2022-03-26 12:23:29 -07:00
|
|
|
const features = instance.pleroma.getIn(['metadata', 'features'], ImmutableList()) as ImmutableList<string>;
|
|
|
|
const federation = instance.pleroma.getIn(['metadata', 'federation'], ImmutableMap()) as ImmutableMap<string, any>;
|
2022-02-12 18:08:38 -08:00
|
|
|
|
2022-03-26 12:23:29 -07:00
|
|
|
return {
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can view and manage ActivityPub aliases through the API.
|
|
|
|
* @see GET /api/pleroma/aliases
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-06-04 23:45:51 -07:00
|
|
|
accountAliases: v.software === PLEROMA,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* The accounts API allows an acct instead of an ID.
|
|
|
|
* @see GET /api/v1/accounts/:acct_or_id
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
accountByUsername: v.software === PLEROMA,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-04-30 10:02:30 -07:00
|
|
|
/**
|
|
|
|
* Ability to create accounts.
|
|
|
|
* @see POST /api/v1/accounts
|
|
|
|
*/
|
|
|
|
accountCreation: any([
|
|
|
|
v.software === MASTODON,
|
2022-03-04 10:47:59 -08:00
|
|
|
v.software === PLEROMA,
|
|
|
|
]),
|
2022-04-30 10:02:30 -07:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Ability to pin other accounts on one's profile.
|
|
|
|
* @see POST /api/v1/accounts/:id/pin
|
|
|
|
* @see POST /api/v1/accounts/:id/unpin
|
|
|
|
* @see GET /api/v1/pleroma/accounts/:id/endorsements
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
accountEndorsements: v.software === PLEROMA && gte(v.version, '2.4.50'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Ability to set one's location on their profile.
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-27 11:50:13 -07:00
|
|
|
accountLocation: any([
|
|
|
|
v.software === PLEROMA && v.build === SOAPBOX && gte(v.version, '2.4.50'),
|
2022-03-30 08:58:06 -07:00
|
|
|
v.software === TRUTHSOCIAL,
|
2021-11-26 21:36:17 -08:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Look up an account by the acct.
|
|
|
|
* @see GET /api/v1/accounts/lookup
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
accountLookup: any([
|
2021-11-26 21:36:17 -08:00
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.4.0'),
|
2022-04-23 13:54:57 -07:00
|
|
|
v.software === PLEROMA && gte(v.version, '2.4.50'),
|
2022-03-30 08:58:06 -07:00
|
|
|
v.software === TRUTHSOCIAL,
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Move followers to a different ActivityPub account.
|
|
|
|
* @see POST /api/pleroma/move_account
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-08-01 09:35:03 -07:00
|
|
|
accountMoving: v.software === PLEROMA && gte(v.version, '2.4.50'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Ability to subscribe to notifications every time an account posts.
|
|
|
|
* @see POST /api/v1/accounts/:id/follow
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
accountNotifies: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.3.0'),
|
|
|
|
v.software === PLEROMA && gte(v.version, '2.4.50'),
|
2022-07-19 12:22:19 -07:00
|
|
|
v.software === TRUTHSOCIAL,
|
2021-10-05 10:59:37 -07:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Ability to subscribe to notifications every time an account posts.
|
|
|
|
* @see POST /api/v1/pleroma/accounts/:id/subscribe
|
|
|
|
* @see POST /api/v1/pleroma/accounts/:id/unsubscribe
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
accountSubscriptions: v.software === PLEROMA && gte(v.version, '1.0.0'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Ability to set one's website on their profile.
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
accountWebsite: v.software === TRUTHSOCIAL,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-07-10 14:18:24 -07:00
|
|
|
/**
|
|
|
|
* Can display announcements set by admins.
|
|
|
|
* @see GET /api/v1/announcements
|
|
|
|
* @see POST /api/v1/announcements/:id/dismiss
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/announcements/}
|
|
|
|
*/
|
2022-07-06 14:25:19 -07:00
|
|
|
announcements: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.1.0'),
|
|
|
|
v.software === PLEROMA && gte(v.version, '2.2.49'),
|
|
|
|
]),
|
|
|
|
|
2022-07-10 14:18:24 -07:00
|
|
|
/**
|
|
|
|
* Can emoji react to announcements set by admins.
|
|
|
|
* @see PUT /api/v1/announcements/:id/reactions/:name
|
|
|
|
* @see DELETE /api/v1/announcements/:id/reactions/:name
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/announcements/}
|
|
|
|
*/
|
|
|
|
announcementsReactions: v.software === MASTODON && gte(v.compatVersion, '3.1.0'),
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Set your birthday and view upcoming birthdays.
|
|
|
|
* @see GET /api/v1/pleroma/birthdays
|
|
|
|
* @see POST /api/v1/accounts
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-07-04 11:17:01 -07:00
|
|
|
birthdays: v.software === PLEROMA && v.build === SOAPBOX && gte(v.version, '2.4.50'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/** Whether people who blocked you are visible through the API. */
|
2022-01-14 17:06:31 -08:00
|
|
|
blockersVisible: features.includes('blockers_visible'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can bookmark statuses.
|
|
|
|
* @see POST /api/v1/statuses/:id/bookmark
|
|
|
|
* @see GET /api/v1/bookmarks
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
bookmarks: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.1.0'),
|
2021-10-05 15:24:01 -07:00
|
|
|
v.software === PLEROMA && gte(v.version, '0.9.9'),
|
2022-04-23 13:54:57 -07:00
|
|
|
v.software === PIXELFED,
|
2022-03-30 08:58:06 -07:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-04-29 14:31:46 -07:00
|
|
|
/**
|
|
|
|
* Accounts can be marked as bots.
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
|
|
|
*/
|
|
|
|
bots: any([
|
|
|
|
v.software === MASTODON,
|
|
|
|
v.software === PLEROMA,
|
2021-10-05 15:24:01 -07:00
|
|
|
]),
|
2022-04-29 14:31:46 -07:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Pleroma chats API.
|
|
|
|
* @see {@link https://docs.pleroma.social/backend/development/API/chats/}
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
chats: v.software === PLEROMA && gte(v.version, '2.1.0'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Paginated chats API.
|
|
|
|
* @see GET /api/v2/chats
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
chatsV2: v.software === PLEROMA && gte(v.version, '2.3.0'),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mastodon's newer solution for direct messaging.
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/timelines/conversations/}
|
|
|
|
*/
|
2021-10-05 15:24:01 -07:00
|
|
|
conversations: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '2.6.0'),
|
|
|
|
v.software === PLEROMA && gte(v.version, '0.9.9'),
|
2022-04-23 13:54:57 -07:00
|
|
|
v.software === PIXELFED,
|
2022-04-12 18:10:47 -07:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Legacy DMs timeline where messages are displayed chronologically without groupings.
|
|
|
|
* @see GET /api/v1/timelines/direct
|
|
|
|
*/
|
2021-10-05 15:24:01 -07:00
|
|
|
directTimeline: any([
|
|
|
|
v.software === MASTODON && lt(v.compatVersion, '3.0.0'),
|
|
|
|
v.software === PLEROMA && gte(v.version, '0.9.9'),
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-06-21 15:43:51 -07:00
|
|
|
editStatuses: any([
|
|
|
|
v.software === MASTODON && gte(v.version, '3.5.0'),
|
|
|
|
features.includes('editing'),
|
|
|
|
]),
|
2022-04-27 13:50:35 -07:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Soapbox email list.
|
|
|
|
* @see POST /api/v1/accounts
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
|
|
|
* @see GET /api/v1/pleroma/admin/email_list/subscribers.csv
|
|
|
|
* @see GET /api/v1/pleroma/admin/email_list/unsubscribers.csv
|
|
|
|
* @see GET /api/v1/pleroma/admin/email_list/combined.csv
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
emailList: features.includes('email_list'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-05-03 13:43:55 -07:00
|
|
|
/**
|
|
|
|
* Ability to embed posts on external sites.
|
|
|
|
* @see GET /api/oembed
|
|
|
|
*/
|
|
|
|
embeds: v.software === MASTODON,
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
|
|
|
* Ability to add emoji reactions to a status.
|
|
|
|
* @see PUT /api/v1/pleroma/statuses/:id/reactions/:emoji
|
|
|
|
* @see GET /api/v1/pleroma/statuses/:id/reactions/:emoji?
|
|
|
|
* @see DELETE /api/v1/pleroma/statuses/:id/reactions/:emoji
|
|
|
|
*/
|
2021-09-18 12:27:15 -07:00
|
|
|
emojiReacts: v.software === PLEROMA && gte(v.version, '2.0.0'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The backend allows only RGI ("Recommended for General Interchange") emoji reactions.
|
|
|
|
* @see PUT /api/v1/pleroma/statuses/:id/reactions/:emoji
|
|
|
|
*/
|
2021-09-18 12:27:15 -07:00
|
|
|
emojiReactsRGI: v.software === PLEROMA && gte(v.version, '2.2.49'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Sign in with an Ethereum wallet.
|
|
|
|
* @see POST /oauth/token
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
ethereumLogin: v.software === MITRA,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Ability to address recipients of a status explicitly (with `to`).
|
|
|
|
* @see POST /api/v1/statuses
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
explicitAddressing: any([
|
|
|
|
v.software === PLEROMA && gte(v.version, '1.0.0'),
|
|
|
|
v.software === TRUTHSOCIAL,
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-04-23 13:54:57 -07:00
|
|
|
/** Whether the accounts who favourited or emoji-reacted to a status can be viewed through the API. */
|
2022-05-12 11:43:48 -07:00
|
|
|
exposableReactions: any([
|
|
|
|
v.software === MASTODON,
|
2022-07-19 12:22:19 -07:00
|
|
|
v.software === TRUTHSOCIAL,
|
2022-05-12 11:43:48 -07:00
|
|
|
features.includes('exposable_reactions'),
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-05-13 14:14:55 -07:00
|
|
|
/**
|
|
|
|
* Can see accounts' followers you know
|
|
|
|
* @see GET /api/v1/accounts/familiar_followers
|
|
|
|
*/
|
|
|
|
familiarFollowers: v.software === MASTODON && gte(v.version, '3.5.0'),
|
|
|
|
|
2022-04-23 13:54:57 -07:00
|
|
|
/** Whether the instance federates. */
|
|
|
|
federating: federation.get('enabled', true) === true, // Assume true unless explicitly false
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-06-22 05:55:55 -07:00
|
|
|
/** Whether or not to show the Feed Carousel for suggested Statuses */
|
|
|
|
feedUserFiltering: v.software === TRUTHSOCIAL,
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can edit and manage timeline filters (aka "muted words").
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/accounts/filters/}
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-07-16 10:59:00 -07:00
|
|
|
filters: any([
|
|
|
|
v.software === MASTODON && lt(v.compatVersion, '3.6.0'),
|
|
|
|
v.software === PLEROMA,
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Allows setting the focal point of a media attachment.
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/statuses/media/}
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2021-09-18 12:27:15 -07:00
|
|
|
focalPoint: v.software === MASTODON && gte(v.compatVersion, '2.3.0'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-04-29 14:31:46 -07:00
|
|
|
/**
|
|
|
|
* Ability to lock accounts and manually approve followers.
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
|
|
|
*/
|
|
|
|
followRequests: any([
|
|
|
|
v.software === MASTODON,
|
|
|
|
v.software === PLEROMA,
|
|
|
|
]),
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Whether client settings can be retrieved from the API.
|
|
|
|
* @see GET /api/pleroma/frontend_configurations
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
frontendConfigurations: v.software === PLEROMA,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-04-29 14:31:46 -07:00
|
|
|
/**
|
|
|
|
* Can hide follows/followers lists and counts.
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
|
|
|
*/
|
|
|
|
hideNetwork: v.software === PLEROMA,
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Pleroma import API.
|
|
|
|
* @see POST /api/pleroma/follow_import
|
|
|
|
* @see POST /api/pleroma/blocks_import
|
|
|
|
* @see POST /api/pleroma/mutes_import
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-06-04 23:45:51 -07:00
|
|
|
import: v.software === PLEROMA,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-05-24 11:06:59 -07:00
|
|
|
* Pleroma import endpoints.
|
|
|
|
* @see POST /api/pleroma/follow_import
|
|
|
|
* @see POST /api/pleroma/blocks_import
|
2022-04-23 13:54:57 -07:00
|
|
|
* @see POST /api/pleroma/mutes_import
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-05-24 11:06:59 -07:00
|
|
|
importData: v.software === PLEROMA && gte(v.version, '2.2.0'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can create, view, and manage lists.
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/timelines/lists/}
|
|
|
|
* @see GET /api/v1/timelines/list/:list_id
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
lists: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '2.1.0'),
|
|
|
|
v.software === PLEROMA && gte(v.version, '0.9.9'),
|
2022-03-26 12:06:25 -07:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-05-15 06:11:59 -07:00
|
|
|
/**
|
|
|
|
* Can perform moderation actions with account and reports.
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/admin/}
|
|
|
|
* @see GET /api/v1/admin/reports
|
|
|
|
* @see POST /api/v1/admin/reports/:report_id/resolve
|
|
|
|
* @see POST /api/v1/admin/reports/:report_id/reopen
|
|
|
|
* @see POST /api/v1/admin/accounts/:account_id/action
|
|
|
|
* @see POST /api/v1/admin/accounts/:account_id/approve
|
|
|
|
*/
|
2022-06-04 23:45:51 -07:00
|
|
|
mastodonAdmin: any([
|
2022-05-15 06:11:59 -07:00
|
|
|
v.software === MASTODON && gte(v.compatVersion, '2.9.1'),
|
|
|
|
v.software === PLEROMA && v.build === SOAPBOX && gte(v.version, '2.4.50'),
|
|
|
|
]),
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can upload media attachments to statuses.
|
|
|
|
* @see POST /api/v1/media
|
|
|
|
* @see POST /api/v1/statuses
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
media: true,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Supports V2 media uploads.
|
|
|
|
* @see POST /api/v2/media
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
mediaV2: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.1.3'),
|
|
|
|
// Even though Pleroma supports these endpoints, it has disadvantages
|
|
|
|
// v.software === PLEROMA && gte(v.version, '2.1.0'),
|
2022-03-26 12:06:25 -07:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-04-29 15:00:17 -07:00
|
|
|
/**
|
|
|
|
* Ability to hide notifications from people you don't follow.
|
|
|
|
* @see PUT /api/pleroma/notification_settings
|
|
|
|
*/
|
|
|
|
muteStrangers: v.software === PLEROMA,
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Add private notes to accounts.
|
|
|
|
* @see POST /api/v1/accounts/:id/note
|
|
|
|
* @see GET /api/v1/accounts/relationships
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
notes: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.2.0'),
|
2021-12-30 07:13:45 -08:00
|
|
|
v.software === PLEROMA && gte(v.version, '2.4.50'),
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-04-23 20:31:49 -07:00
|
|
|
/**
|
|
|
|
* Supports pagination in threads.
|
|
|
|
* @see GET /api/v1/statuses/:id/context/ancestors
|
|
|
|
* @see GET /api/v1/statuses/:id/context/descendants
|
|
|
|
*/
|
|
|
|
paginatedContext: v.software === TRUTHSOCIAL,
|
|
|
|
|
2022-06-09 12:51:50 -07:00
|
|
|
/**
|
|
|
|
* Require minimum password requirements.
|
|
|
|
* - 8 characters
|
|
|
|
* - 1 uppercase
|
|
|
|
* - 1 lowercase
|
|
|
|
*/
|
|
|
|
passwordRequirements: v.software === TRUTHSOCIAL,
|
|
|
|
|
2022-05-14 09:21:12 -07:00
|
|
|
/**
|
|
|
|
* Displays a form to follow a user when logged out.
|
|
|
|
* @see POST /main/ostatus
|
|
|
|
*/
|
|
|
|
pleromaRemoteFollow: v.software === PLEROMA,
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can add polls to statuses.
|
|
|
|
* @see POST /api/v1/statuses
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
polls: any([
|
|
|
|
v.software === MASTODON && gte(v.version, '2.8.0'),
|
|
|
|
v.software === PLEROMA,
|
2022-07-19 12:22:19 -07:00
|
|
|
v.software === TRUTHSOCIAL,
|
2022-04-23 13:54:57 -07:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can set privacy scopes on statuses.
|
|
|
|
* @see POST /api/v1/statuses
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
privacyScopes: v.software !== TRUTHSOCIAL,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A directory of discoverable profiles from the instance.
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/instance/directory/}
|
|
|
|
*/
|
2021-12-25 09:21:20 -08:00
|
|
|
profileDirectory: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.0.0'),
|
|
|
|
features.includes('profile_directory'),
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-05-02 20:17:23 -07:00
|
|
|
* Ability to set custom profile fields.
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
|
|
|
*/
|
|
|
|
profileFields: any([
|
|
|
|
v.software === MASTODON,
|
|
|
|
v.software === PLEROMA,
|
2021-12-29 14:54:16 -08:00
|
|
|
]),
|
2022-05-02 20:17:23 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can display a timeline of all known public statuses.
|
|
|
|
* Local and Fediverse timelines both use this feature.
|
|
|
|
* @see GET /api/v1/timelines/public
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
publicTimeline: any([
|
|
|
|
v.software === MASTODON,
|
|
|
|
v.software === PLEROMA,
|
2022-03-26 12:06:25 -07:00
|
|
|
]),
|
2022-04-23 13:54:57 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ability to quote posts in statuses.
|
|
|
|
* @see POST /api/v1/statuses
|
|
|
|
*/
|
2022-02-12 18:08:38 -08:00
|
|
|
quotePosts: any([
|
2022-05-03 10:40:54 -07:00
|
|
|
v.software === PLEROMA && v.build === SOAPBOX && gte(v.version, '2.4.50'),
|
2022-03-26 12:23:29 -07:00
|
|
|
instance.feature_quote === true,
|
2022-02-12 18:08:38 -08:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interact with statuses from another instance while logged-out.
|
|
|
|
* @see POST /api/v1/pleroma/remote_interaction
|
|
|
|
*/
|
2022-06-04 23:45:51 -07:00
|
|
|
remoteInteractions: v.software === PLEROMA && gte(v.version, '2.4.50'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-05-17 04:05:01 -07:00
|
|
|
/**
|
|
|
|
* Ability to remove an account from your followers.
|
|
|
|
* @see POST /api/v1/accounts/:id/remove_from_followers
|
|
|
|
*/
|
|
|
|
removeFromFollowers: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.5.0'),
|
|
|
|
v.software === PLEROMA && v.build === SOAPBOX && gte(v.version, '2.4.50'),
|
|
|
|
]),
|
|
|
|
|
2022-04-27 07:11:21 -07:00
|
|
|
reportMultipleStatuses: any([
|
|
|
|
v.software === MASTODON,
|
|
|
|
v.software === PLEROMA,
|
2022-02-26 06:57:09 -08:00
|
|
|
]),
|
2022-04-27 07:11:21 -07:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can request a password reset email through the API.
|
|
|
|
* @see POST /auth/password
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-06-04 23:45:51 -07:00
|
|
|
resetPassword: v.software === PLEROMA,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Ability to post statuses in Markdown, BBCode, and HTML.
|
|
|
|
* @see POST /api/v1/statuses
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-05-12 11:10:23 -07:00
|
|
|
richText: any([
|
2022-05-12 11:26:36 -07:00
|
|
|
v.software === MASTODON && v.build === GLITCH,
|
2022-05-12 11:10:23 -07:00
|
|
|
v.software === PLEROMA,
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can schedule statuses to be posted at a later time.
|
2022-04-23 13:40:54 -07:00
|
|
|
* @see POST /api/v1/statuses
|
2022-04-23 13:54:57 -07:00
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/statuses/scheduled_statuses/}
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
scheduledStatuses: any([
|
|
|
|
v.software === MASTODON && gte(v.version, '2.7.0'),
|
|
|
|
v.software === PLEROMA,
|
2022-02-12 18:08:38 -08:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* List of OAuth scopes supported by both Soapbox and the backend.
|
|
|
|
* @see POST /api/v1/apps
|
|
|
|
* @see POST /oauth/token
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-07-21 13:26:46 -07:00
|
|
|
scopes: v.software === PLEROMA ? 'read write follow push admin' : 'read write follow push admin:read admin:write',
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Ability to manage account security settings.
|
|
|
|
* @see POST /api/pleroma/change_password
|
|
|
|
* @see POST /api/pleroma/change_email
|
|
|
|
* @see POST /api/pleroma/delete_account
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-06-04 23:45:51 -07:00
|
|
|
security: any([
|
2022-04-23 13:54:57 -07:00
|
|
|
v.software === PLEROMA,
|
|
|
|
v.software === TRUTHSOCIAL,
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-05-12 08:45:40 -07:00
|
|
|
/**
|
|
|
|
* Ability to manage account sessions.
|
|
|
|
* @see GET /api/oauth_tokens.json
|
|
|
|
* @see DELETE /api/oauth_tokens/:id
|
|
|
|
*/
|
2022-06-04 23:45:51 -07:00
|
|
|
sessions: v.software === PLEROMA,
|
2022-05-12 08:45:40 -07:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can store client settings in the database.
|
|
|
|
* @see PATCH /api/v1/accounts/update_credentials
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
settingsStore: any([
|
|
|
|
v.software === PLEROMA,
|
|
|
|
v.software === TRUTHSOCIAL,
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can set content warnings on statuses.
|
|
|
|
* @see POST /api/v1/statuses
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
spoilers: v.software !== TRUTHSOCIAL,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can display suggested accounts.
|
|
|
|
* @see {@link https://docs.joinmastodon.org/methods/accounts/suggestions/}
|
|
|
|
*/
|
|
|
|
suggestions: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '2.4.3'),
|
|
|
|
v.software === TRUTHSOCIAL,
|
|
|
|
features.includes('v2_suggestions'),
|
2022-02-26 06:57:09 -08:00
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Supports V2 suggested accounts.
|
|
|
|
* @see GET /api/v2/suggestions
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
suggestionsV2: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.4.0'),
|
|
|
|
v.software === TRUTHSOCIAL,
|
|
|
|
features.includes('v2_suggestions'),
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Trending statuses.
|
|
|
|
* @see GET /api/v1/trends/statuses
|
|
|
|
*/
|
2022-03-29 12:15:06 -07:00
|
|
|
trendingStatuses: v.software === MASTODON && gte(v.compatVersion, '3.5.0'),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Truth Social trending statuses API.
|
|
|
|
* @see GET /api/v1/truth/trending/truths
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
trendingTruths: v.software === TRUTHSOCIAL,
|
2022-04-23 13:40:54 -07:00
|
|
|
|
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Can display trending hashtags.
|
|
|
|
* @see GET /api/v1/trends
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
trends: any([
|
|
|
|
v.software === MASTODON && gte(v.compatVersion, '3.0.0'),
|
|
|
|
v.software === TRUTHSOCIAL,
|
|
|
|
]),
|
2022-04-23 13:40:54 -07:00
|
|
|
|
2022-07-01 13:09:07 -07:00
|
|
|
/**
|
|
|
|
* Supports Truth suggestions.
|
|
|
|
*/
|
|
|
|
truthSuggestions: v.software === TRUTHSOCIAL,
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/**
|
2022-04-23 13:54:57 -07:00
|
|
|
* Whether the backend allows adding users you don't follow to lists.
|
|
|
|
* @see POST /api/v1/lists/:id/accounts
|
2022-04-23 13:40:54 -07:00
|
|
|
*/
|
2022-04-23 13:54:57 -07:00
|
|
|
unrestrictedLists: v.software === PLEROMA,
|
2022-03-26 12:23:29 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Features available from a backend */
|
2022-03-30 13:50:16 -07:00
|
|
|
export type Features = ReturnType<typeof getInstanceFeatures>;
|
2022-03-26 12:23:29 -07:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Detect backend features to conditionally render elements */
|
2022-03-26 12:23:29 -07:00
|
|
|
export const getFeatures = createSelector([
|
|
|
|
(instance: Instance) => instance,
|
|
|
|
], (instance): Features => {
|
|
|
|
const features = getInstanceFeatures(instance);
|
|
|
|
return Object.assign(features, overrides) as Features;
|
2021-07-06 11:06:21 -07:00
|
|
|
});
|
2020-05-17 12:44:33 -07:00
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Fediverse backend */
|
2022-03-26 12:23:29 -07:00
|
|
|
interface Backend {
|
2022-04-27 11:50:13 -07:00
|
|
|
/** Build name, if this software is a fork */
|
|
|
|
build: string | null,
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Name of the software */
|
2022-03-26 12:23:29 -07:00
|
|
|
software: string | null,
|
2022-04-23 13:40:54 -07:00
|
|
|
/** API version number */
|
2022-03-26 12:23:29 -07:00
|
|
|
version: string,
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Mastodon API version this backend is compatible with */
|
2022-03-26 12:23:29 -07:00
|
|
|
compatVersion: string,
|
|
|
|
}
|
|
|
|
|
2022-04-23 13:40:54 -07:00
|
|
|
/** Get information about the software from its version string */
|
2022-03-26 12:23:29 -07:00
|
|
|
export const parseVersion = (version: string): Backend => {
|
2022-04-27 11:50:13 -07:00
|
|
|
const regex = /^([\w+.]*)(?: \(compatible; ([\w]*) (.*)\))?$/;
|
2021-08-03 10:10:42 -07:00
|
|
|
const match = regex.exec(version);
|
2022-02-06 18:46:06 -08:00
|
|
|
|
2022-04-27 11:50:13 -07:00
|
|
|
const semver = match ? semverParse(match[3] || match[1]) : null;
|
|
|
|
const compat = match ? semverParse(match[1]) : null;
|
|
|
|
|
|
|
|
if (match && semver && compat) {
|
2022-02-06 18:46:06 -08:00
|
|
|
return {
|
2022-04-27 11:50:13 -07:00
|
|
|
build: semver.build[0],
|
|
|
|
compatVersion: compat.version,
|
2022-02-06 18:46:06 -08:00
|
|
|
software: match[2] || MASTODON,
|
2022-04-27 11:50:13 -07:00
|
|
|
version: semver.version,
|
2022-02-06 18:46:06 -08:00
|
|
|
};
|
|
|
|
} else {
|
|
|
|
// If we can't parse the version, this is a new and exotic backend.
|
|
|
|
// Fall back to minimal featureset.
|
|
|
|
return {
|
2022-04-27 11:50:13 -07:00
|
|
|
build: null,
|
2022-04-23 13:54:57 -07:00
|
|
|
compatVersion: '0.0.0',
|
2022-02-06 18:46:06 -08:00
|
|
|
software: null,
|
|
|
|
version: '0.0.0',
|
|
|
|
};
|
|
|
|
}
|
2020-05-17 12:44:33 -07:00
|
|
|
};
|