From 70f5c63fe29c7ea48b4ce7bdfa11681b20affee4 Mon Sep 17 00:00:00 2001 From: nite07 Date: Sat, 9 Mar 2024 15:39:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20vmess/vless=20?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=90=8D=E7=A7=B0=E6=9C=AAURL=E8=A7=A3?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parser/vless.go | 10 ++++++++-- parser/vmess.go | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/parser/vless.go b/parser/vless.go index ff54a7a..8e967b6 100644 --- a/parser/vless.go +++ b/parser/vless.go @@ -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 } diff --git a/parser/vmess.go b/parser/vmess.go index b7a1e9b..6250799 100644 --- a/parser/vmess.go +++ b/parser/vmess.go @@ -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,