mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/17333] ACP option to enable-disable all push notifications
PHPBB-17333 Signed-off-by: Matt Friedman <maf675@gmail.com>
This commit is contained in:
parent
b5d1d03a47
commit
e35a6f7aa5
5 changed files with 57 additions and 0 deletions
|
@ -494,6 +494,7 @@ class acp_board
|
||||||
'webpush_enable' => ['lang' => 'WEBPUSH_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'webpush_enable', 'explain' => true],
|
'webpush_enable' => ['lang' => 'WEBPUSH_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'webpush_enable', 'explain' => true],
|
||||||
'webpush_vapid_public' => ['lang' => 'WEBPUSH_VAPID_PUBLIC', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true],
|
'webpush_vapid_public' => ['lang' => 'WEBPUSH_VAPID_PUBLIC', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true],
|
||||||
'webpush_vapid_private' => ['lang' => 'WEBPUSH_VAPID_PRIVATE', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true],
|
'webpush_vapid_private' => ['lang' => 'WEBPUSH_VAPID_PRIVATE', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true],
|
||||||
|
'webpush_method_enables' => ['lang' => 'WEBPUSH_METHOD_ENABLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
|
||||||
|
|
||||||
'legend3' => 'ACP_SUBMIT_CHANGES',
|
'legend3' => 'ACP_SUBMIT_CHANGES',
|
||||||
],
|
],
|
||||||
|
|
|
@ -329,6 +329,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\backup\con
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_enable', '0');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_enable', '0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_vapid_public', '');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_vapid_public', '');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_vapid_private', '');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_vapid_private', '');
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_method_enables', '0');
|
||||||
|
|
||||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cache_last_gc', '0', 1);
|
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cache_last_gc', '0', 1);
|
||||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cron_lock', '0', 1);
|
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cron_lock', '0', 1);
|
||||||
|
|
|
@ -590,6 +590,8 @@ $lang = array_merge($lang, [
|
||||||
'WEBPUSH_VAPID_PUBLIC_EXPLAIN' => 'The Voluntary Application Server Identification (VAPID) public key is shared to authenticate push messages from your site.<br><em><strong>Caution:</strong> Modifying the VAPID public key will automatically render all Web Push subscriptions invalid.</em>',
|
'WEBPUSH_VAPID_PUBLIC_EXPLAIN' => 'The Voluntary Application Server Identification (VAPID) public key is shared to authenticate push messages from your site.<br><em><strong>Caution:</strong> Modifying the VAPID public key will automatically render all Web Push subscriptions invalid.</em>',
|
||||||
'WEBPUSH_VAPID_PRIVATE' => 'Server identification private key',
|
'WEBPUSH_VAPID_PRIVATE' => 'Server identification private key',
|
||||||
'WEBPUSH_VAPID_PRIVATE_EXPLAIN' => 'The Voluntary Application Server Identification (VAPID) private key is used to generate authenticated push messages dispatched from your site. The VAPID private key <strong>must</strong> form a valid public-private key pair alongside the VAPID public key.<br><em><strong>Caution:</strong> Modifying the VAPID private key will automatically render all Web Push subscriptions invalid.</em>',
|
'WEBPUSH_VAPID_PRIVATE_EXPLAIN' => 'The Voluntary Application Server Identification (VAPID) private key is used to generate authenticated push messages dispatched from your site. The VAPID private key <strong>must</strong> form a valid public-private key pair alongside the VAPID public key.<br><em><strong>Caution:</strong> Modifying the VAPID private key will automatically render all Web Push subscriptions invalid.</em>',
|
||||||
|
'WEBPUSH_METHOD_ENABLES' => 'Enable all user-based web push notification options by default',
|
||||||
|
'WEBPUSH_METHOD_ENABLES_EXPLAIN'=> 'When this setting is enabled, users who subscribe and allow browser notifications will start receiving them automatically. Users only need to visit the UCP Notification settings to disable any unwanted notifications.<br><br>If this setting is disabled, users will not receive any notifications, even if they have subscribed, until they visit the UCP Notification settings to enable the specific notification options they wish to receive.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Jabber settings
|
// Jabber settings
|
||||||
|
|
45
phpBB/phpbb/db/migration/data/v400/add_webpush_options.php
Normal file
45
phpBB/phpbb/db/migration/data/v400/add_webpush_options.php
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
|
use phpbb\db\migration\migration;
|
||||||
|
|
||||||
|
class add_webpush_options extends migration
|
||||||
|
{
|
||||||
|
public static function depends_on(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'\phpbb\db\migration\data\v400\add_webpush',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function effectively_installed(): bool
|
||||||
|
{
|
||||||
|
return $this->config->offsetExists('webpush_method_enables');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_data(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['config.add', ['webpush_method_enables', false]],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function revert_data(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['config.remove', ['webpush_method_enables']],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -91,6 +91,14 @@ class webpush extends messenger_base implements extended_method_interface
|
||||||
&& !empty($this->config['webpush_vapid_public']) && !empty($this->config['webpush_vapid_private']);
|
&& !empty($this->config['webpush_vapid_public']) && !empty($this->config['webpush_vapid_private']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function is_enabled_by_default()
|
||||||
|
{
|
||||||
|
return $this->config['webpush_method_enables'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue