Add titles and categories to notifications

Also, add more event data to prompts.
This commit is contained in:
Daniel
2020-10-29 22:54:46 +01:00
parent 17a0c8f721
commit ed00e1fe83
5 changed files with 86 additions and 40 deletions

View File

@@ -213,16 +213,6 @@ func setCaptivePortal(portalURL *url.URL) {
return
}
// notify
cleanUpPortalNotification()
defer func() {
// TODO: add "open" button
captivePortalNotification = notifications.NotifyInfo(
"netenv:captive-portal:"+captivePortal.Domain,
"Portmaster detected a captive portal at "+captivePortal.Domain,
)
}()
// set
captivePortal = &CaptivePortal{
URL: portalURL.String(),
@@ -234,6 +224,22 @@ func setCaptivePortal(portalURL *url.URL) {
} else {
captivePortal.Domain = portalURL.Hostname()
}
// notify
cleanUpPortalNotification()
// TODO: add "open" button
captivePortalNotification = notifications.Notify(&notifications.Notification{
EventID: fmt.Sprintf(
"netenv:captive-portal:%s", captivePortal.Domain,
),
Type: notifications.Info,
Title: "Captive Portal",
Category: "Core",
Message: fmt.Sprintf(
"Portmaster detected a captive portal at %s",
captivePortal.Domain,
),
})
}
func cleanUpPortalNotification() {