From b779ff08e0aeb95b879972b7dc26bc81a81e627c Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 14 May 2019 21:08:35 +0900 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E5=AE=9A=E3=81=AE=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=B3=E3=82=B9=E3=81=AE=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=82=92=E3=81=99=E3=81=B9=E3=81=A6=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 1 + src/client/app/admin/views/federation.vue | 19 +++++++++++-- .../admin/federation/delete-all-files.ts | 27 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/server/api/endpoints/admin/federation/delete-all-files.ts diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 7068e7c3e..ed0da44d6 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 4d0b4b7c7..8b7719069 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 000000000..befb36226 --- /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); + } +});