+ config: store/load "blocked_services" per-client setting
This commit is contained in:
parent
01f5a13dd2
commit
8307a5a494
|
@ -37,6 +37,9 @@ type clientObject struct {
|
||||||
ParentalEnabled bool `yaml:"parental_enabled"`
|
ParentalEnabled bool `yaml:"parental_enabled"`
|
||||||
SafeSearchEnabled bool `yaml:"safebrowsing_enabled"`
|
SafeSearchEnabled bool `yaml:"safebrowsing_enabled"`
|
||||||
SafeBrowsingEnabled bool `yaml:"safesearch_enabled"`
|
SafeBrowsingEnabled bool `yaml:"safesearch_enabled"`
|
||||||
|
|
||||||
|
UseGlobalBlockedServices bool `yaml:"use_global_blocked_services"`
|
||||||
|
BlockedServices []string `yaml:"blocked_services"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HTTPSServer struct {
|
type HTTPSServer struct {
|
||||||
|
@ -266,6 +269,9 @@ func parseConfig() error {
|
||||||
ParentalEnabled: cy.ParentalEnabled,
|
ParentalEnabled: cy.ParentalEnabled,
|
||||||
SafeSearchEnabled: cy.SafeSearchEnabled,
|
SafeSearchEnabled: cy.SafeSearchEnabled,
|
||||||
SafeBrowsingEnabled: cy.SafeBrowsingEnabled,
|
SafeBrowsingEnabled: cy.SafeBrowsingEnabled,
|
||||||
|
|
||||||
|
UseOwnBlockedServices: !cy.UseGlobalBlockedServices,
|
||||||
|
BlockedServices: cy.BlockedServices,
|
||||||
}
|
}
|
||||||
_, err = config.clients.Add(cli)
|
_, err = config.clients.Add(cli)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -317,6 +323,9 @@ func (c *configuration) write() error {
|
||||||
ParentalEnabled: cli.ParentalEnabled,
|
ParentalEnabled: cli.ParentalEnabled,
|
||||||
SafeSearchEnabled: cli.SafeSearchEnabled,
|
SafeSearchEnabled: cli.SafeSearchEnabled,
|
||||||
SafeBrowsingEnabled: cli.SafeBrowsingEnabled,
|
SafeBrowsingEnabled: cli.SafeBrowsingEnabled,
|
||||||
|
|
||||||
|
UseGlobalBlockedServices: !cli.UseOwnBlockedServices,
|
||||||
|
BlockedServices: cli.BlockedServices,
|
||||||
}
|
}
|
||||||
config.Clients = append(config.Clients, cy)
|
config.Clients = append(config.Clients, cy)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue