mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2025-09-18 21:38:07 +00:00
frontend dialog for "clear cached files"
This commit is contained in:
parent
50ca5e8688
commit
d847dd00c5
3 changed files with 71 additions and 7 deletions
30
locales/index.d.ts
vendored
30
locales/index.d.ts
vendored
|
@ -13265,6 +13265,36 @@ export interface Locale extends ILocale {
|
|||
* Signup Reason
|
||||
*/
|
||||
"signupReason": string;
|
||||
"clearCachedFilesOptions": {
|
||||
/**
|
||||
* Delete all cached remote files
|
||||
*/
|
||||
"title": string;
|
||||
/**
|
||||
* Only delete files older than:
|
||||
*/
|
||||
"olderThan": string;
|
||||
/**
|
||||
* now
|
||||
*/
|
||||
"now": string;
|
||||
/**
|
||||
* one week
|
||||
*/
|
||||
"oneWeek": string;
|
||||
/**
|
||||
* one month
|
||||
*/
|
||||
"oneMonth": string;
|
||||
/**
|
||||
* one year
|
||||
*/
|
||||
"oneYear": string;
|
||||
/**
|
||||
* Don't delete files used as avatars&c
|
||||
*/
|
||||
"keepFilesInUse": string;
|
||||
};
|
||||
}
|
||||
declare const locales: {
|
||||
[lang: string]: Locale;
|
||||
|
|
|
@ -58,14 +58,39 @@ const pagination = {
|
|||
})),
|
||||
};
|
||||
|
||||
function clear() {
|
||||
os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.ts.clearCachedFilesConfirm,
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
async function clear() {
|
||||
const { canceled, result } = await os.form(i18n.ts.clearCachedFilesOptions.title, {
|
||||
olderThanEnum: {
|
||||
label: i18n.ts.clearCachedFilesOptions.olderThan,
|
||||
type: 'enum',
|
||||
default: 'now',
|
||||
required: true,
|
||||
enum: [
|
||||
{ label: i18n.ts.clearCachedFilesOptions.now, value: 'now' },
|
||||
{ label: i18n.ts.clearCachedFilesOptions.oneWeek, value: 'oneWeek' },
|
||||
{ label: i18n.ts.clearCachedFilesOptions.oneMonth, value: 'oneMonth' },
|
||||
{ label: i18n.ts.clearCachedFilesOptions.oneYear, value: 'oneYear' },
|
||||
],
|
||||
},
|
||||
keepFilesInUse: {
|
||||
label: i18n.ts.clearCachedFilesOptions.keepFilesInUse,
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
os.apiWithDialog('admin/drive/clean-remote-files', {});
|
||||
if (canceled) return;
|
||||
|
||||
const timesMap = {
|
||||
now: 0,
|
||||
oneWeek: 7 * 86400,
|
||||
oneMonth: 30 * 86400,
|
||||
oneYear: 365 * 86400,
|
||||
};
|
||||
|
||||
await os.apiWithDialog('admin/drive/clean-remote-files', {
|
||||
olderThanSeconds: timesMap[result.olderThanEnum] ?? 0,
|
||||
keepFilesInUse: result.keepFilesInUse,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -632,3 +632,12 @@ rawInfoDescription: "Extended user data in its raw form. These fields are privat
|
|||
rawApDescription: "ActivityPub user data in its raw form. These fields are public and accessible to other instances."
|
||||
|
||||
signupReason: "Signup Reason"
|
||||
|
||||
clearCachedFilesOptions:
|
||||
title: "Delete all cached remote files"
|
||||
olderThan: "Only delete files older than:"
|
||||
now: "now"
|
||||
oneWeek: "one week"
|
||||
oneMonth: "one month"
|
||||
oneYear: "one year"
|
||||
keepFilesInUse: "Don't delete files used as avatars&c"
|
||||
|
|
Loading…
Add table
Reference in a new issue