Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/yanue/v2rayu
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Nov 10, 2019
2 parents 50b570d + 342d321 commit 58b94de
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions V2rayU/Scanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,28 @@ class ImportUri {
}

func importSSUri(uri: String) {
if URL(string: uri) == nil && uri.index(of: "#") == nil {
self.error = "invalid ss url"
return
var url = URL(string: uri)
if url == nil {
let aUri = uri.split(separator: "#")
url = URL(string: String(aUri[0]))
if url == nil {
self.error = "invalid ss url"
return
}
// 支持 ss://YWVzLTI1Ni1jZmI6ZjU1LmZ1bi0wNTM1NDAxNkA0NS43OS4xODAuMTExOjExMDc4#翻墙党300.16美国 格式
self.remark = String(aUri[1])
}

// 支持 ss://YWVzLTI1Ni1jZmI6ZjU1LmZ1bi0wNTM1NDAxNkA0NS43OS4xODAuMTExOjExMDc4#翻墙党300.16美国 格式
let aUri = uri.split(separator: "#")

self.uri = uri

let ss = ShadowsockUri()
ss.Init(url: URL(string: String(aUri[0]))!)
ss.Init(url: url!)
if ss.error.count > 0 {
self.error = ss.error
self.isValid = false
return
}
if ss.remark.count == 0 && aUri.count > 1 {
self.remark = String(aUri[1])
} else {
if ss.remark.count > 0 {
self.remark = ss.remark
}

Expand Down

0 comments on commit 58b94de

Please sign in to comment.