allow full config

This commit is contained in:
Hiddify
2024-04-08 09:52:31 +02:00
parent b265886306
commit dd0c3614c9
6 changed files with 27 additions and 15 deletions

View File

@@ -29,9 +29,9 @@ func ParseConfig(path string, debug bool) ([]byte, error) {
if err != nil {
return nil, err
}
return ParseConfigContent(string(content), debug)
return ParseConfigContent(string(content), debug, false)
}
func ParseConfigContent(contentstr string, debug bool) ([]byte, error) {
func ParseConfigContent(contentstr string, debug bool, enableFullConfig bool) ([]byte, error) {
content := []byte(contentstr)
var jsonObj map[string]interface{} = make(map[string]interface{})
@@ -43,7 +43,12 @@ func ParseConfigContent(contentstr string, debug bool) ([]byte, error) {
if tmpJsonObj["outbounds"] == nil {
jsonObj["outbounds"] = []interface{}{jsonObj}
} else {
jsonObj["outbounds"] = tmpJsonObj["outbounds"]
if enableFullConfig {
jsonObj = tmpJsonObj
} else {
jsonObj["outbounds"] = tmpJsonObj["outbounds"]
}
}
} else if jsonArray, ok := tmpJsonResult.([]map[string]interface{}); ok {
jsonObj["outbounds"] = jsonArray