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?" sensitiveMediaRevealConfirm: "This media might be sensitive. Are you sure you want to reveal it?"
createdLists: "Created lists" createdLists: "Created lists"
createdAntennas: "Created antennas" createdAntennas: "Created antennas"
severAllFollowRelations: "Break follow relationships"
severAllFollowRelationsConfirm: "Really break all follow relationships? This is irreversible!"
_delivery: _delivery:
status: "Delivery status" status: "Delivery status"
stop: "Suspend delivery" stop: "Suspend delivery"

20
locales/index.d.ts vendored
View File

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

View File

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

View File

@ -43,6 +43,8 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts._delivery._type[suspensionState] }} {{ i18n.ts._delivery._type[suspensionState] }}
</template> </template>
</MkKeyValue> </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" danger @click="stopDelivery">{{ i18n.ts._delivery.stop }}</MkButton>
<MkButton v-if="suspensionState !== 'none'" :disabled="!instance" @click="resumeDelivery">{{ i18n.ts._delivery.resume }}</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> <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(); fetch();
const headerActions = computed(() => [{ const headerActions = computed(() => [{