diff --git a/notification/method/webpush.php b/notification/method/webpush.php index 295b12b..375ddc4 100644 --- a/notification/method/webpush.php +++ b/notification/method/webpush.php @@ -445,7 +445,7 @@ protected function clean_expired_subscriptions(array $user_subscription_map, arr * into https://myboard.url/path/to/avatar=123456789.gif * * @param string $avatar - * @return string Absolute path to avatar image + * @return array Absolute path to avatar image in an array with src as its key */ protected function prepare_avatar($avatar) { @@ -455,7 +455,7 @@ protected function prepare_avatar($avatar) $path = !empty($matches[1]) ? end($matches[1]) : $avatar; - return preg_replace('#^' . preg_quote($this->path_helper->get_web_root_path(), '#') . '#', $this->get_board_url(), $path, 1); + return ['src' => preg_replace('#^' . preg_quote($this->path_helper->get_web_root_path(), '#') . '#', $this->get_board_url(), $path, 1)]; } /** diff --git a/styles/all/template/push_worker.js.twig b/styles/all/template/push_worker.js.twig index 428c211..8d6ec3c 100644 --- a/styles/all/template/push_worker.js.twig +++ b/styles/all/template/push_worker.js.twig @@ -36,7 +36,7 @@ self.addEventListener('push', event => { const options = { body: responseBody, data: response, - icon: response.avatar, + icon: response.avatar.src, }; self.registration.showNotification(response.heading, options); });