mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-03 07:01:35 -06:00
33 lines
832 B
Go
33 lines
832 B
Go
package policies
|
|
|
|
import (
|
|
"errors"
|
|
"m1k1o/neko_rooms/internal/policies/chromium"
|
|
"m1k1o/neko_rooms/internal/policies/firefox"
|
|
"m1k1o/neko_rooms/internal/types"
|
|
)
|
|
|
|
func Generate(policies types.BrowserPolicyContent, policyType types.BrowserPolicyType) (string, error) {
|
|
if policyType == types.ChromiumBrowserPolicy {
|
|
return chromium.Generate(policies)
|
|
}
|
|
|
|
if policyType == types.FirefoxBrowserPolicy {
|
|
return firefox.Generate(policies)
|
|
}
|
|
|
|
return "", errors.New("unknown policy type")
|
|
}
|
|
|
|
func Parse(policiesJson string, policyType types.BrowserPolicyType) (*types.BrowserPolicyContent, error) {
|
|
if policyType == types.ChromiumBrowserPolicy {
|
|
return chromium.Parse(policiesJson)
|
|
}
|
|
|
|
if policyType == types.FirefoxBrowserPolicy {
|
|
return firefox.Parse(policiesJson)
|
|
}
|
|
|
|
return nil, errors.New("unknown policy type")
|
|
}
|