特定のインスタンスのファイルをすべて削除できるように
This commit is contained in:
		
							parent
							
								
									811f9c22d7
								
							
						
					
					
						commit
						b779ff08e0
					
				
					 3 changed files with 45 additions and 2 deletions
				
			
		|  | @ -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: "照会" | ||||
|  |  | |||
|  | @ -78,6 +78,10 @@ | |||
| 					</ui-horizon-group> | ||||
| 					<div ref="chart"></div> | ||||
| 				</details> | ||||
| 				<details> | ||||
| 					<summary>{{ $t('delete-all-files') }}</summary> | ||||
| 					<ui-button @click="deleteAllFiles()" style="margin-top: 16px;"><fa :icon="faTrashAlt"/> {{ $t('delete-all-files') }}</ui-button> | ||||
| 				</details> | ||||
| 				<details> | ||||
| 					<summary>{{ $t('remove-all-following') }}</summary> | ||||
| 					<ui-button @click="removeAllFollowing()" style="margin-top: 16px;"><fa :icon="faMinusCircle"/> {{ $t('remove-all-following') }}</ui-button> | ||||
|  | @ -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, | ||||
|  |  | |||
|  | @ -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); | ||||
| 	} | ||||
| }); | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue