This commit is contained in:
Hiddify
2024-06-01 19:09:22 +02:00
parent db0975746e
commit 312ff289e0
2 changed files with 3 additions and 3 deletions

View File

@@ -29,7 +29,7 @@ func ParseConfig(path string, debug bool) ([]byte, error) {
if err != nil {
return nil, err
}
return ParseConfigContent(string(content), debug, DefaultConfigOptions(), false)
return ParseConfigContent(string(content), debug, nil, false)
}
func ParseConfigContent(contentstr string, debug bool, configOpt *ConfigOptions, fullConfig bool) ([]byte, error) {
content := []byte(contentstr)
@@ -43,7 +43,7 @@ func ParseConfigContent(contentstr string, debug bool, configOpt *ConfigOptions,
if tmpJsonObj["outbounds"] == nil {
jsonObj["outbounds"] = []interface{}{jsonObj}
} else {
if configOpt.EnableFullConfig || fullConfig {
if fullConfig || (configOpt != nil && configOpt.EnableFullConfig) {
jsonObj = tmpJsonObj
} else {
jsonObj["outbounds"] = tmpJsonObj["outbounds"]

View File

@@ -174,7 +174,7 @@ func Parse(in *pb.ParseRequest) (*pb.ParseResponse, error) {
}
config, err := config.ParseConfigContent(content, true, config.DefaultConfigOptions(), false)
config, err := config.ParseConfigContent(content, true, nil, false)
if err != nil {
return &pb.ParseResponse{
ResponseCode: pb.ResponseCode_FAILED,