From 072f67d6e71af3d7fa6f5f4c73ae460d6844f511 Mon Sep 17 00:00:00 2001
From: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
Date: Sat, 6 Jan 2024 20:14:33 +0900
Subject: feat: Add support for mCaptcha (#12905)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat: Add support for mCaptcha
* fix: Fix docker compose configuration
* chore(frontend/docs): update changelog & fix eslint errors
* `@mcaptcha/vanilla-glue`をダイナミックインポートするように
* chore: Add missing prefix to CHANGELOG
* refactor(backend): 適当につけた変数の名前を変更
---
.../frontend/src/pages/admin/bot-protection.vue | 34 +++++++++++++++++++++-
packages/frontend/src/pages/admin/security.vue | 3 ++
2 files changed, 36 insertions(+), 1 deletion(-)
(limited to 'packages/frontend/src/pages')
diff --git a/packages/frontend/src/pages/admin/bot-protection.vue b/packages/frontend/src/pages/admin/bot-protection.vue
index 99b8070b71..37f8227485 100644
--- a/packages/frontend/src/pages/admin/bot-protection.vue
+++ b/packages/frontend/src/pages/admin/bot-protection.vue
@@ -10,6 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
+
@@ -28,6 +29,24 @@ SPDX-License-Identifier: AGPL-3.0-only
+
+
+
+ {{ i18n.ts.mcaptchaSiteKey }}
+
+
+
+ {{ i18n.ts.mcaptchaSecretKey }}
+
+
+
+ {{ i18n.ts.mcaptchaInstanceUrl }}
+
+
+ {{ i18n.ts.preview }}
+
+
+
@@ -81,6 +100,9 @@ const MkCaptcha = defineAsyncComponent(() => import('@/components/MkCaptcha.vue'
const provider = ref(null);
const hcaptchaSiteKey = ref(null);
const hcaptchaSecretKey = ref(null);
+const mcaptchaSiteKey = ref(null);
+const mcaptchaSecretKey = ref(null);
+const mcaptchaInstanceUrl = ref(null);
const recaptchaSiteKey = ref(null);
const recaptchaSecretKey = ref(null);
const turnstileSiteKey = ref(null);
@@ -90,12 +112,18 @@ async function init() {
const meta = await misskeyApi('admin/meta');
hcaptchaSiteKey.value = meta.hcaptchaSiteKey;
hcaptchaSecretKey.value = meta.hcaptchaSecretKey;
+ mcaptchaSiteKey.value = meta.mcaptchaSiteKey;
+ mcaptchaSecretKey.value = meta.mcaptchaSecretKey;
+ mcaptchaInstanceUrl.value = meta.mcaptchaInstanceUrl;
recaptchaSiteKey.value = meta.recaptchaSiteKey;
recaptchaSecretKey.value = meta.recaptchaSecretKey;
turnstileSiteKey.value = meta.turnstileSiteKey;
turnstileSecretKey.value = meta.turnstileSecretKey;
- provider.value = meta.enableHcaptcha ? 'hcaptcha' : meta.enableRecaptcha ? 'recaptcha' : meta.enableTurnstile ? 'turnstile' : null;
+ provider.value = meta.enableHcaptcha ? 'hcaptcha' :
+ meta.enableRecaptcha ? 'recaptcha' :
+ meta.enableTurnstile ? 'turnstile' :
+ meta.enableMcaptcha ? 'mcaptcha' : null;
}
function save() {
@@ -103,6 +131,10 @@ function save() {
enableHcaptcha: provider.value === 'hcaptcha',
hcaptchaSiteKey: hcaptchaSiteKey.value,
hcaptchaSecretKey: hcaptchaSecretKey.value,
+ enableMcaptcha: provider.value === 'mcaptcha',
+ mcaptchaSiteKey: mcaptchaSiteKey.value,
+ mcaptchaSecretKey: mcaptchaSecretKey.value,
+ mcaptchaInstanceUrl: mcaptchaInstanceUrl.value,
enableRecaptcha: provider.value === 'recaptcha',
recaptchaSiteKey: recaptchaSiteKey.value,
recaptchaSecretKey: recaptchaSecretKey.value,
diff --git a/packages/frontend/src/pages/admin/security.vue b/packages/frontend/src/pages/admin/security.vue
index ec0c6166d0..a691d8ea1e 100644
--- a/packages/frontend/src/pages/admin/security.vue
+++ b/packages/frontend/src/pages/admin/security.vue
@@ -13,6 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.botProtection }}
hCaptcha
+ mCaptcha
reCAPTCHA
Turnstile
{{ i18n.ts.none }} ({{ i18n.ts.notRecommended }})
@@ -155,6 +156,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
const summalyProxy = ref('');
const enableHcaptcha = ref(false);
+const enableMcaptcha = ref(false);
const enableRecaptcha = ref(false);
const enableTurnstile = ref(false);
const sensitiveMediaDetection = ref('none');
@@ -174,6 +176,7 @@ async function init() {
const meta = await misskeyApi('admin/meta');
summalyProxy.value = meta.summalyProxy;
enableHcaptcha.value = meta.enableHcaptcha;
+ enableMcaptcha.value = meta.enableMcaptcha;
enableRecaptcha.value = meta.enableRecaptcha;
enableTurnstile.value = meta.enableTurnstile;
sensitiveMediaDetection.value = meta.sensitiveMediaDetection;
--
cgit v1.2.3-freya