Add support for hCaptcha

This commit is contained in:
Acid Chicken (硫酸鶏)
2020-04-28 14:29:33 +09:00
parent e17e8bbb6f
commit 7860839220
15 changed files with 257 additions and 20 deletions

View File

@ -145,6 +145,27 @@ export const meta = {
}
},
enableHcaptcha: {
validator: $.optional.bool,
desc: {
'ja-JP': 'hCaptchaを使用するか否か'
}
},
hcaptchaSiteKey: {
validator: $.optional.nullable.str,
desc: {
'ja-JP': 'hCaptcha site key'
}
},
hcaptchaSecretKey: {
validator: $.optional.nullable.str,
desc: {
'ja-JP': 'hCaptcha secret key'
}
},
enableRecaptcha: {
validator: $.optional.bool,
desc: {
@ -472,6 +493,18 @@ export default define(meta, async (ps, me) => {
set.proxyRemoteFiles = ps.proxyRemoteFiles;
}
if (ps.enableHcaptcha !== undefined) {
set.enableHcaptcha = ps.enableHcaptcha;
}
if (ps.hcaptchaSiteKey !== undefined) {
set.hcaptchaSiteKey = ps.hcaptchaSiteKey;
}
if (ps.hcaptchaSecretKey !== undefined) {
set.hcaptchaSecretKey = ps.hcaptchaSecretKey;
}
if (ps.enableRecaptcha !== undefined) {
set.enableRecaptcha = ps.enableRecaptcha;
}

View File

@ -122,6 +122,8 @@ export default define(meta, async (ps, me) => {
driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb,
cacheRemoteFiles: instance.cacheRemoteFiles,
proxyRemoteFiles: instance.proxyRemoteFiles,
enableHcaptcha: instance.enableHcaptcha,
hcaptchaSiteKey: instance.hcaptchaSiteKey,
enableRecaptcha: instance.enableRecaptcha,
recaptchaSiteKey: instance.recaptchaSiteKey,
swPublickey: instance.swPublicKey,
@ -149,6 +151,7 @@ export default define(meta, async (ps, me) => {
localTimeLine: !instance.disableLocalTimeline,
globalTimeLine: !instance.disableGlobalTimeline,
elasticsearch: config.elasticsearch ? true : false,
hcaptcha: instance.enableHcaptcha,
recaptcha: instance.enableRecaptcha,
objectStorage: instance.useObjectStorage,
twitter: instance.enableTwitterIntegration,
@ -164,6 +167,7 @@ export default define(meta, async (ps, me) => {
response.pinnedUsers = instance.pinnedUsers;
response.hiddenTags = instance.hiddenTags;
response.blockedHosts = instance.blockedHosts;
response.hcaptchaSecretKey = instance.hcaptchaSecretKey;
response.recaptchaSecretKey = instance.recaptchaSecretKey;
response.proxyAccountId = instance.proxyAccountId;
response.twitterConsumerKey = instance.twitterConsumerKey;