mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Merge pull request #307 from safing/fix/prompts-on-desktop
Set ShowOnSystem correctly for prompts
This commit is contained in:
commit
2cfdae46b7
3 changed files with 11 additions and 27 deletions
|
@ -13,8 +13,6 @@ var (
|
||||||
|
|
||||||
CfgNetworkServiceKey = "core/networkService"
|
CfgNetworkServiceKey = "core/networkService"
|
||||||
defaultNetworkServiceMode bool
|
defaultNetworkServiceMode bool
|
||||||
|
|
||||||
CfgUseSystemNotificationsKey = "core/useSystemNotifications"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -27,7 +25,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func registerConfig() error {
|
func registerConfig() error {
|
||||||
err := config.Register(&config.Option{
|
if err := config.Register(&config.Option{
|
||||||
Name: "Network Service",
|
Name: "Network Service",
|
||||||
Key: CfgNetworkServiceKey,
|
Key: CfgNetworkServiceKey,
|
||||||
Description: "Use the Portmaster as a network service, where applicable. You will have to take care of lots of network setup yourself in order to run this properly and securely.",
|
Description: "Use the Portmaster as a network service, where applicable. You will have to take care of lots of network setup yourself in order to run this properly and securely.",
|
||||||
|
@ -39,25 +37,7 @@ func registerConfig() error {
|
||||||
config.DisplayOrderAnnotation: 513,
|
config.DisplayOrderAnnotation: 513,
|
||||||
config.CategoryAnnotation: "Network Service",
|
config.CategoryAnnotation: "Network Service",
|
||||||
},
|
},
|
||||||
})
|
}); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = config.Register(&config.Option{
|
|
||||||
Name: "Desktop Notifications",
|
|
||||||
Key: CfgUseSystemNotificationsKey,
|
|
||||||
Description: "In addition to showing notifications in the Portmaster App, also send them to the Desktop. This requires the Portmaster Notifier to be running.",
|
|
||||||
OptType: config.OptTypeBool,
|
|
||||||
ExpertiseLevel: config.ExpertiseLevelUser,
|
|
||||||
ReleaseLevel: config.ReleaseLevelStable,
|
|
||||||
DefaultValue: true, // TODO: turn off by default on unsupported systems
|
|
||||||
Annotations: config.Annotations{
|
|
||||||
config.DisplayOrderAnnotation: -15,
|
|
||||||
config.CategoryAnnotation: "User Interface",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package firewall
|
||||||
import (
|
import (
|
||||||
"github.com/safing/portbase/api"
|
"github.com/safing/portbase/api"
|
||||||
"github.com/safing/portbase/config"
|
"github.com/safing/portbase/config"
|
||||||
|
"github.com/safing/portbase/notifications"
|
||||||
"github.com/safing/portmaster/core"
|
"github.com/safing/portmaster/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ var (
|
||||||
|
|
||||||
CfgOptionAskWithSystemNotificationsKey = "filter/askWithSystemNotifications"
|
CfgOptionAskWithSystemNotificationsKey = "filter/askWithSystemNotifications"
|
||||||
cfgOptionAskWithSystemNotificationsOrder = 2
|
cfgOptionAskWithSystemNotificationsOrder = 2
|
||||||
|
askWithSystemNotifications config.BoolOption
|
||||||
|
|
||||||
CfgOptionAskTimeoutKey = "filter/askTimeout"
|
CfgOptionAskTimeoutKey = "filter/askTimeout"
|
||||||
cfgOptionAskTimeoutOrder = 3
|
cfgOptionAskTimeoutOrder = 3
|
||||||
|
@ -55,7 +57,7 @@ func registerConfig() error {
|
||||||
config.DisplayOrderAnnotation: cfgOptionAskWithSystemNotificationsOrder,
|
config.DisplayOrderAnnotation: cfgOptionAskWithSystemNotificationsOrder,
|
||||||
config.CategoryAnnotation: "General",
|
config.CategoryAnnotation: "General",
|
||||||
config.RequiresAnnotation: config.ValueRequirement{
|
config.RequiresAnnotation: config.ValueRequirement{
|
||||||
Key: core.CfgUseSystemNotificationsKey,
|
Key: notifications.CfgUseSystemNotificationsKey,
|
||||||
Value: true,
|
Value: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -63,6 +65,7 @@ func registerConfig() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
askWithSystemNotifications = config.Concurrent.GetAsBool(CfgOptionAskWithSystemNotificationsKey, true)
|
||||||
|
|
||||||
err = config.Register(&config.Option{
|
err = config.Register(&config.Option{
|
||||||
Name: "Prompt Timeout",
|
Name: "Prompt Timeout",
|
||||||
|
|
|
@ -173,6 +173,7 @@ func createPrompt(ctx context.Context, conn *network.Connection, pkt packet.Pack
|
||||||
Type: notifications.Prompt,
|
Type: notifications.Prompt,
|
||||||
Title: "Connection Prompt",
|
Title: "Connection Prompt",
|
||||||
Category: "Privacy Filter",
|
Category: "Privacy Filter",
|
||||||
|
ShowOnSystem: askWithSystemNotifications(),
|
||||||
EventData: &promptData{
|
EventData: &promptData{
|
||||||
Entity: entity,
|
Entity: entity,
|
||||||
Profile: promptProfile{
|
Profile: promptProfile{
|
||||||
|
|
Loading…
Add table
Reference in a new issue