policies generator explicit.

This commit is contained in:
Miroslav Šedivý
2021-07-25 00:00:23 +02:00
parent f07f8b0f4d
commit 3b363459e1
2 changed files with 11 additions and 17 deletions
+3 -3
View File
@@ -22,9 +22,7 @@ func Generate(policies types.Policies) (string, error) {
// Homepage
//
if policies.Homepage != "" {
policiesTmpl["HomepageLocation"] = policies.Homepage
}
policiesTmpl["HomepageLocation"] = policies.Homepage
//
// Extensions
@@ -79,6 +77,8 @@ func Generate(policies types.Policies) (string, error) {
} else {
// Keep cookies for the duration of the session
policiesTmpl["DefaultCookiesSetting"] = 4
// Open New Tab Page
policiesTmpl["RestoreOnStartup"] = 5
}
data, err := json.MarshalIndent(policiesTmpl, "", " ")
+8 -14
View File
@@ -23,11 +23,9 @@ func Generate(policies types.Policies) (string, error) {
// Homepage
//
if policies.Homepage != "" {
policiesTmpl.Policies["Homepage"] = map[string]interface{}{
"URL": policies.Homepage,
"StartPage": "homepage",
}
policiesTmpl.Policies["Homepage"] = map[string]interface{}{
"URL": policies.Homepage,
"StartPage": "homepage",
}
//
@@ -58,15 +56,11 @@ func Generate(policies types.Policies) (string, error) {
// Persistent Data
//
if policies.PersistentData {
Preferences := policiesTmpl.Policies["Preferences"].(map[string]interface{})
Preferences["browser.urlbar.suggest.history"] = true
Preferences["places.history.enabled"] = true
policiesTmpl.Policies["Preferences"] = Preferences
policiesTmpl.Policies["SanitizeOnShutdown"] = false
} else {
policiesTmpl.Policies["SanitizeOnShutdown"] = true
}
Preferences := policiesTmpl.Policies["Preferences"].(map[string]interface{})
Preferences["browser.urlbar.suggest.history"] = policies.PersistentData
Preferences["places.history.enabled"] = policies.PersistentData
policiesTmpl.Policies["Preferences"] = Preferences
policiesTmpl.Policies["SanitizeOnShutdown"] = !policies.PersistentData
data, err := json.MarshalIndent(policiesTmpl, "", " ")
if err != nil {