Push Notifications (Mobile and PC) (#13277)

* Update manifest and add service worker
cleanup icons a bit

* Push notifications WIP

* navigate working

* cleanup

* acknowledge wired up

* Set VAPID keys on composer install

* Component to control notification permissions.

* Allow all user option to validate

* Enable on browser load if transport exists.

* Check for transport before showing user permissions
translations

* Documentation

* style fixes

* access via the attribute model

* fix alerting test

* update schema

* cleanup subscription on disable

* non-configurable db and table for webpush subscriptions (respect system connection)

* revert AlertTransport change
hopefully phpstan can figure it out

* phpstan fixes

* Support custom details display

* Match transport names to brand's preferred display

* less duplicate id errors

* Tests are done in Laravel code now so
remove legacy function usage... could be better, but ok

* Style fixes

* Style fixes 2

* Fix alert test

* Doc updates requires HTTPS and GMP

* unregister subscription when permission is set to denied

* cleanup after user deletion

* delete the right thing

* fix whitespace

* update install docs to include php-gmp

* suggest ext-gmp

* update javascript

* Update functions.php

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
This commit is contained in:
Tony Murray
2021-10-06 07:29:47 -05:00
committed by GitHub
parent 83f847d92d
commit 0b8b97bb68
102 changed files with 1993 additions and 448 deletions

View File

@@ -37,8 +37,8 @@ if (Auth::user()->hasGlobalAdmin()) {
</div>
<div class="form-group" title="The type of transport.">
<label for='transport-choice' class='col-sm-3 col-md-2 control-label'>Transport type: </label>
<div class="col-sm-3">
<select name='transport-choice' id='transport-choice' class='form-control'>
<div class="col-sm-9 col-md-10">
<select name='transport-choice' id='transport-choice' class='form-control' style="width: auto">
<?php
// Create list of transport
@@ -49,10 +49,12 @@ if (Auth::user()->hasGlobalAdmin()) {
if (empty($transport)) {
continue;
}
$transports_list[] = $transport;
$class = "\LibreNMS\Alert\Transport\\$transport";
$instance = new $class;
$transports_list[$transport] = $instance->name();
}
foreach ($transports_list as $transport) {
echo '<option value="' . strtolower($transport) . '-form">' . $transport . '</option>';
foreach ($transports_list as $transport => $name) {
echo '<option value="' . strtolower($transport) . '-form">' . $name . '</option>';
} ?>
</select>
</div>
@@ -67,7 +69,7 @@ if (Auth::user()->hasGlobalAdmin()) {
<?php
$switches = []; // store names of bootstrap switches
foreach ($transports_list as $transport) {
foreach ($transports_list as $transport => $name) {
$class = 'LibreNMS\\Alert\\Transport\\' . $transport;
if (! method_exists($class, 'configTemplate')) {
@@ -77,7 +79,7 @@ if (Auth::user()->hasGlobalAdmin()) {
echo '<form method="post" role="form" id="' . strtolower($transport) . '-form" class="form-horizontal transport">';
echo csrf_field();
echo '<input type="hidden" name="transport-type" id="transport-type" value="' . strtolower($transport) . '">';
echo '<input type="hidden" name="transport-type" value="' . strtolower($transport) . '">';
$tmp = call_user_func($class . '::configTemplate');