mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-02 22:51:34 -06:00
interface{} to any.
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
var policiesJson string
|
||||
|
||||
func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
policiesTmpl := map[string]interface{}{}
|
||||
policiesTmpl := map[string]any{}
|
||||
if err := json.Unmarshal([]byte(policiesJson), &policiesTmpl); err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -23,7 +23,7 @@ func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
// Extensions
|
||||
//
|
||||
|
||||
ExtensionInstallForcelist := []interface{}{}
|
||||
ExtensionInstallForcelist := []any{}
|
||||
for _, e := range policies.Extensions {
|
||||
URL := e.URL
|
||||
if URL == "" {
|
||||
@@ -36,7 +36,7 @@ func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
)
|
||||
}
|
||||
|
||||
ExtensionInstallAllowlist := []interface{}{}
|
||||
ExtensionInstallAllowlist := []any{}
|
||||
for _, e := range policies.Extensions {
|
||||
ExtensionInstallAllowlist = append(
|
||||
ExtensionInstallAllowlist,
|
||||
@@ -46,7 +46,7 @@ func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
|
||||
policiesTmpl["ExtensionInstallForcelist"] = ExtensionInstallForcelist
|
||||
policiesTmpl["ExtensionInstallAllowlist"] = ExtensionInstallAllowlist
|
||||
policiesTmpl["ExtensionInstallBlocklist"] = []interface{}{"*"}
|
||||
policiesTmpl["ExtensionInstallBlocklist"] = []any{"*"}
|
||||
|
||||
//
|
||||
// Developer Tools
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
func Parse(policiesJson string) (*types.BrowserPolicyContent, error) {
|
||||
policies := types.BrowserPolicyContent{}
|
||||
|
||||
policiesTmpl := map[string]interface{}{}
|
||||
policiesTmpl := map[string]any{}
|
||||
if err := json.Unmarshal([]byte(policiesJson), &policiesTmpl); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -23,7 +23,7 @@ func Parse(policiesJson string) (*types.BrowserPolicyContent, error) {
|
||||
|
||||
if extensions, ok := policiesTmpl["ExtensionInstallForcelist"]; ok {
|
||||
policies.Extensions = []types.BrowserPolicyExtension{}
|
||||
for _, val := range extensions.([]interface{}) {
|
||||
for _, val := range extensions.([]any) {
|
||||
s := strings.Split(val.(string), ";")
|
||||
url := ""
|
||||
if len(s) > 1 {
|
||||
|
||||
@@ -14,7 +14,7 @@ var policiesJson string
|
||||
|
||||
func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
policiesTmpl := struct {
|
||||
Policies map[string]interface{} `json:"policies"`
|
||||
Policies map[string]any `json:"policies"`
|
||||
}{}
|
||||
if err := json.Unmarshal([]byte(policiesJson), &policiesTmpl); err != nil {
|
||||
return "", err
|
||||
@@ -24,13 +24,13 @@ func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
// Extensions
|
||||
//
|
||||
|
||||
ExtensionSettings := map[string]interface{}{}
|
||||
ExtensionSettings["*"] = map[string]interface{}{
|
||||
ExtensionSettings := map[string]any{}
|
||||
ExtensionSettings["*"] = map[string]any{
|
||||
"installation_mode": "blocked",
|
||||
}
|
||||
|
||||
for _, e := range policies.Extensions {
|
||||
ExtensionSettings[e.ID] = map[string]interface{}{
|
||||
ExtensionSettings[e.ID] = map[string]any{
|
||||
"install_url": e.URL,
|
||||
"installation_mode": "force_installed",
|
||||
}
|
||||
@@ -48,18 +48,18 @@ func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
// Persistent Data
|
||||
//
|
||||
|
||||
Preferences := policiesTmpl.Policies["Preferences"].(map[string]interface{})
|
||||
Preferences := policiesTmpl.Policies["Preferences"].(map[string]any)
|
||||
Preferences["browser.urlbar.suggest.history"] = policies.PersistentData
|
||||
Preferences["places.history.enabled"] = policies.PersistentData
|
||||
policiesTmpl.Policies["Preferences"] = Preferences
|
||||
policiesTmpl.Policies["SanitizeOnShutdown"] = !policies.PersistentData
|
||||
|
||||
if policies.PersistentData {
|
||||
policiesTmpl.Policies["Homepage"] = map[string]interface{}{
|
||||
policiesTmpl.Policies["Homepage"] = map[string]any{
|
||||
"StartPage": "previous-session",
|
||||
}
|
||||
} else {
|
||||
policiesTmpl.Policies["Homepage"] = map[string]interface{}{
|
||||
policiesTmpl.Policies["Homepage"] = map[string]any{
|
||||
"StartPage": "homepage",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ func Parse(policiesJson string) (*types.BrowserPolicyContent, error) {
|
||||
policies := types.BrowserPolicyContent{}
|
||||
|
||||
policiesTmpl := struct {
|
||||
Policies map[string]interface{} `json:"policies"`
|
||||
Policies map[string]any `json:"policies"`
|
||||
}{}
|
||||
if err := json.Unmarshal([]byte(policiesJson), &policiesTmpl); err != nil {
|
||||
return nil, err
|
||||
@@ -30,12 +30,12 @@ func Parse(policiesJson string) (*types.BrowserPolicyContent, error) {
|
||||
|
||||
if extensions, ok := policiesTmpl.Policies["ExtensionSettings"]; ok {
|
||||
policies.Extensions = []types.BrowserPolicyExtension{}
|
||||
for id, val := range extensions.(map[string]interface{}) {
|
||||
for id, val := range extensions.(map[string]any) {
|
||||
if id == "*" {
|
||||
continue
|
||||
}
|
||||
|
||||
data := val.(map[string]interface{})
|
||||
data := val.(map[string]any)
|
||||
url, _ := data["install_url"].(string)
|
||||
|
||||
policies.Extensions = append(
|
||||
|
||||
Reference in New Issue
Block a user