1
0
mirror of https://github.com/nitezs/sub2clash.git synced 2024-12-23 14:34:41 -05:00
This commit is contained in:
Nite07 2024-08-04 12:59:55 +08:00
parent 7158ad467a
commit dedbf2bc03
3 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ data
.env .env
.vscode/settings.json .vscode/settings.json
test test
*test.go

View File

@ -179,6 +179,10 @@ async function parseInputURL() {
let hash = url.pathname.substring(url.pathname.lastIndexOf("/s/") + 3); let hash = url.pathname.substring(url.pathname.lastIndexOf("/s/") + 3);
let q = new URLSearchParams(); let q = new URLSearchParams();
let password = url.searchParams.get("password"); let password = url.searchParams.get("password");
if (password === null) {
alert("仅可解析加密短链");
return;
}
q.append("hash", hash); q.append("hash", hash);
q.append("password", password); q.append("password", password);
try { try {

View File

@ -72,6 +72,14 @@ func ParseHysteria2(proxy string) (model.Proxy, error) {
enableTLS := pinSHA256 != "" enableTLS := pinSHA256 != ""
insecureBool := insecure == "1" insecureBool := insecure == "1"
if remarks == "" {
remarksIndex := strings.LastIndex(proxy, "#")
if remarksIndex != -1 {
remarks = proxy[remarksIndex:]
remarks, _ = url.QueryUnescape(remarks)
}
}
result := model.Proxy{ result := model.Proxy{
Type: "hysteria2", Type: "hysteria2",
Name: remarks, Name: remarks,