Expose instance-moderation endpoints in UI

This commit is contained in:
PrivateGER 2024-10-05 18:02:38 +02:00
parent ac1e5a0fb5
commit 99a0f756ff
4 changed files with 51 additions and 6 deletions

View file

@ -1330,6 +1330,8 @@ confirmWhenRevealingSensitiveMedia: "Confirm when revealing sensitive media"
sensitiveMediaRevealConfirm: "This media might be sensitive. Are you sure you want to reveal it?"
createdLists: "Created lists"
createdAntennas: "Created antennas"
severAllFollowRelations: "Break follow relationships"
severAllFollowRelationsConfirm: "Really break all follow relationships? This is irreversible!"
_delivery:
status: "Delivery status"
stop: "Suspend delivery"

20
locales/index.d.ts vendored
View file

@ -3128,6 +3128,10 @@ export interface Locale extends ILocale {
*
*/
"showTickerOnReplies": string;
/**
*
*/
"disableCatSpeak": string;
/**
* MFMの検索エンジン
*/
@ -4429,10 +4433,6 @@ export interface Locale extends ILocale {
*
*/
"disableFederationOk": string;
/**
*
*/
"disableCatSpeak": string;
/**
*
*/
@ -5337,6 +5337,14 @@ export interface Locale extends ILocale {
*
*/
"createdAntennas": string;
/**
*
*/
"severAllFollowRelations": string;
/**
*
*/
"severAllFollowRelationsConfirm": string;
"_delivery": {
/**
*
@ -5777,7 +5785,7 @@ export interface Locale extends ILocale {
*/
"social": string;
/**
*
* 稿
*/
"bubble": string;
/**
@ -9139,7 +9147,7 @@ export interface Locale extends ILocale {
*/
"global": string;
/**
*
*
*/
"bubble": string;
};

View file

@ -1330,6 +1330,8 @@ confirmWhenRevealingSensitiveMedia: "センシティブなメディアを表示
sensitiveMediaRevealConfirm: "センシティブなメディアです。表示しますか?"
createdLists: "作成したリスト"
createdAntennas: "作成したアンテナ"
severAllFollowRelations: "以下の関係をすべて断ち切る"
severAllFollowRelationsConfirm: "本当にすべての関係を断ち切りたいのですか?これは不可逆的だ。"
_delivery:
status: "配信状態"

View file

@ -43,6 +43,8 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts._delivery._type[suspensionState] }}
</template>
</MkKeyValue>
<MkButton :disabled="!instance" danger @click="deleteAllFiles">{{ i18n.ts.deleteAllFilesConfirm }}</MkButton>
<MkButton :disabled="!instance" danger @click="severAllFollowRelations">{{ i18n.ts.severAllFollowRelations }}</MkButton>
<MkButton v-if="suspensionState === 'none'" :disabled="!instance" danger @click="stopDelivery">{{ i18n.ts._delivery.stop }}</MkButton>
<MkButton v-if="suspensionState !== 'none'" :disabled="!instance" @click="resumeDelivery">{{ i18n.ts._delivery.resume }}</MkButton>
<MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch>
@ -270,6 +272,37 @@ function refreshMetadata(): void {
});
}
async function deleteAllFiles(): void {
const confirm = await os.confirm({
type: 'danger',
text: i18n.ts.deleteAllFilesConfirm,
});
if (!confirm) return;
if (!instance.value) throw new Error('No instance?');
await misskeyApi('admin/federation/delete-all-files', {
host: instance.value.host,
});
await os.alert({
text: 'Deletion of all files queued',
});
}
async function severAllFollowRelations(): void {
if (!instance.value) throw new Error('No instance?');
const confirm = await os.confirm({
type: 'danger',
text: i18n.ts.severAllFollowRelationsConfirm,
});
if (!confirm) return;
await misskeyApi('admin/federation/remove-all-following', {
host: instance.value.host,
});
await os.alert({
text: 'Severing all follow relations queued',
});
}
fetch();
const headerActions = computed(() => [{