1
0
mirror of https://github.com/nitezs/sub2clash.git synced 2024-12-23 15:24:42 -05:00

fix: 修复 vmess/vless 节点名称未URL解码的问题

This commit is contained in:
Nite07 2024-03-09 15:39:47 +08:00
parent 679102fa3b
commit 70f5c63fe2
2 changed files with 14 additions and 3 deletions

View File

@ -72,10 +72,16 @@ func ParseVless(proxy string) (model.Proxy, error) {
if strings.Contains(serverInfo[1], "|") {
result.Name = strings.SplitN(serverInfo[1], "|", 2)[1]
} else {
result.Name = serverInfo[1]
result.Name, err = url.QueryUnescape(serverInfo[1])
if err != nil {
return model.Proxy{}, err
}
}
} else {
result.Name = serverAndPort[0]
result.Name, err = url.QueryUnescape(serverAndPort[0])
if err != nil {
return model.Proxy{}, err
}
}
return result, nil
}

View File

@ -3,6 +3,7 @@ package parser
import (
"encoding/json"
"errors"
"net/url"
"strconv"
"strings"
"sub2clash/model"
@ -56,9 +57,13 @@ func ParseVmess(proxy string) (model.Proxy, error) {
if vmess.Net == "ws" && vmess.Host == "" {
vmess.Host = vmess.Add
}
name, err := url.QueryUnescape(vmess.Ps)
if err != nil {
name = vmess.Ps
}
// 返回结果
result := model.Proxy{
Name: vmess.Ps,
Name: name,
Type: "vmess",
Server: vmess.Add,
Port: port,