2021-04-22 08:29:33 -05:00
|
|
|
<template>
|
|
|
|
<FormBase>
|
|
|
|
<FormSuspense :p="init">
|
|
|
|
<FormRadios v-model="provider">
|
|
|
|
<template #desc><i class="fas fa-shield-alt"></i> {{ $ts.botProtection }}</template>
|
|
|
|
<option :value="null">{{ $ts.none }} ({{ $ts.notRecommended }})</option>
|
|
|
|
<option value="hcaptcha">hCaptcha</option>
|
|
|
|
<option value="recaptcha">reCAPTCHA</option>
|
|
|
|
</FormRadios>
|
|
|
|
|
|
|
|
<template v-if="provider === 'hcaptcha'">
|
2021-11-19 04:36:12 -06:00
|
|
|
<div v-sticky-container class="_debobigegoItem _debobigegoNoConcat">
|
2021-09-29 10:50:45 -05:00
|
|
|
<div class="_debobigegoLabel">hCaptcha</div>
|
2021-04-22 08:29:33 -05:00
|
|
|
<div class="main">
|
2021-09-29 10:50:45 -05:00
|
|
|
<FormInput v-model="hcaptchaSiteKey">
|
2021-04-22 08:29:33 -05:00
|
|
|
<template #prefix><i class="fas fa-key"></i></template>
|
|
|
|
<span>{{ $ts.hcaptchaSiteKey }}</span>
|
|
|
|
</FormInput>
|
2021-09-29 10:50:45 -05:00
|
|
|
<FormInput v-model="hcaptchaSecretKey">
|
2021-04-22 08:29:33 -05:00
|
|
|
<template #prefix><i class="fas fa-key"></i></template>
|
|
|
|
<span>{{ $ts.hcaptchaSecretKey }}</span>
|
|
|
|
</FormInput>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-11-19 04:36:12 -06:00
|
|
|
<div v-sticky-container class="_debobigegoItem _debobigegoNoConcat">
|
2021-09-29 10:50:45 -05:00
|
|
|
<div class="_debobigegoLabel">{{ $ts.preview }}</div>
|
|
|
|
<div class="_debobigegoPanel" style="padding: var(--debobigegoContentHMargin);">
|
2021-04-22 08:29:33 -05:00
|
|
|
<MkCaptcha provider="hcaptcha" :sitekey="hcaptchaSiteKey || '10000000-ffff-ffff-ffff-000000000001'"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-else-if="provider === 'recaptcha'">
|
2021-11-19 04:36:12 -06:00
|
|
|
<div v-sticky-container class="_debobigegoItem _debobigegoNoConcat">
|
2021-09-29 10:50:45 -05:00
|
|
|
<div class="_debobigegoLabel">reCAPTCHA</div>
|
2021-04-22 08:29:33 -05:00
|
|
|
<div class="main">
|
2021-09-29 10:50:45 -05:00
|
|
|
<FormInput v-model="recaptchaSiteKey">
|
2021-04-22 08:29:33 -05:00
|
|
|
<template #prefix><i class="fas fa-key"></i></template>
|
|
|
|
<span>{{ $ts.recaptchaSiteKey }}</span>
|
|
|
|
</FormInput>
|
2021-09-29 10:50:45 -05:00
|
|
|
<FormInput v-model="recaptchaSecretKey">
|
2021-04-22 08:29:33 -05:00
|
|
|
<template #prefix><i class="fas fa-key"></i></template>
|
|
|
|
<span>{{ $ts.recaptchaSecretKey }}</span>
|
|
|
|
</FormInput>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-11-19 04:36:12 -06:00
|
|
|
<div v-if="recaptchaSiteKey" v-sticky-container class="_debobigegoItem _debobigegoNoConcat">
|
2021-09-29 10:50:45 -05:00
|
|
|
<div class="_debobigegoLabel">{{ $ts.preview }}</div>
|
|
|
|
<div class="_debobigegoPanel" style="padding: var(--debobigegoContentHMargin);">
|
2021-04-22 08:29:33 -05:00
|
|
|
<MkCaptcha provider="recaptcha" :sitekey="recaptchaSiteKey"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2021-11-19 04:36:12 -06:00
|
|
|
<FormButton primary @click="save"><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
2021-04-22 08:29:33 -05:00
|
|
|
</FormSuspense>
|
|
|
|
</FormBase>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineAsyncComponent, defineComponent } from 'vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import FormRadios from '@/components/debobigego/radios.vue';
|
|
|
|
import FormInput from '@/components/debobigego/input.vue';
|
|
|
|
import FormButton from '@/components/debobigego/button.vue';
|
|
|
|
import FormBase from '@/components/debobigego/base.vue';
|
|
|
|
import FormGroup from '@/components/debobigego/group.vue';
|
|
|
|
import FormInfo from '@/components/debobigego/info.vue';
|
|
|
|
import FormSuspense from '@/components/debobigego/suspense.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
|
|
|
import { fetchInstance } from '@/instance';
|
2021-04-22 08:29:33 -05:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
FormRadios,
|
|
|
|
FormInput,
|
|
|
|
FormBase,
|
|
|
|
FormGroup,
|
|
|
|
FormButton,
|
|
|
|
FormInfo,
|
|
|
|
FormSuspense,
|
2021-11-11 11:02:25 -06:00
|
|
|
MkCaptcha: defineAsyncComponent(() => import('@/components/captcha.vue')),
|
2021-04-22 08:29:33 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['info'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
[symbols.PAGE_INFO]: {
|
|
|
|
title: this.$ts.botProtection,
|
|
|
|
icon: 'fas fa-shield-alt'
|
|
|
|
},
|
|
|
|
provider: null,
|
|
|
|
enableHcaptcha: false,
|
|
|
|
hcaptchaSiteKey: null,
|
|
|
|
hcaptchaSecretKey: null,
|
|
|
|
enableRecaptcha: false,
|
|
|
|
recaptchaSiteKey: null,
|
|
|
|
recaptchaSecretKey: null,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
async mounted() {
|
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async init() {
|
|
|
|
const meta = await os.api('meta', { detail: true });
|
|
|
|
this.enableHcaptcha = meta.enableHcaptcha;
|
|
|
|
this.hcaptchaSiteKey = meta.hcaptchaSiteKey;
|
|
|
|
this.hcaptchaSecretKey = meta.hcaptchaSecretKey;
|
|
|
|
this.enableRecaptcha = meta.enableRecaptcha;
|
|
|
|
this.recaptchaSiteKey = meta.recaptchaSiteKey;
|
|
|
|
this.recaptchaSecretKey = meta.recaptchaSecretKey;
|
|
|
|
|
|
|
|
this.provider = this.enableHcaptcha ? 'hcaptcha' : this.enableRecaptcha ? 'recaptcha' : null;
|
|
|
|
|
|
|
|
this.$watch(() => this.provider, () => {
|
|
|
|
this.enableHcaptcha = this.provider === 'hcaptcha';
|
|
|
|
this.enableRecaptcha = this.provider === 'recaptcha';
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
save() {
|
|
|
|
os.apiWithDialog('admin/update-meta', {
|
|
|
|
enableHcaptcha: this.enableHcaptcha,
|
|
|
|
hcaptchaSiteKey: this.hcaptchaSiteKey,
|
|
|
|
hcaptchaSecretKey: this.hcaptchaSecretKey,
|
|
|
|
enableRecaptcha: this.enableRecaptcha,
|
|
|
|
recaptchaSiteKey: this.recaptchaSiteKey,
|
|
|
|
recaptchaSecretKey: this.recaptchaSecretKey,
|
|
|
|
}).then(() => {
|
|
|
|
fetchInstance();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|