Skip to content

Commit

Permalink
Use polyfill site.js in v1, update SDKs, lock version in `update-sdk.…
Browse files Browse the repository at this point in the history
…sh` (#137)

* Use polyfill site.js in v1, update SDKs, lock version in `update-sdk.sh`

* update stable tag in readme

---------

Co-authored-by: merlinfuchs <[email protected]>
  • Loading branch information
gzuidhof and merlinfuchs authored Sep 25, 2024
1 parent 9dec9c6 commit f286d93
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ node_modules/
.DS_Store

vendor/
!friendly-captcha/public/vendor/

bin/
13 changes: 9 additions & 4 deletions friendly-captcha/friendly-captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Plugin Name: Friendly Captcha for WordPress
* Description: Protect WordPress website forms from spam and abuse with Friendly Captcha, a privacy-first anti-bot solution.
* Version: 1.15.1
* Version: 1.15.2
* Requires at least: 5.0
* Requires PHP: 7.3
* Author: Friendly Captcha GmbH
Expand All @@ -19,9 +19,9 @@
die;
}

define('FRIENDLY_CAPTCHA_VERSION', '1.15.1');
define('FRIENDLY_CAPTCHA_FRIENDLY_CHALLENGE_VERSION', '0.9.12');
define('FRIENDLY_CAPTCHA_FRIENDLY_CAPTCHA_SDK_VERSION', '0.1.7');
define('FRIENDLY_CAPTCHA_VERSION', '1.15.2');
define('FRIENDLY_CAPTCHA_FRIENDLY_CHALLENGE_VERSION', '0.9.18');
define('FRIENDLY_CAPTCHA_FRIENDLY_CAPTCHA_SDK_VERSION', '0.1.8');
define('FRIENDLY_CAPTCHA_SUPPORTED_LANGUAGES', [
"en" => "English",
"de" => "German",
Expand Down Expand Up @@ -52,6 +52,11 @@
"hu" => "Hungarian",
"ro" => "Romanian",
"zh" => "Chinese (simplified)",
"vi" => "Vietnamese",
"he" => "Hebrew",
"th" => "Thai",
"kr" => "Korean",
"ar" => "Arabic"
]);

register_activation_hook(__FILE__, 'frcaptcha_activate');
Expand Down
1 change: 0 additions & 1 deletion friendly-captcha/public/vendor/v1/widget.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion friendly-captcha/public/vendor/v1/widget.module.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions friendly-captcha/public/vendor/v1/widget.polyfilled.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion friendly-captcha/public/vendor/v2/site.compat.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion friendly-captcha/public/vendor/v2/site.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions friendly-captcha/public/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function frcaptcha_v1_enqueue_widget_scripts()
/* Fallback for (very) old browsers */
wp_enqueue_script(
'friendly-captcha-widget-fallback',
plugin_dir_url(__FILE__) . 'vendor/v1/widget.min.js',
plugin_dir_url(__FILE__) . 'vendor/v1/widget.polyfilled.min.js',
array(),
$version,
true
Expand Down Expand Up @@ -101,7 +101,7 @@ function frcaptcha_v1_echo_script_tags()
$version = FriendlyCaptcha_Plugin::$friendly_challenge_version;

echo '<script async defer type="module" src="' . plugin_dir_url(__FILE__) . 'vendor/v1/widget.module.min.js?ver=' . $version . '"></script>';
echo '<script async defer nomodule src="' . plugin_dir_url(__FILE__) . 'vendor/v1/widget.min.js?ver=' . $version . '"></script>';
echo '<script async defer nomodule src="' . plugin_dir_url(__FILE__) . 'vendor/v1/widget.polyfilled.min.js?ver=' . $version . '"></script>';
}


Expand Down
8 changes: 7 additions & 1 deletion friendly-captcha/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: captcha, antispam, spam, contact form, recaptcha, friendly-captcha, block
Requires at least: 5.0
Tested up to: 6.5
Requires PHP: 7.3
Stable tag: 1.15.1
Stable tag: 1.15.2
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -96,6 +96,12 @@ However, you may wish to email the authors of plugins you'd like to support Frie

== Changelog ==

= 1.15.2 =

* Use polyfilled version of widgets for better old browser support for Friendly Captcha v1.
* Update `friendly-captcha-sdk` to version `0.1.8`.
* Update `friendly-challenge` to version `0.9.18` which adds support for more languages (Arabic, Korean, Hebrew, Thai).

= 1.15.1 =

* Don't call siteverify endpoint when Captcha solution is empty
Expand Down
10 changes: 6 additions & 4 deletions scripts/update-sdk.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# V1
curl -o ./friendly-captcha/public/vendor/v1/widget.module.min.js https://cdn.jsdelivr.net/npm/friendly-challenge/widget.module.min.js
curl -o ./friendly-captcha/public/vendor/v1/widget.min.js https://cdn.jsdelivr.net/npm/friendly-challenge/widget.min.js
V1_VERSION="0.9.18"
curl -o ./friendly-captcha/public/vendor/v1/widget.module.min.js https://cdn.jsdelivr.net/npm/friendly-challenge@${V1_VERSION}/widget.module.min.js
curl -o ./friendly-captcha/public/vendor/v1/widget.polyfilled.min.js https://cdn.jsdelivr.net/npm/friendly-challenge@${V1_VERSION}/widget.polyfilled.min.js

# V2
curl -o ./friendly-captcha/public/vendor/v2/site.min.js https://cdn.jsdelivr.net/npm/@friendlycaptcha/sdk/site.min.js
curl -o ./friendly-captcha/public/vendor/v2/site.compat.min.js https://cdn.jsdelivr.net/npm/@friendlycaptcha/sdk/site.compat.min.js
V2_VERSION="0.1.8"
curl -o ./friendly-captcha/public/vendor/v2/site.min.js https://cdn.jsdelivr.net/npm/@friendlycaptcha/sdk@${V2_VERSION}/site.min.js
curl -o ./friendly-captcha/public/vendor/v2/site.compat.min.js https://cdn.jsdelivr.net/npm/@friendlycaptcha/sdk@${V2_VERSION}/site.compat.min.js

0 comments on commit f286d93

Please sign in to comment.