1
0
mirror of https://github.com/nitezs/sub2clash.git synced 2024-12-24 13:04:41 -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], "|") { if strings.Contains(serverInfo[1], "|") {
result.Name = strings.SplitN(serverInfo[1], "|", 2)[1] result.Name = strings.SplitN(serverInfo[1], "|", 2)[1]
} else { } else {
result.Name = serverInfo[1] result.Name, err = url.QueryUnescape(serverInfo[1])
if err != nil {
return model.Proxy{}, err
}
} }
} else { } else {
result.Name = serverAndPort[0] result.Name, err = url.QueryUnescape(serverAndPort[0])
if err != nil {
return model.Proxy{}, err
}
} }
return result, nil return result, nil
} }

View File

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