Skip to content

Commit

Permalink
Add tooltip text to let users know when firewall is disabled because …
Browse files Browse the repository at this point in the history
…of host
  • Loading branch information
CodeyGuyDylan committed Jan 7, 2025
1 parent ce506e5 commit a7a1c71
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function useProtectTooltipCopy(): TooltipContent {
jetpack_waf_automatic_rules: isAutoFirewallEnabled,
blocked_logins: blockedLoginsCount,
brute_force_protection: hasBruteForceProtection,
waf_supported: wafSupported,
} = wafData || {};

const pluginsCount = fromScanPlugins.length || Object.keys( plugins ).length;
Expand Down Expand Up @@ -249,18 +250,23 @@ export function useProtectTooltipCopy(): TooltipContent {
hasProtectPaidPlan && ! isAutoFirewallEnabled
? {
title: __( 'Auto-Firewall: Inactive', 'jetpack-my-jetpack' ),
text: createInterpolateElement(
__(
'You have Auto-Firewall disabled, visit your Protect <a>firewall settings</a> to activate.',
'jetpack-my-jetpack'
),
{
a: createElement( 'a', {
href: settingsLink,
onClick: trackFirewallSettingsLinkClick,
} ),
}
),
text: wafSupported
? createInterpolateElement(
__(
'You have Auto-Firewall disabled, visit your Protect <a>firewall settings</a> to activate.',
'jetpack-my-jetpack'
),
{
a: createElement( 'a', {
href: settingsLink,
onClick: trackFirewallSettingsLinkClick,
} ),
}
)
: __(
'Auto-Firewall is disabled as your hosting provider already includes a built-in firewall with similar rules for your site.',
'jetpack-my-jetpack'
),
}
: {
title: __( 'Auto-Firewall: Inactive', 'jetpack-my-jetpack' ),
Expand Down
1 change: 1 addition & 0 deletions projects/packages/my-jetpack/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ interface Window {
jetpack_waf_share_data: '1' | '';
jetpack_waf_share_debug_data: boolean;
standalone_mode: boolean;
waf_supported: boolean;
};
};
videopress: {
Expand Down
10 changes: 8 additions & 2 deletions projects/packages/my-jetpack/src/class-initializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,12 @@ public static function enqueue_scripts() {
$scan_data = Products\Protect::get_protect_data();
self::update_historically_active_jetpack_modules();

$waf_config = array();
$waf_config = array();
$waf_supported = false;

if ( class_exists( 'Automattic\Jetpack\Waf\Waf_Runner' ) ) {
$waf_config = Waf_Runner::get_config();
$waf_config = Waf_Runner::get_config();
$waf_supported = Waf_Runner::is_supported_environment();
}

wp_localize_script(
Expand Down Expand Up @@ -297,6 +300,9 @@ public static function enqueue_scripts() {
'scanData' => $scan_data,
'wafConfig' => array_merge(
$waf_config,
array(
'waf_supported' => $waf_supported,
),
array( 'blocked_logins' => (int) get_site_option( 'jetpack_protect_blocked_attempts', 0 ) )
),
),
Expand Down

0 comments on commit a7a1c71

Please sign in to comment.