2023-07-27 00:31:52 -05:00
|
|
|
<!--
|
2024-02-13 09:59:27 -06:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 00:31:52 -05:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-04-22 08:29:33 -05:00
|
|
|
<template>
|
2022-06-20 03:38:49 -05:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-29 03:13:12 -05:00
|
|
|
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
2022-06-20 03:38:49 -05:00
|
|
|
<FormSuspense :p="init">
|
2023-01-05 22:40:17 -06:00
|
|
|
<div class="_gaps_m">
|
2023-01-08 18:41:25 -06:00
|
|
|
<MkFolder>
|
2022-12-19 04:01:30 -06:00
|
|
|
<template #icon><i class="ti ti-shield"></i></template>
|
2022-06-20 03:38:49 -05:00
|
|
|
<template #label>{{ i18n.ts.botProtection }}</template>
|
|
|
|
<template v-if="enableHcaptcha" #suffix>hCaptcha</template>
|
2024-01-06 05:14:33 -06:00
|
|
|
<template v-else-if="enableMcaptcha" #suffix>mCaptcha</template>
|
2022-06-20 03:38:49 -05:00
|
|
|
<template v-else-if="enableRecaptcha" #suffix>reCAPTCHA</template>
|
2022-10-12 19:19:57 -05:00
|
|
|
<template v-else-if="enableTurnstile" #suffix>Turnstile</template>
|
2022-06-20 03:38:49 -05:00
|
|
|
<template v-else #suffix>{{ i18n.ts.none }} ({{ i18n.ts.notRecommended }})</template>
|
2022-01-04 06:16:41 -06:00
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
<XBotProtection/>
|
2023-01-08 18:41:25 -06:00
|
|
|
</MkFolder>
|
2022-01-04 12:09:20 -06:00
|
|
|
|
2023-01-08 18:41:25 -06:00
|
|
|
<MkFolder>
|
2022-12-19 04:01:30 -06:00
|
|
|
<template #icon><i class="ti ti-eye-off"></i></template>
|
2022-07-07 07:06:37 -05:00
|
|
|
<template #label>{{ i18n.ts.sensitiveMediaDetection }}</template>
|
|
|
|
<template v-if="sensitiveMediaDetection === 'all'" #suffix>{{ i18n.ts.all }}</template>
|
|
|
|
<template v-else-if="sensitiveMediaDetection === 'local'" #suffix>{{ i18n.ts.localOnly }}</template>
|
|
|
|
<template v-else-if="sensitiveMediaDetection === 'remote'" #suffix>{{ i18n.ts.remoteOnly }}</template>
|
|
|
|
<template v-else #suffix>{{ i18n.ts.none }}</template>
|
|
|
|
|
2023-01-05 22:40:17 -06:00
|
|
|
<div class="_gaps_m">
|
2023-01-05 06:04:56 -06:00
|
|
|
<span>{{ i18n.ts._sensitiveMediaDetection.description }}</span>
|
2022-07-07 07:06:37 -05:00
|
|
|
|
2023-01-07 00:09:46 -06:00
|
|
|
<MkRadios v-model="sensitiveMediaDetection">
|
2022-07-07 07:06:37 -05:00
|
|
|
<option value="none">{{ i18n.ts.none }}</option>
|
|
|
|
<option value="all">{{ i18n.ts.all }}</option>
|
|
|
|
<option value="local">{{ i18n.ts.localOnly }}</option>
|
|
|
|
<option value="remote">{{ i18n.ts.remoteOnly }}</option>
|
2023-01-07 00:09:46 -06:00
|
|
|
</MkRadios>
|
2022-07-07 07:06:37 -05:00
|
|
|
|
2023-05-29 03:13:12 -05:00
|
|
|
<MkRange v-model="sensitiveMediaDetectionSensitivity" :min="0" :max="4" :step="1" :textConverter="(v) => `${v + 1}`">
|
2022-07-07 07:06:37 -05:00
|
|
|
<template #label>{{ i18n.ts._sensitiveMediaDetection.sensitivity }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._sensitiveMediaDetection.sensitivityDescription }}</template>
|
2023-01-07 00:09:46 -06:00
|
|
|
</MkRange>
|
2022-07-07 07:06:37 -05:00
|
|
|
|
2023-01-06 23:59:54 -06:00
|
|
|
<MkSwitch v-model="enableSensitiveMediaDetectionForVideos">
|
2022-07-07 07:06:37 -05:00
|
|
|
<template #label>{{ i18n.ts._sensitiveMediaDetection.analyzeVideos }}<span class="_beta">{{ i18n.ts.beta }}</span></template>
|
|
|
|
<template #caption>{{ i18n.ts._sensitiveMediaDetection.analyzeVideosDescription }}</template>
|
2023-01-06 23:59:54 -06:00
|
|
|
</MkSwitch>
|
2022-07-07 07:06:37 -05:00
|
|
|
|
2023-01-06 23:59:54 -06:00
|
|
|
<MkSwitch v-model="setSensitiveFlagAutomatically">
|
2022-07-07 07:06:37 -05:00
|
|
|
<template #label>{{ i18n.ts._sensitiveMediaDetection.setSensitiveFlagAutomatically }} ({{ i18n.ts.notRecommended }})</template>
|
|
|
|
<template #caption>{{ i18n.ts._sensitiveMediaDetection.setSensitiveFlagAutomaticallyDescription }}</template>
|
2023-01-06 23:59:54 -06:00
|
|
|
</MkSwitch>
|
2022-07-07 07:06:37 -05:00
|
|
|
|
|
|
|
<!-- 現状 false positive が多すぎて実用に耐えない
|
2023-01-06 23:59:54 -06:00
|
|
|
<MkSwitch v-model="disallowUploadWhenPredictedAsPorn">
|
2022-07-07 07:06:37 -05:00
|
|
|
<template #label>{{ i18n.ts._sensitiveMediaDetection.disallowUploadWhenPredictedAsPorn }}</template>
|
2023-01-06 23:59:54 -06:00
|
|
|
</MkSwitch>
|
2022-07-07 07:06:37 -05:00
|
|
|
-->
|
|
|
|
|
2023-01-05 18:41:14 -06:00
|
|
|
<MkButton primary @click="save"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
2022-07-07 07:06:37 -05:00
|
|
|
</div>
|
2023-01-08 18:41:25 -06:00
|
|
|
</MkFolder>
|
2022-07-07 07:06:37 -05:00
|
|
|
|
2023-01-08 18:41:25 -06:00
|
|
|
<MkFolder>
|
2022-07-09 01:05:55 -05:00
|
|
|
<template #label>Active Email Validation</template>
|
|
|
|
<template v-if="enableActiveEmailValidation" #suffix>Enabled</template>
|
|
|
|
<template v-else #suffix>Disabled</template>
|
|
|
|
|
2023-01-05 22:40:17 -06:00
|
|
|
<div class="_gaps_m">
|
2023-01-05 06:04:56 -06:00
|
|
|
<span>{{ i18n.ts.activeEmailValidationDescription }}</span>
|
2024-01-19 03:48:30 -06:00
|
|
|
<MkSwitch v-model="enableActiveEmailValidation">
|
2022-07-09 01:05:55 -05:00
|
|
|
<template #label>Enable</template>
|
2023-01-06 23:59:54 -06:00
|
|
|
</MkSwitch>
|
2024-01-19 03:48:30 -06:00
|
|
|
<MkSwitch v-model="enableVerifymailApi">
|
2023-12-23 00:32:53 -06:00
|
|
|
<template #label>Use Verifymail.io API</template>
|
2023-11-18 05:39:48 -06:00
|
|
|
</MkSwitch>
|
2024-01-19 03:48:30 -06:00
|
|
|
<MkInput v-model="verifymailAuthKey">
|
2023-11-18 05:39:48 -06:00
|
|
|
<template #prefix><i class="ti ti-key"></i></template>
|
2023-12-23 00:32:53 -06:00
|
|
|
<template #label>Verifymail.io API Auth Key</template>
|
2023-11-18 05:39:48 -06:00
|
|
|
</MkInput>
|
2024-01-19 03:48:30 -06:00
|
|
|
<MkSwitch v-model="enableTruemailApi">
|
2023-12-29 03:23:29 -06:00
|
|
|
<template #label>Use TrueMail API</template>
|
|
|
|
</MkSwitch>
|
2024-01-19 03:48:30 -06:00
|
|
|
<MkInput v-model="truemailInstance">
|
2023-12-29 03:23:29 -06:00
|
|
|
<template #prefix><i class="ti ti-key"></i></template>
|
|
|
|
<template #label>TrueMail API Instance</template>
|
|
|
|
</MkInput>
|
2024-01-19 03:48:30 -06:00
|
|
|
<MkInput v-model="truemailAuthKey">
|
2023-12-29 03:23:29 -06:00
|
|
|
<template #prefix><i class="ti ti-key"></i></template>
|
|
|
|
<template #label>TrueMail API Auth Key</template>
|
|
|
|
</MkInput>
|
2024-01-19 03:48:30 -06:00
|
|
|
<MkButton primary @click="save"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
2022-07-09 01:05:55 -05:00
|
|
|
</div>
|
2023-01-08 18:41:25 -06:00
|
|
|
</MkFolder>
|
2022-07-09 01:05:55 -05:00
|
|
|
|
2023-12-22 21:06:22 -06:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>Banned Email Domains</template>
|
|
|
|
|
|
|
|
<div class="_gaps_m">
|
|
|
|
<MkTextarea v-model="bannedEmailDomains">
|
|
|
|
<template #label>Banned Email Domains List</template>
|
|
|
|
</MkTextarea>
|
|
|
|
<MkButton primary @click="save"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-08 18:41:25 -06:00
|
|
|
<MkFolder>
|
2022-07-02 01:12:11 -05:00
|
|
|
<template #label>Log IP address</template>
|
|
|
|
<template v-if="enableIpLogging" #suffix>Enabled</template>
|
|
|
|
<template v-else #suffix>Disabled</template>
|
|
|
|
|
2023-01-05 22:40:17 -06:00
|
|
|
<div class="_gaps_m">
|
2023-05-29 03:13:12 -05:00
|
|
|
<MkSwitch v-model="enableIpLogging" @update:modelValue="save">
|
2022-07-02 01:12:11 -05:00
|
|
|
<template #label>Enable</template>
|
2023-01-06 23:59:54 -06:00
|
|
|
</MkSwitch>
|
2022-07-02 01:12:11 -05:00
|
|
|
</div>
|
2023-01-08 18:41:25 -06:00
|
|
|
</MkFolder>
|
2022-06-20 03:38:49 -05:00
|
|
|
</div>
|
|
|
|
</FormSuspense>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-04-22 08:29:33 -05:00
|
|
|
</template>
|
|
|
|
|
2022-05-14 07:34:50 -05:00
|
|
|
<script lang="ts" setup>
|
2023-12-06 23:42:09 -06:00
|
|
|
import { ref, computed } from 'vue';
|
2022-06-20 03:38:49 -05:00
|
|
|
import XBotProtection from './bot-protection.vue';
|
|
|
|
import XHeader from './_header_.vue';
|
2023-01-08 18:41:25 -06:00
|
|
|
import MkFolder from '@/components/MkFolder.vue';
|
2023-01-07 00:09:46 -06:00
|
|
|
import MkRadios from '@/components/MkRadios.vue';
|
2023-01-06 23:59:54 -06:00
|
|
|
import MkSwitch from '@/components/MkSwitch.vue';
|
2021-12-30 06:47:48 -06:00
|
|
|
import FormSuspense from '@/components/form/suspense.vue';
|
2023-01-07 00:09:46 -06:00
|
|
|
import MkRange from '@/components/MkRange.vue';
|
|
|
|
import MkInput from '@/components/MkInput.vue';
|
2023-01-05 18:41:14 -06:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-12-22 21:06:22 -06:00
|
|
|
import MkTextarea from '@/components/MkTextarea.vue';
|
2023-09-19 02:37:43 -05:00
|
|
|
import * as os from '@/os.js';
|
2024-01-04 03:32:46 -06:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 02:37:43 -05:00
|
|
|
import { fetchInstance } from '@/instance.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2021-04-22 08:29:33 -05:00
|
|
|
|
2023-12-06 23:42:09 -06:00
|
|
|
const enableHcaptcha = ref<boolean>(false);
|
2024-01-06 05:14:33 -06:00
|
|
|
const enableMcaptcha = ref<boolean>(false);
|
2023-12-06 23:42:09 -06:00
|
|
|
const enableRecaptcha = ref<boolean>(false);
|
|
|
|
const enableTurnstile = ref<boolean>(false);
|
|
|
|
const sensitiveMediaDetection = ref<string>('none');
|
|
|
|
const sensitiveMediaDetectionSensitivity = ref<number>(0);
|
|
|
|
const setSensitiveFlagAutomatically = ref<boolean>(false);
|
|
|
|
const enableSensitiveMediaDetectionForVideos = ref<boolean>(false);
|
|
|
|
const enableIpLogging = ref<boolean>(false);
|
|
|
|
const enableActiveEmailValidation = ref<boolean>(false);
|
|
|
|
const enableVerifymailApi = ref<boolean>(false);
|
|
|
|
const verifymailAuthKey = ref<string | null>(null);
|
2023-12-29 03:23:29 -06:00
|
|
|
const enableTruemailApi = ref<boolean>(false);
|
|
|
|
const truemailInstance = ref<string | null>(null);
|
|
|
|
const truemailAuthKey = ref<string | null>(null);
|
2023-12-22 21:06:22 -06:00
|
|
|
const bannedEmailDomains = ref<string>('');
|
2021-04-22 08:29:33 -05:00
|
|
|
|
2022-05-14 07:34:50 -05:00
|
|
|
async function init() {
|
2024-01-04 03:32:46 -06:00
|
|
|
const meta = await misskeyApi('admin/meta');
|
2023-12-06 23:42:09 -06:00
|
|
|
enableHcaptcha.value = meta.enableHcaptcha;
|
2024-01-06 05:14:33 -06:00
|
|
|
enableMcaptcha.value = meta.enableMcaptcha;
|
2023-12-06 23:42:09 -06:00
|
|
|
enableRecaptcha.value = meta.enableRecaptcha;
|
|
|
|
enableTurnstile.value = meta.enableTurnstile;
|
|
|
|
sensitiveMediaDetection.value = meta.sensitiveMediaDetection;
|
|
|
|
sensitiveMediaDetectionSensitivity.value =
|
2022-07-07 07:06:37 -05:00
|
|
|
meta.sensitiveMediaDetectionSensitivity === 'veryLow' ? 0 :
|
|
|
|
meta.sensitiveMediaDetectionSensitivity === 'low' ? 1 :
|
|
|
|
meta.sensitiveMediaDetectionSensitivity === 'medium' ? 2 :
|
|
|
|
meta.sensitiveMediaDetectionSensitivity === 'high' ? 3 :
|
|
|
|
meta.sensitiveMediaDetectionSensitivity === 'veryHigh' ? 4 : 0;
|
2023-12-06 23:42:09 -06:00
|
|
|
setSensitiveFlagAutomatically.value = meta.setSensitiveFlagAutomatically;
|
|
|
|
enableSensitiveMediaDetectionForVideos.value = meta.enableSensitiveMediaDetectionForVideos;
|
|
|
|
enableIpLogging.value = meta.enableIpLogging;
|
|
|
|
enableActiveEmailValidation.value = meta.enableActiveEmailValidation;
|
|
|
|
enableVerifymailApi.value = meta.enableVerifymailApi;
|
|
|
|
verifymailAuthKey.value = meta.verifymailAuthKey;
|
2024-01-19 03:48:30 -06:00
|
|
|
enableTruemailApi.value = meta.enableTruemailApi;
|
|
|
|
truemailInstance.value = meta.truemailInstance;
|
|
|
|
truemailAuthKey.value = meta.truemailAuthKey;
|
2024-02-22 19:47:17 -06:00
|
|
|
bannedEmailDomains.value = meta.bannedEmailDomains?.join('\n') || '';
|
2022-05-14 07:34:50 -05:00
|
|
|
}
|
2021-04-22 08:29:33 -05:00
|
|
|
|
2022-05-14 07:34:50 -05:00
|
|
|
function save() {
|
|
|
|
os.apiWithDialog('admin/update-meta', {
|
2023-12-06 23:42:09 -06:00
|
|
|
sensitiveMediaDetection: sensitiveMediaDetection.value,
|
2022-07-07 07:06:37 -05:00
|
|
|
sensitiveMediaDetectionSensitivity:
|
2023-12-06 23:42:09 -06:00
|
|
|
sensitiveMediaDetectionSensitivity.value === 0 ? 'veryLow' :
|
|
|
|
sensitiveMediaDetectionSensitivity.value === 1 ? 'low' :
|
|
|
|
sensitiveMediaDetectionSensitivity.value === 2 ? 'medium' :
|
|
|
|
sensitiveMediaDetectionSensitivity.value === 3 ? 'high' :
|
|
|
|
sensitiveMediaDetectionSensitivity.value === 4 ? 'veryHigh' :
|
2022-07-07 07:06:37 -05:00
|
|
|
0,
|
2023-12-06 23:42:09 -06:00
|
|
|
setSensitiveFlagAutomatically: setSensitiveFlagAutomatically.value,
|
|
|
|
enableSensitiveMediaDetectionForVideos: enableSensitiveMediaDetectionForVideos.value,
|
|
|
|
enableIpLogging: enableIpLogging.value,
|
|
|
|
enableActiveEmailValidation: enableActiveEmailValidation.value,
|
|
|
|
enableVerifymailApi: enableVerifymailApi.value,
|
|
|
|
verifymailAuthKey: verifymailAuthKey.value,
|
2023-12-29 03:23:29 -06:00
|
|
|
enableTruemailApi: enableTruemailApi.value,
|
|
|
|
truemailInstance: truemailInstance.value,
|
|
|
|
truemailAuthKey: truemailAuthKey.value,
|
2023-12-22 21:06:22 -06:00
|
|
|
bannedEmailDomains: bannedEmailDomains.value.split('\n'),
|
2022-05-14 07:34:50 -05:00
|
|
|
}).then(() => {
|
2024-02-22 19:47:17 -06:00
|
|
|
fetchInstance(true);
|
2022-05-14 07:34:50 -05:00
|
|
|
});
|
|
|
|
}
|
2021-04-22 08:29:33 -05:00
|
|
|
|
2023-12-06 23:42:09 -06:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 03:38:49 -05:00
|
|
|
|
2023-12-06 23:42:09 -06:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 03:38:49 -05:00
|
|
|
|
2024-02-16 01:17:09 -06:00
|
|
|
definePageMetadata(() => ({
|
2022-06-20 03:38:49 -05:00
|
|
|
title: i18n.ts.security,
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-lock',
|
2024-02-16 01:17:09 -06:00
|
|
|
}));
|
2021-04-22 08:29:33 -05:00
|
|
|
</script>
|