Expose backups again
This commit is contained in:
parent
994d9ebd35
commit
98f311873c
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- UI: added backdrop blur behind modals.
|
- UI: added backdrop blur behind modals.
|
||||||
- Admin: let admins configure media preview for attachment thumbnails.
|
- 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`.
|
- Login: accept `?server` param in external login, eg `fe.soapbox.pub/login/external?server=gleasonator.com`.
|
||||||
|
- Backups: restored Pleroma backups functionality.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Posts: letterbox images to 19:6 again.
|
- Posts: letterbox images to 19:6 again.
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import classNames from 'clsx';
|
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { fetchBackups, createBackup } from 'soapbox/actions/backups';
|
import { fetchBackups, createBackup } from 'soapbox/actions/backups';
|
||||||
import ScrollableList from 'soapbox/components/scrollable-list';
|
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';
|
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
@ -23,22 +22,14 @@ const Backups = () => {
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
const handleCreateBackup: React.MouseEventHandler<HTMLAnchorElement> = e => {
|
const handleCreateBackup: React.MouseEventHandler = e => {
|
||||||
dispatch(createBackup());
|
dispatch(createBackup());
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
const makeColumnMenu = () => {
|
|
||||||
return [{
|
|
||||||
text: intl.formatMessage(messages.create),
|
|
||||||
action: handleCreateBackup,
|
|
||||||
icon: require('@tabler/icons/plus.svg'),
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchBackups()).then(() => {
|
dispatch(fetchBackups()).then(() => {
|
||||||
setIsLoading(true);
|
setIsLoading(false);
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -46,16 +37,14 @@ const Backups = () => {
|
||||||
|
|
||||||
const emptyMessageAction = (
|
const emptyMessageAction = (
|
||||||
<a href='#' onClick={handleCreateBackup}>
|
<a href='#' onClick={handleCreateBackup}>
|
||||||
|
<Text tag='span' theme='primary' size='sm' className='hover:underline'>
|
||||||
{intl.formatMessage(messages.emptyMessageAction)}
|
{intl.formatMessage(messages.emptyMessageAction)}
|
||||||
|
</Text>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column
|
<Column label={intl.formatMessage(messages.heading)}>
|
||||||
label={intl.formatMessage(messages.heading)}
|
|
||||||
// @ts-ignore FIXME: make this menu available.
|
|
||||||
menu={makeColumnMenu()}
|
|
||||||
>
|
|
||||||
<ScrollableList
|
<ScrollableList
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
showLoading={showLoading}
|
showLoading={showLoading}
|
||||||
|
@ -64,16 +53,22 @@ const Backups = () => {
|
||||||
>
|
>
|
||||||
{backups.map((backup) => (
|
{backups.map((backup) => (
|
||||||
<div
|
<div
|
||||||
className={classNames('backup', { 'backup--pending': !backup.processed })}
|
className='p-4'
|
||||||
key={backup.id}
|
key={backup.id}
|
||||||
>
|
>
|
||||||
{backup.processed
|
{backup.processed
|
||||||
? <a href={backup.url} target='_blank'>{backup.inserted_at}</a>
|
? <a href={backup.url} target='_blank'>{backup.inserted_at}</a>
|
||||||
: <div>{intl.formatMessage(messages.pending)}: {backup.inserted_at}</div>
|
: <Text theme='subtle'>{intl.formatMessage(messages.pending)}: {backup.inserted_at}</Text>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</ScrollableList>
|
</ScrollableList>
|
||||||
|
|
||||||
|
<FormActions>
|
||||||
|
<Button theme='primary' disabled={isLoading} onClick={handleCreateBackup}>
|
||||||
|
{intl.formatMessage(messages.create)}
|
||||||
|
</Button>
|
||||||
|
</FormActions>
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@ const messages = defineMessages({
|
||||||
other: { id: 'settings.other', defaultMessage: 'Other options' },
|
other: { id: 'settings.other', defaultMessage: 'Other options' },
|
||||||
mfaEnabled: { id: 'mfa.enabled', defaultMessage: 'Enabled' },
|
mfaEnabled: { id: 'mfa.enabled', defaultMessage: 'Enabled' },
|
||||||
mfaDisabled: { id: 'mfa.disabled', defaultMessage: 'Disabled' },
|
mfaDisabled: { id: 'mfa.disabled', defaultMessage: 'Disabled' },
|
||||||
|
backups: { id: 'column.backups', defaultMessage: 'Backups' },
|
||||||
});
|
});
|
||||||
|
|
||||||
/** User settings page. */
|
/** User settings page. */
|
||||||
|
@ -47,6 +48,7 @@ const Settings = () => {
|
||||||
const navigateToDeleteAccount = () => history.push('/settings/account');
|
const navigateToDeleteAccount = () => history.push('/settings/account');
|
||||||
const navigateToMoveAccount = () => history.push('/settings/migration');
|
const navigateToMoveAccount = () => history.push('/settings/migration');
|
||||||
const navigateToAliases = () => history.push('/settings/aliases');
|
const navigateToAliases = () => history.push('/settings/aliases');
|
||||||
|
const navigateToBackups = () => history.push('/settings/backups');
|
||||||
|
|
||||||
const isMfaEnabled = mfa.getIn(['settings', 'totp']);
|
const isMfaEnabled = mfa.getIn(['settings', 'totp']);
|
||||||
|
|
||||||
|
@ -136,6 +138,10 @@ const Settings = () => {
|
||||||
<ListItem label={intl.formatMessage(messages.accountAliases)} onClick={navigateToAliases} />
|
<ListItem label={intl.formatMessage(messages.accountAliases)} onClick={navigateToAliases} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
{features.backups && (
|
||||||
|
<ListItem label={intl.formatMessage(messages.backups)} onClick={navigateToBackups} />
|
||||||
|
)}
|
||||||
|
|
||||||
{features.security && (
|
{features.security && (
|
||||||
<ListItem label={intl.formatMessage(messages.deleteAccount)} onClick={navigateToDeleteAccount} />
|
<ListItem label={intl.formatMessage(messages.deleteAccount)} onClick={navigateToDeleteAccount} />
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -78,7 +78,7 @@ import {
|
||||||
SoapboxConfig,
|
SoapboxConfig,
|
||||||
// ExportData,
|
// ExportData,
|
||||||
ImportData,
|
ImportData,
|
||||||
// Backups,
|
Backups,
|
||||||
MfaForm,
|
MfaForm,
|
||||||
ChatIndex,
|
ChatIndex,
|
||||||
ChatWidget,
|
ChatWidget,
|
||||||
|
@ -278,6 +278,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => {
|
||||||
{features.importData && <WrappedRoute path='/settings/import' page={DefaultPage} component={ImportData} content={children} />}
|
{features.importData && <WrappedRoute path='/settings/import' page={DefaultPage} component={ImportData} content={children} />}
|
||||||
{features.accountAliases && <WrappedRoute path='/settings/aliases' page={DefaultPage} component={Aliases} content={children} />}
|
{features.accountAliases && <WrappedRoute path='/settings/aliases' page={DefaultPage} component={Aliases} content={children} />}
|
||||||
{features.accountMoving && <WrappedRoute path='/settings/migration' page={DefaultPage} component={Migration} content={children} />}
|
{features.accountMoving && <WrappedRoute path='/settings/migration' page={DefaultPage} component={Migration} content={children} />}
|
||||||
|
{features.backups && <WrappedRoute path='/settings/backups' page={DefaultPage} component={Backups} content={children} />}
|
||||||
<WrappedRoute path='/settings/email' page={DefaultPage} component={EditEmail} content={children} />
|
<WrappedRoute path='/settings/email' page={DefaultPage} component={EditEmail} content={children} />
|
||||||
<WrappedRoute path='/settings/password' page={DefaultPage} component={EditPassword} content={children} />
|
<WrappedRoute path='/settings/password' page={DefaultPage} component={EditPassword} content={children} />
|
||||||
<WrappedRoute path='/settings/account' page={DefaultPage} component={DeleteAccount} content={children} />
|
<WrappedRoute path='/settings/account' page={DefaultPage} component={DeleteAccount} content={children} />
|
||||||
|
@ -285,7 +286,6 @@ const SwitchingColumnsArea: React.FC = ({ children }) => {
|
||||||
<WrappedRoute path='/settings/mfa' page={DefaultPage} component={MfaForm} exact />
|
<WrappedRoute path='/settings/mfa' page={DefaultPage} component={MfaForm} exact />
|
||||||
<WrappedRoute path='/settings/tokens' page={DefaultPage} component={AuthTokenList} content={children} />
|
<WrappedRoute path='/settings/tokens' page={DefaultPage} component={AuthTokenList} content={children} />
|
||||||
<WrappedRoute path='/settings' page={DefaultPage} component={Settings} content={children} />
|
<WrappedRoute path='/settings' page={DefaultPage} component={Settings} content={children} />
|
||||||
{/* <WrappedRoute path='/backups' page={DefaultPage} component={Backups} content={children} /> */}
|
|
||||||
<WrappedRoute path='/soapbox/config' adminOnly page={DefaultPage} component={SoapboxConfig} content={children} />
|
<WrappedRoute path='/soapbox/config' adminOnly page={DefaultPage} component={SoapboxConfig} content={children} />
|
||||||
|
|
||||||
<WrappedRoute path='/soapbox/admin' staffOnly page={AdminPage} component={Dashboard} content={children} exact />
|
<WrappedRoute path='/soapbox/admin' staffOnly page={AdminPage} component={Dashboard} content={children} exact />
|
||||||
|
|
|
@ -178,6 +178,13 @@ const getInstanceFeatures = (instance: Instance) => {
|
||||||
*/
|
*/
|
||||||
announcementsReactions: v.software === MASTODON && gte(v.compatVersion, '3.1.0'),
|
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.
|
* Set your birthday and view upcoming birthdays.
|
||||||
* @see GET /api/v1/pleroma/birthdays
|
* @see GET /api/v1/pleroma/birthdays
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
@import 'components/video-player';
|
@import 'components/video-player';
|
||||||
@import 'components/audio-player';
|
@import 'components/audio-player';
|
||||||
@import 'components/filters';
|
@import 'components/filters';
|
||||||
@import 'components/backups';
|
|
||||||
@import 'components/crypto-donate';
|
@import 'components/crypto-donate';
|
||||||
@import 'components/aliases';
|
@import 'components/aliases';
|
||||||
@import 'components/icon';
|
@import 'components/icon';
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue