diff --git a/.github/actions/tests/install-wordpress-with-plugins/action.yml b/.github/actions/tests/install-wordpress-with-plugins/action.yml index d80779f..fb1bae3 100644 --- a/.github/actions/tests/install-wordpress-with-plugins/action.yml +++ b/.github/actions/tests/install-wordpress-with-plugins/action.yml @@ -19,7 +19,7 @@ runs: sed -i "s/username_here/root/" wp-config.php sed -i "s/password_here/wordpress/" wp-config.php sed -i "s/localhost/127.0.0.1/" wp-config.php - sed -i "s/define( 'WP_DEBUG', false );/define( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_DISPLAY', false );\ndefine( 'WP_DEBUG_LOG', true );error_reporting( E_ALL );/" wp-config.php + sed -i "s|define( 'WP_DEBUG', false );|define( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_DISPLAY', false );\ndefine( 'WP_DEBUG_LOG', true );error_reporting( E_ALL );\ndefine( 'WP_HOME', 'https://procaptcha.local' );\ndefine( 'WP_SITEURL', 'https://procaptcha.local' );\n\$_SERVER['HTTPS'] = 'on';|" wp-config.php cp -r ${{ github.workspace }}/prosopo-procaptcha ${{ github.workspace }}/wp-content/plugins/ mkdir -p ${{ github.workspace }}/wp-content/mu-plugins cp ${{ github.workspace }}/data-for-tests/mu-plugin.php ${{ github.workspace }}/wp-content/mu-plugins/mu-plugin.php diff --git a/.github/actions/tests/prepare-e2e-workflow/action.yml b/.github/actions/tests/prepare-e2e-workflow/action.yml index 9a51f5f..c24052f 100644 --- a/.github/actions/tests/prepare-e2e-workflow/action.yml +++ b/.github/actions/tests/prepare-e2e-workflow/action.yml @@ -19,9 +19,15 @@ runs: shell: bash - name: Wait for WordPress to start - run: npx wait-on http://procaptcha.local --timeout 10000 + run: npx wait-on https://procaptcha.local --timeout 10000 + shell: bash + env: + NODE_TLS_REJECT_UNAUTHORIZED: "0" + + - name: Run WordPress database upgrade + run: curl -sSL "https://procaptcha.local/wp-admin/upgrade.php?step=upgrade_db" > /dev/null shell: bash - name: Check domain resolution - run: curl -I http://procaptcha.local + run: curl -I https://procaptcha.local shell: bash diff --git a/.github/actions/tests/setup-e2e-packages/action.yml b/.github/actions/tests/setup-e2e-packages/action.yml index 4034d8d..1340d20 100644 --- a/.github/actions/tests/setup-e2e-packages/action.yml +++ b/.github/actions/tests/setup-e2e-packages/action.yml @@ -8,24 +8,56 @@ runs: run: echo "127.0.0.1 localhost procaptcha.local" | sudo tee /etc/hosts shell: bash + - name: Generate self-signed TLS cert for procaptcha.local + run: | + sudo mkdir -p /etc/ssl/procaptcha + sudo openssl req -x509 -newkey rsa:4096 -nodes -days 365 \ + -keyout /etc/ssl/procaptcha/server.key \ + -out /etc/ssl/procaptcha/server.crt \ + -subj "/CN=procaptcha.local" \ + -addext "subjectAltName=DNS:procaptcha.local,DNS:localhost,IP:127.0.0.1" + sudo chmod 644 /etc/ssl/procaptcha/server.crt + sudo chmod 640 /etc/ssl/procaptcha/server.key + shell: bash + + - name: Install cert in system + Chrome trust stores + run: | + sudo cp /etc/ssl/procaptcha/server.crt /usr/local/share/ca-certificates/procaptcha-dev.crt + sudo update-ca-certificates + sudo apt-get install -y libnss3-tools >/dev/null + mkdir -p "$HOME/.pki/nssdb" + certutil -d sql:"$HOME/.pki/nssdb" -N --empty-password 2>/dev/null || true + certutil -A -n "Procaptcha Dev" -t "CT,C,C" -i /etc/ssl/procaptcha/server.crt -d sql:"$HOME/.pki/nssdb" + shell: bash + - name: Configure Nginx run: | sudo bash -c 'cat > /etc/nginx/sites-available/default <id ); }, 10, 3 diff --git a/prosopo-procaptcha/prosopo-procaptcha.php b/prosopo-procaptcha/prosopo-procaptcha.php index 6c62c68..3533fbe 100644 --- a/prosopo-procaptcha/prosopo-procaptcha.php +++ b/prosopo-procaptcha/prosopo-procaptcha.php @@ -2,7 +2,7 @@ /** * Plugin Name: Prosopo Procaptcha * Description: GDPR compliant, privacy friendly and better value captcha. - * Version: 1.20.3 + * Version: 1.20.4 * Author: Prosopo Team * Author URI: https://prosopo.io/ * License: GPLv2 or later diff --git a/prosopo-procaptcha/readme.txt b/prosopo-procaptcha/readme.txt index fde83fb..8242f09 100644 --- a/prosopo-procaptcha/readme.txt +++ b/prosopo-procaptcha/readme.txt @@ -4,7 +4,7 @@ Tags: Captcha, Procaptcha, antispam, anibot, spam. Requires at least: 5.5 Tested up to: 6.9 Requires PHP: 7.4 -Stable tag: 1.20.3 +Stable tag: 1.20.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -135,6 +135,9 @@ Absolutely! The plugin has a [public GitHub repository](https://github.com/proso == Changelog == += 1.20.4 (2026-08-10) = +* Fix: fatal error on load when using Gravity Forms 3.0.2+ (get_field_label signature mismatch) + = 1.20.3 (2026-01-20) = * Maintenance: compatibility with the latest Procaptcha statistics API diff --git a/prosopo-procaptcha/src/Integrations/Plugins/Gravity_Forms/Gravity_Field.php b/prosopo-procaptcha/src/Integrations/Plugins/Gravity_Forms/Gravity_Field.php index 44c2a43..5f1b0b9 100644 --- a/prosopo-procaptcha/src/Integrations/Plugins/Gravity_Forms/Gravity_Field.php +++ b/prosopo-procaptcha/src/Integrations/Plugins/Gravity_Forms/Gravity_Field.php @@ -62,7 +62,7 @@ public function get_form_editor_field_settings() { * * @since unknown */ - public function get_field_label( $force_frontend_label, $value ) { + public function get_field_label( $force_frontend_label = true, $value = '' ) { return self::get_widget()->get_field_label(); } diff --git a/prosopo-procaptcha/src/Procaptcha_Plugin.php b/prosopo-procaptcha/src/Procaptcha_Plugin.php index be91ea2..90f178d 100644 --- a/prosopo-procaptcha/src/Procaptcha_Plugin.php +++ b/prosopo-procaptcha/src/Procaptcha_Plugin.php @@ -43,6 +43,7 @@ final class Procaptcha_Plugin { const PLUGIN_SLUG = 'prosopo-procaptcha'; const SERVICE_SCRIPT_URL = 'https://js.prosopo.io/js/procaptcha.bundle.js'; + const SERVICE_SCRIPT_IIFE_URL = 'https://js.prosopo.io/js/procaptcha.bundle.iife.js'; const ACCOUNT_API_ENDPOINT_URL = 'https://api.prosopo.io/sites/wp-details'; const DOCS_URL_BASE = 'https://docs.prosopo.io/en/wordpress-plugin'; const SUPPORT_FORUM_URL = 'https://wordpress.org/support/plugin/prosopo-procaptcha/'; @@ -169,6 +170,7 @@ function ( array $event_details ) { protected function load_widget(): void { $this->widget_assets_manager = new Widget_Assets_Loader( self::SERVICE_SCRIPT_URL, + self::SERVICE_SCRIPT_IIFE_URL, 'prosopo-procaptcha', $this->plugin_assets->get_loader(), $this->procaptcha_settings diff --git a/prosopo-procaptcha/src/Utils/Assets/Assets_Loader.php b/prosopo-procaptcha/src/Utils/Assets/Assets_Loader.php index 0f2e75b..3153865 100644 --- a/prosopo-procaptcha/src/Utils/Assets/Assets_Loader.php +++ b/prosopo-procaptcha/src/Utils/Assets/Assets_Loader.php @@ -49,7 +49,7 @@ public function load_script( $script_settings = array( 'in_footer' => true, - 'strategy ' => $has_dependencies ? + 'strategy' => $has_dependencies ? 'defer' : 'async', ); diff --git a/prosopo-procaptcha/src/Widget/Widget_Assets_Loader.php b/prosopo-procaptcha/src/Widget/Widget_Assets_Loader.php index 1301854..7112783 100644 --- a/prosopo-procaptcha/src/Widget/Widget_Assets_Loader.php +++ b/prosopo-procaptcha/src/Widget/Widget_Assets_Loader.php @@ -13,7 +13,9 @@ final class Widget_Assets_Loader implements Hookable { private string $service_script_url; + private string $service_script_iife_url; private string $service_script_handle; + private string $service_script_iife_handle; private bool $is_widget_in_use; /** @@ -29,12 +31,15 @@ final class Widget_Assets_Loader implements Hookable { public function __construct( string $service_script_url, + string $service_script_iife_url, string $service_script_handle, Assets_Loader $assets_loader, Procaptcha_Settings $procaptcha_settings ) { - $this->service_script_url = $service_script_url; - $this->service_script_handle = $service_script_handle; + $this->service_script_url = $service_script_url; + $this->service_script_iife_url = $service_script_iife_url; + $this->service_script_handle = $service_script_handle; + $this->service_script_iife_handle = $service_script_handle . '-iife'; $this->procaptcha_settings = $procaptcha_settings; $this->assets_loader = $assets_loader; @@ -51,6 +56,19 @@ public function set_hooks( Screen_Detector $screen_detector ): void { // priority must be less than 10, to make sure the wp_enqueue_script still has effect. add_action( $hook, array( $this, 'enqueue_assets_when_in_use' ), 1 ); + + add_filter( 'script_loader_tag', array( $this, 'add_nomodule_attribute_to_iife_script' ), 11, 2 ); + } + + public function add_nomodule_attribute_to_iife_script( string $script_tag, string $script_handle ): string { + if ( $script_handle !== $this->service_script_iife_handle ) { + return $script_tag; + } + + // for old WP versions. + $script_tag = str_replace( ' type="text/javascript"', '', $script_tag ); + + return str_replace( '