From dc3f40933ea64256aba7c9f44f686ce31f60f079 Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 6 Dec 2024 17:51:20 +0700 Subject: [PATCH 1/2] Adjust server SSL connection checks. --- acp/wpn_acp_module.php | 3 ++- language/en/webpushnotifications_module_acp.php | 2 +- language/ru/webpushnotifications_module_acp.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/acp/wpn_acp_module.php b/acp/wpn_acp_module.php index da118b8..22c1ecd 100644 --- a/acp/wpn_acp_module.php +++ b/acp/wpn_acp_module.php @@ -62,6 +62,7 @@ public function main($id, $mode) $this->lang = $phpbb_container->get('language'); $this->log = $phpbb_container->get('log'); $this->request = $phpbb_container->get('request'); + $this->symfony_request = $phpbb_container->get('symfony_request'); $this->template = $phpbb_container->get('template'); $this->user = $phpbb_container->get('user'); @@ -106,7 +107,7 @@ public function display_settings() 'U_ACTION' => $this->u_action, ]); - if (!$this->request->server('HTTPS', false) && $this->request->server('SERVER_NAME') !== 'localhost') + if (!$this->symfony_request->isSecure() && $this->request->server('SERVER_NAME') !== 'localhost') { $this->errors[] = $this->lang->lang('WEBPUSH_INSECURE_SERVER_ERROR'); } diff --git a/language/en/webpushnotifications_module_acp.php b/language/en/webpushnotifications_module_acp.php index d8c666e..b4ab49b 100644 --- a/language/en/webpushnotifications_module_acp.php +++ b/language/en/webpushnotifications_module_acp.php @@ -50,5 +50,5 @@ 'WEBPUSH_METHOD_ENABLED_EXPLAIN'=> 'When this setting is enabled, users who have also enabled and allowed browser notifications will start receiving them automatically. They can visit the UCP Notification settings to disable any unwanted notifications.

If this setting is disabled, users will not receive any notifications, even if they have enabled push notifications, until they visit the UCP Notification settings to allow the specific notifications they wish to receive.', 'WEBPUSH_DROPDOWN_SUBSCRIBE' => 'Show web push settings in the notification dropdown', 'WEBPUSH_DROPDOWN_SUBSCRIBE_EXPLAIN'=> 'Show or hide the “Enable Web Push” toggle switch in the notification dropdown. This allows users to easily enable or disable push notifications from any page of the forum.', - 'WEBPUSH_INSECURE_SERVER_ERROR' => 'This board is not using a secure SSL/HTTPS server protocol, which is required to enable and use web push notifications.', + 'WEBPUSH_INSECURE_SERVER_ERROR' => 'This board is not using a secure SSL/HTTPS server protocol, which is required to enable and use web push notifications, or related server environment is misconfigured. Check if HTTPS and/or HEADER_CLIENT_PROTO server environment variables are correctly set.', ]); diff --git a/language/ru/webpushnotifications_module_acp.php b/language/ru/webpushnotifications_module_acp.php index 1830705..dd94ea6 100644 --- a/language/ru/webpushnotifications_module_acp.php +++ b/language/ru/webpushnotifications_module_acp.php @@ -50,5 +50,5 @@ 'WEBPUSH_METHOD_ENABLED_EXPLAIN'=> 'Если включено, то пользователи, подписавшиеся на браузерные push—уведомления, будут автоматически получать все их типы. Если отключено, то пользователи не будут получать браузерные push—уведомления до тех пор, пока хотя бы один их тип не выбран.

Отключить нежелательные или выбрать нужные типы браузерных push—уведомлений можно в настройках уведомлений в Личном разделе.', 'WEBPUSH_DROPDOWN_SUBSCRIBE' => 'Показать кнопку «Подписаться» в выпадающем меню уведомлений', 'WEBPUSH_DROPDOWN_SUBSCRIBE_EXPLAIN'=> 'Включить или отключить отображение кнопки «Подписаться» в выпадающем списке уведомлений. Если включено, то пользователи смогут подписываться на браузерные push-уведомления с любой страницы конференции.', - 'WEBPUSH_INSECURE_SERVER_ERROR' => 'На данной конференции не применяется защищённый протокол SSL/HTTPS, без которого использование браузерных push—уведомлений невозможно.', + 'WEBPUSH_INSECURE_SERVER_ERROR' => 'На данной конференции не применяется защищённый протокол SSL/HTTPS, без которого использование браузерных push—уведомлений невозможно, либо соответствующие переменные серверного окружения неверно сконфигурированы. Убедитесь, что значения переменных серверного окружения HTTPS и/или HEADER_CLIENT_PROTO заданы верно.', ]); From e3ea11076272068e17a8746b61a8b7d69906a8bb Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 6 Dec 2024 21:20:32 +0700 Subject: [PATCH 2/2] Better phrasing for en. --- language/en/webpushnotifications_module_acp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/en/webpushnotifications_module_acp.php b/language/en/webpushnotifications_module_acp.php index b4ab49b..1da78c4 100644 --- a/language/en/webpushnotifications_module_acp.php +++ b/language/en/webpushnotifications_module_acp.php @@ -50,5 +50,5 @@ 'WEBPUSH_METHOD_ENABLED_EXPLAIN'=> 'When this setting is enabled, users who have also enabled and allowed browser notifications will start receiving them automatically. They can visit the UCP Notification settings to disable any unwanted notifications.

If this setting is disabled, users will not receive any notifications, even if they have enabled push notifications, until they visit the UCP Notification settings to allow the specific notifications they wish to receive.', 'WEBPUSH_DROPDOWN_SUBSCRIBE' => 'Show web push settings in the notification dropdown', 'WEBPUSH_DROPDOWN_SUBSCRIBE_EXPLAIN'=> 'Show or hide the “Enable Web Push” toggle switch in the notification dropdown. This allows users to easily enable or disable push notifications from any page of the forum.', - 'WEBPUSH_INSECURE_SERVER_ERROR' => 'This board is not using a secure SSL/HTTPS server protocol, which is required to enable and use web push notifications, or related server environment is misconfigured. Check if HTTPS and/or HEADER_CLIENT_PROTO server environment variables are correctly set.', + 'WEBPUSH_INSECURE_SERVER_ERROR' => 'This board is not using a secure SSL/HTTPS protocol, which is required for enabling web push notifications. Alternatively, the server environment might be misconfigured. Ensure that the HTTPS and HEADER_CLIENT_PROTO server environment variables are correctly configured.', ]);