From a121c08dc49c72501c30f20a3e31ed9dc4e1688d Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 23 May 2023 05:36:42 +0200 Subject: [PATCH 1/6] UI: Check for secure context instead of HTTPS (#114) --- server/ui-src/App.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ui-src/App.vue b/server/ui-src/App.vue index 3e8e6a4..0f31fce 100644 --- a/server/ui-src/App.vue +++ b/server/ui-src/App.vue @@ -83,7 +83,7 @@ export default { this.currentPath = window.location.hash.slice(1); }); - this.notificationsSupported = 'https:' == document.location.protocol + this.notificationsSupported = window.isSecureContext && ("Notification" in window && Notification.permission !== "denied"); this.notificationsEnabled = this.notificationsSupported && Notification.permission == "granted"; From 50b5f8667a6f9f28ed53cedbd7c605ea7aaeac3e Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Tue, 23 May 2023 16:07:05 +1200 Subject: [PATCH 2/6] Minor UI / CLI updates --- server/server.go | 4 ++-- server/ui-src/App.vue | 15 ++++++++------- utils/logger/logger.go | 13 ++++++++++++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/server/server.go b/server/server.go index 0297507..1ed7bb3 100644 --- a/server/server.go +++ b/server/server.go @@ -68,10 +68,10 @@ func Listen() { isReady.Store(true) if config.UITLSCert != "" && config.UITLSKey != "" { - logger.Log().Infof("[http] starting secure server on https://%s%s", logger.CleanIP(config.HTTPListen), config.Webroot) + logger.Log().Infof("[http] starting secure server on https://%s%s", logger.CleanHTTPIP(config.HTTPListen), config.Webroot) logger.Log().Fatal(http.ListenAndServeTLS(config.HTTPListen, config.UITLSCert, config.UITLSKey, nil)) } else { - logger.Log().Infof("[http] starting server on http://%s%s", logger.CleanIP(config.HTTPListen), config.Webroot) + logger.Log().Infof("[http] starting server on http://%s%s", logger.CleanHTTPIP(config.HTTPListen), config.Webroot) logger.Log().Fatal(http.ListenAndServe(config.HTTPListen, nil)) } } diff --git a/server/ui-src/App.vue b/server/ui-src/App.vue index 0f31fce..4bfd9a5 100644 --- a/server/ui-src/App.vue +++ b/server/ui-src/App.vue @@ -609,7 +609,8 @@ export default { }, setMessageToast: function (m) { - if (this.toastMessage) { + // don't display if browser notifications are enabled, or a toast is already displayed + if (this.notificationsEnabled || this.toastMessage) { return; } @@ -765,10 +766,10 @@ export default { class="list-group-item list-group-item-action" :class="!searching && !message ? 'active' : ''"> - Return + Return Inbox {{ formatNumber(unread) }} @@ -778,7 +779,7 @@ export default {