Skip to content

Commit 5c2020c

Browse files
committed
wiki: Switch Captcha to Turnstile
1 parent 9db1f07 commit 5c2020c

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

cookbooks/mediawiki/resources/site.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
property :admin_password, :kind_of => String, :required => [:create]
4242
property :private_accounts, :kind_of => [TrueClass, FalseClass], :default => false
4343
property :private_site, :kind_of => [TrueClass, FalseClass], :default => false
44-
property :hcaptcha_public_key, :kind_of => String, :default => ""
45-
property :hcaptcha_private_key, :kind_of => String, :default => ""
44+
property :turnstile_site_key, :kind_of => String, :default => ""
45+
property :turnstile_secret_key, :kind_of => String, :default => ""
4646
property :extra_file_extensions, :kind_of => [String, Array], :default => []
4747
property :namespaces, :kind_of => Hash, :default => {}
4848
property :force_ui_messages, :kind_of => Array, :default => []
@@ -243,8 +243,8 @@
243243
mediawiki_extension "ConfirmEdit" do
244244
site new_resource.site
245245
template "mw-ext-ConfirmEdit.inc.php.erb"
246-
variables :public_key => new_resource.hcaptcha_public_key,
247-
:private_key => new_resource.hcaptcha_private_key
246+
variables :turnstile_site_key => new_resource.turnstile_site_key,
247+
:turnstile_secret_key => new_resource.turnstile_secret_key
248248
update_site false
249249
end
250250
end

cookbooks/mediawiki/templates/default/mw-ext-ConfirmEdit.inc.php.erb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22
# DO NOT EDIT - This file is being maintained by Chef
3-
wfLoadExtensions( array( 'ConfirmEdit', 'ConfirmEdit/hCaptcha' ) );
4-
$wgHCaptchaSendRemoteIP = true;
5-
$wgHCaptchaSiteKey = '<%= @public_key %>';
6-
$wgHCaptchaSecretKey = '<%= @private_key %>';
3+
wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/Turnstile' ]);
4+
$wgCaptchaClass = MediaWiki\Extension\ConfirmEdit\Turnstile\Turnstile::class;
5+
6+
$wgTurnstileSiteKey= '<%= @turnstile_site_key %>';
7+
$wgTurnstileSecretKey= '<%= @turnstile_secret_key %>';
8+
$wgTurnstileSendRemoteIP = true;
79

810
$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true;
911
$wgGroupPermissions['bot' ]['skipcaptcha'] = true;

cookbooks/wiki/recipes/default.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454

5555
metanamespace "Wiki"
5656

57-
hcaptcha_public_key "b67a410b-955e-4049-b432-f9c00e0202c0"
58-
hcaptcha_private_key passwords["hcaptcha"]
57+
turnstile_site_key passwords["turnstile_site_key"]
58+
turnstile_secret_key passwords["turnstile_secret_key"]
5959

6060
namespaces "DE" => { :id => 200, :talk_id => 201 },
6161
"FR" => { :id => 202, :talk_id => 203 },

test/data_bags/wiki/passwords.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"database": "database_password",
33
"admin": "admin_password",
4-
"hcaptcha": "precaptcha_token",
5-
"thunderforest": "thunderforest_token"
4+
"thunderforest": "thunderforest_token",
5+
"turnstile_site_key": "turnstile_site_key_value",
6+
"turnstile_secret_key": "turnstile_secret_key_value"
67
}

0 commit comments

Comments
 (0)