Improve notifications

This commit is contained in:
Daniel
2021-05-05 13:01:40 +02:00
parent 723809563c
commit 94756d9f38
4 changed files with 35 additions and 16 deletions

View File

@@ -55,14 +55,25 @@ func checkForConflictingService(ip net.IP, port uint16) error {
// Notify the user that we killed something. // Notify the user that we killed something.
notifications.Notify(&notifications.Notification{ notifications.Notify(&notifications.Notification{
EventID: "namserver:stopped-conflicting-service", EventID: "namserver:stopped-conflicting-service",
Type: notifications.Info, Type: notifications.Info,
Title: "Conflicting DNS Service", Title: "Stopped Conflicting DNS Client",
Category: "Secure DNS",
Message: fmt.Sprintf( Message: fmt.Sprintf(
"The Portmaster stopped a conflicting name service (pid %d) to gain required system integration.", "The Portmaster stopped a conflicting DNS client (pid %d) to gain required system integration. If you are running another DNS client on this device on purpose, you can the check the documentation if it is compatible with the Portmaster.",
killed, killed,
), ),
ShowOnSystem: true,
AvailableActions: []*notifications.Action{
{
ID: "ack",
Text: "OK",
},
{
Text: "Open Docs",
Type: notifications.ActionTypeOpenURL,
Payload: "https://docs.safing.io/portmaster/install/status/software-compatibility",
},
},
}) })
// Restart nameserver via service-worker logic. // Restart nameserver via service-worker logic.

View File

@@ -241,15 +241,23 @@ func setCaptivePortal(portalURL *url.URL) {
// notify // notify
cleanUpPortalNotification() cleanUpPortalNotification()
captivePortalNotification = notifications.Notify(&notifications.Notification{ captivePortalNotification = notifications.Notify(&notifications.Notification{
EventID: "netenv:captive-portal", EventID: "netenv:captive-portal",
Type: notifications.Info, Type: notifications.Info,
Title: "Captive Portal", Title: "Captive Portal Detected",
Category: "Core", Message: "The Portmaster detected a captive portal. You might experience limited network connectivity until the portal is handled.",
Message: fmt.Sprintf( ShowOnSystem: true,
"Portmaster detected a captive portal at %s", EventData: captivePortal,
captivePortal.Domain, AvailableActions: []*notifications.Action{
), {
EventData: captivePortal, Text: "Open Portal",
Type: notifications.ActionTypeOpenURL,
Payload: captivePortal.URL,
},
{
ID: "ack",
Text: "Ignore",
},
},
}) })
} }

View File

@@ -282,7 +282,7 @@ func checkForUpdates(ctx context.Context) (err error) {
"The Portmaster failed to check for updates. This might be a temporary issue of your device, your network or the update servers. The Portmaster will automatically try again later.", "The Portmaster failed to check for updates. This might be a temporary issue of your device, your network or the update servers. The Portmaster will automatically try again later.",
notifications.Action{ notifications.Action{
ID: "retry", ID: "retry",
Text: "Try Again", Text: "Try Again Now",
Type: notifications.ActionTypeWebhook, Type: notifications.ActionTypeWebhook,
Payload: &notifications.ActionTypeWebhookPayload{ Payload: &notifications.ActionTypeWebhookPayload{
URL: apiPathCheckForUpdates, URL: apiPathCheckForUpdates,

View File

@@ -253,7 +253,7 @@ func warnOnIncorrectParentPath() {
"updates:unsupported-parent", "updates:unsupported-parent",
"Unsupported Launcher", "Unsupported Launcher",
fmt.Sprintf( fmt.Sprintf(
"The portmaster has been launched by an unexpected %s binary at %s. Please configure your system to use the binary at %s as this version will be kept up to date automatically.", "The Portmaster has been launched by an unexpected %s binary at %s. Please configure your system to use the binary at %s as this version will be kept up to date automatically.",
expectedFileName, expectedFileName,
absPath, absPath,
filepath.Join(root, expectedFileName), filepath.Join(root, expectedFileName),