diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 7068e7c3ed..ed0da44d68 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1441,6 +1441,7 @@ admin/views/federation.vue: latest-request-received-at: "直近のリクエスト受信" remove-all-following: "フォローを全解除" remove-all-following-info: "{host}からのフォローをすべて解除します。そのインスタンスがもう存在しなくなった場合などに実行してください。" + delete-all-files: "ファイルをすべて削除" block: "ブロック" marked-as-closed: "閉鎖されているとマーク" lookup: "照会" diff --git a/src/client/app/admin/views/federation.vue b/src/client/app/admin/views/federation.vue index 4d0b4b7c77..8b7719069c 100644 --- a/src/client/app/admin/views/federation.vue +++ b/src/client/app/admin/views/federation.vue @@ -78,6 +78,10 @@
+
+ {{ $t('delete-all-files') }} + {{ $t('delete-all-files') }} +
{{ $t('remove-all-following') }} {{ $t('remove-all-following') }} @@ -158,7 +162,7 @@ import Vue from 'vue'; import i18n from '../../i18n'; import { faPaperPlane } from '@fortawesome/free-regular-svg-icons'; -import { faBan, faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faTrafficLight, faInbox } from '@fortawesome/free-solid-svg-icons'; +import { faTrashAlt, faBan, faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faTrafficLight, faInbox } from '@fortawesome/free-solid-svg-icons'; import ApexCharts from 'apexcharts'; import * as tinycolor from 'tinycolor2'; @@ -186,7 +190,7 @@ export default Vue.extend({ chartSpan: 'hour', chartInstance: null, blockedHosts: '', - faBan, faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faPaperPlane, faTrafficLight, faInbox + faTrashAlt, faBan, faGlobe, faTerminal, faSearch, faMinusCircle, faServer, faCrosshairs, faEnvelopeOpenText, faUsers, faCaretDown, faCaretUp, faPaperPlane, faTrafficLight, faInbox }; }, @@ -307,6 +311,17 @@ export default Vue.extend({ }); }, + deleteAllFiles() { + this.$root.api('admin/federation/delete-all-files', { + host: this.instance.host + }).then(() => { + this.$root.dialog({ + type: 'success', + splash: true + }); + }); + }, + updateInstance() { this.$root.api('admin/federation/update-instance', { host: this.instance.host, diff --git a/src/server/api/endpoints/admin/federation/delete-all-files.ts b/src/server/api/endpoints/admin/federation/delete-all-files.ts new file mode 100644 index 0000000000..befb362264 --- /dev/null +++ b/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -0,0 +1,27 @@ +import $ from 'cafy'; +import define from '../../../define'; +import del from '../../../../../services/drive/delete-file'; +import { DriveFiles } from '../../../../../models'; + +export const meta = { + tags: ['admin'], + + requireCredential: true, + requireModerator: true, + + params: { + host: { + validator: $.str + } + } +}; + +export default define(meta, async (ps, me) => { + const files = await DriveFiles.find({ + userHost: ps.host + }); + + for (const file of files) { + del(file); + } +});