diff --git a/app/soapbox/actions/scheduled-statuses.ts b/app/soapbox/actions/scheduled-statuses.ts index ddc550105..33e763701 100644 --- a/app/soapbox/actions/scheduled-statuses.ts +++ b/app/soapbox/actions/scheduled-statuses.ts @@ -1,3 +1,5 @@ +import { getFeatures } from 'soapbox/utils/features'; + import api, { getLinks } from '../api'; import type { AxiosError } from 'axios'; @@ -18,10 +20,17 @@ const SCHEDULED_STATUS_CANCEL_FAIL = 'SCHEDULED_STATUS_CANCEL_FAIL'; const fetchScheduledStatuses = () => (dispatch: AppDispatch, getState: () => RootState) => { - if (getState().status_lists.get('scheduled_statuses')?.isLoading) { + const state = getState(); + + if (state.status_lists.get('scheduled_statuses')?.isLoading) { return; } + const instance = state.instance; + const features = getFeatures(instance); + + if (!features.scheduledStatuses) return; + dispatch(fetchScheduledStatusesRequest()); api(getState).get('/api/v1/scheduled_statuses').then(response => { diff --git a/app/soapbox/actions/trending-statuses.ts b/app/soapbox/actions/trending-statuses.ts index 435fcf6df..7ccab27ab 100644 --- a/app/soapbox/actions/trending-statuses.ts +++ b/app/soapbox/actions/trending-statuses.ts @@ -17,6 +17,8 @@ const fetchTrendingStatuses = () => const instance = state.instance; const features = getFeatures(instance); + if (!features.trendingStatuses && !features.trendingTruths) return; + dispatch({ type: TRENDING_STATUSES_FETCH_REQUEST }); return api(getState).get(features.trendingTruths ? '/api/v1/truth/trending/truths' : '/api/v1/trends/statuses').then(({ data: statuses }) => { dispatch(importFetchedStatuses(statuses)); diff --git a/app/soapbox/features/settings/index.tsx b/app/soapbox/features/settings/index.tsx index c0a7a3056..06b8bf8a2 100644 --- a/app/soapbox/features/settings/index.tsx +++ b/app/soapbox/features/settings/index.tsx @@ -52,7 +52,7 @@ const Settings = () => { const isMfaEnabled = mfa.getIn(['settings', 'totp']); useEffect(() => { - dispatch(fetchMfa()); + if (features.security) dispatch(fetchMfa()); }, [dispatch]); if (!account) return null; diff --git a/app/soapbox/normalizers/instance.ts b/app/soapbox/normalizers/instance.ts index e7933b080..8a13a89b8 100644 --- a/app/soapbox/normalizers/instance.ts +++ b/app/soapbox/normalizers/instance.ts @@ -101,6 +101,17 @@ const normalizeVersion = (instance: ImmutableMap) => { }); }; +/** Rename Akkoma to Pleroma+akkoma */ +const fixTakahe = (instance: ImmutableMap) => { + const version: string = instance.get('version', ''); + + if (version.startsWith('takahe/')) { + return instance.set('version', `0.0.0 (compatible; takahe ${version.slice(7)})`); + } else { + return instance; + } +}; + /** Rename Akkoma to Pleroma+akkoma */ const fixAkkoma = (instance: ImmutableMap) => { const version: string = instance.get('version', ''); @@ -131,6 +142,7 @@ export const normalizeInstance = (instance: Record) => { // Normalize version normalizeVersion(instance); + fixTakahe(instance); fixAkkoma(instance); // Merge defaults diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index deb53b0cb..cd5addcce 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -64,6 +64,12 @@ export const GLITCH = 'glitch'; */ export const AKKOMA = 'akkoma'; +/** + * Takahē, backend with support for serving multiple domains. + * @see {@link https://jointakahe.org/} + */ +export const TAKAHE = 'takahe'; + /** Parse features for the given instance */ const getInstanceFeatures = (instance: Instance) => { const v = parseVersion(instance.version); @@ -288,6 +294,7 @@ const getInstanceFeatures = (instance: Instance) => { v.software === MASTODON && gte(v.compatVersion, '2.6.0'), v.software === PLEROMA && gte(v.version, '0.9.9'), v.software === PIXELFED, + v.software === TAKAHE, ]), /** @@ -299,6 +306,14 @@ const getInstanceFeatures = (instance: Instance) => { v.software === PLEROMA && gte(v.version, '0.9.9'), ]), + editProfile: any([ + v.software === MASTODON, + v.software === MITRA, + v.software === PIXELFED, + v.software === PLEROMA, + v.software === TRUTHSOCIAL, + ]), + editStatuses: any([ v.software === MASTODON && gte(v.version, '3.5.0'), features.includes('editing'), @@ -574,6 +589,7 @@ const getInstanceFeatures = (instance: Instance) => { publicTimeline: any([ v.software === MASTODON, v.software === PLEROMA, + v.software === TAKAHE, ]), /**