diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b2a108d5..7a76c58a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - UI: added backdrop blur behind modals. - Admin: let admins configure media preview for attachment thumbnails. - Login: accept `?server` param in external login, eg `fe.soapbox.pub/login/external?server=gleasonator.com`. +- Backups: restored Pleroma backups functionality. ### Changed - Posts: letterbox images to 19:6 again. diff --git a/app/soapbox/features/backups/index.tsx b/app/soapbox/features/backups/index.tsx index b47f10766..5e1dd705f 100644 --- a/app/soapbox/features/backups/index.tsx +++ b/app/soapbox/features/backups/index.tsx @@ -1,10 +1,9 @@ -import classNames from 'clsx'; import React, { useEffect, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { fetchBackups, createBackup } from 'soapbox/actions/backups'; import ScrollableList from 'soapbox/components/scrollable-list'; -import { Column } from 'soapbox/components/ui'; +import { Button, Column, FormActions, Text } from 'soapbox/components/ui'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; const messages = defineMessages({ @@ -23,22 +22,14 @@ const Backups = () => { const [isLoading, setIsLoading] = useState(true); - const handleCreateBackup: React.MouseEventHandler = e => { + const handleCreateBackup: React.MouseEventHandler = e => { dispatch(createBackup()); e.preventDefault(); }; - const makeColumnMenu = () => { - return [{ - text: intl.formatMessage(messages.create), - action: handleCreateBackup, - icon: require('@tabler/icons/plus.svg'), - }]; - }; - useEffect(() => { dispatch(fetchBackups()).then(() => { - setIsLoading(true); + setIsLoading(false); }).catch(() => {}); }, []); @@ -46,16 +37,14 @@ const Backups = () => { const emptyMessageAction = ( - {intl.formatMessage(messages.emptyMessageAction)} + + {intl.formatMessage(messages.emptyMessageAction)} + ); return ( - + { > {backups.map((backup) => (
{backup.processed ? {backup.inserted_at} - :
{intl.formatMessage(messages.pending)}: {backup.inserted_at}
+ : {intl.formatMessage(messages.pending)}: {backup.inserted_at} }
))}
+ + + +
); }; diff --git a/app/soapbox/features/settings/index.tsx b/app/soapbox/features/settings/index.tsx index a0842984a..fce0ec814 100644 --- a/app/soapbox/features/settings/index.tsx +++ b/app/soapbox/features/settings/index.tsx @@ -27,6 +27,7 @@ const messages = defineMessages({ other: { id: 'settings.other', defaultMessage: 'Other options' }, mfaEnabled: { id: 'mfa.enabled', defaultMessage: 'Enabled' }, mfaDisabled: { id: 'mfa.disabled', defaultMessage: 'Disabled' }, + backups: { id: 'column.backups', defaultMessage: 'Backups' }, }); /** User settings page. */ @@ -47,6 +48,7 @@ const Settings = () => { const navigateToDeleteAccount = () => history.push('/settings/account'); const navigateToMoveAccount = () => history.push('/settings/migration'); const navigateToAliases = () => history.push('/settings/aliases'); + const navigateToBackups = () => history.push('/settings/backups'); const isMfaEnabled = mfa.getIn(['settings', 'totp']); @@ -136,6 +138,10 @@ const Settings = () => { ))} + {features.backups && ( + + )} + {features.security && ( )} diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index 319ae539f..211fefc46 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -78,7 +78,7 @@ import { SoapboxConfig, // ExportData, ImportData, - // Backups, + Backups, MfaForm, ChatIndex, ChatWidget, @@ -278,6 +278,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { {features.importData && } {features.accountAliases && } {features.accountMoving && } + {features.backups && } @@ -285,7 +286,6 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { - {/* */} diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index d224502ff..f625c4f37 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -178,6 +178,13 @@ const getInstanceFeatures = (instance: Instance) => { */ announcementsReactions: v.software === MASTODON && gte(v.compatVersion, '3.1.0'), + /** + * Pleroma backups. + * @see GET /api/v1/pleroma/backups + * @see POST /api/v1/pleroma/backups + */ + backups: v.software === PLEROMA, + /** * Set your birthday and view upcoming birthdays. * @see GET /api/v1/pleroma/birthdays diff --git a/app/styles/application.scss b/app/styles/application.scss index 828c678d1..d8a9cbe3d 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -43,7 +43,6 @@ @import 'components/video-player'; @import 'components/audio-player'; @import 'components/filters'; -@import 'components/backups'; @import 'components/crypto-donate'; @import 'components/aliases'; @import 'components/icon'; diff --git a/app/styles/components/backups.scss b/app/styles/components/backups.scss deleted file mode 100644 index 728d9375e..000000000 --- a/app/styles/components/backups.scss +++ /dev/null @@ -1,12 +0,0 @@ -.backup { - padding: 15px; - border-bottom: 1px solid var(--brand-color--faint); - - a { - color: var(--brand-color--hicontrast); - } - - &--pending { - @apply text-gray-400 italic; - } -}