mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-09 23:24:32 +00:00
@@ -34,22 +34,10 @@ export async function initCaptcha() {
|
||||
break;
|
||||
}
|
||||
case 'm-captcha': {
|
||||
const mCaptcha = await import('@mcaptcha/vanilla-glue');
|
||||
|
||||
// FIXME: the mCaptcha code is not right, it's a miracle that the wrong code could run
|
||||
// * the "vanilla-glue" has some problems with es6 module.
|
||||
// * the INPUT_NAME is a "const", it should not be changed.
|
||||
// * the "mCaptcha.default" is actually the "Widget".
|
||||
|
||||
mCaptcha.INPUT_NAME = 'm-captcha-response';
|
||||
const instanceURL = captchaEl.getAttribute('data-instance-url')!;
|
||||
|
||||
new mCaptcha.default({
|
||||
siteKey: {
|
||||
instanceUrl: new URL(instanceURL),
|
||||
key: siteKey,
|
||||
},
|
||||
});
|
||||
// ref: https://github.com/mCaptcha/glue/blob/master/packages/vanilla/README.md
|
||||
// sample: https://github.com/mCaptcha/glue/blob/master/packages/vanilla/static/embeded.html
|
||||
// @mcaptcha/vanilla-glue 0.1.0-rc2 auto-runs on module load, use the existing elements to render.
|
||||
await import('@mcaptcha/vanilla-glue');
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user