Commit 220143ae authored by Max Lv's avatar Max Lv

fix #211

parent 81a19c4a
...@@ -52,17 +52,21 @@ object Parser { ...@@ -52,17 +52,21 @@ object Parser {
if (uri.getScheme == Scheme.SS) { if (uri.getScheme == Scheme.SS) {
val encoded = data.replace(Scheme.SS + "://", "") val encoded = data.replace(Scheme.SS + "://", "")
val content = new String(Base64.decode(encoded, Base64.NO_PADDING), "UTF-8") val content = new String(Base64.decode(encoded, Base64.NO_PADDING), "UTF-8")
val info = content.split('@') val methodIdx = content.indexOf(':')
val encinfo = info(0).split(':') val passwordIdx = content.lastIndexOf('@')
val serverinfo = info(1).split(':') val hostIdx = content.lastIndexOf(':')
val method = content.substring(0, methodIdx)
val password = content.substring(methodIdx + 1, passwordIdx)
val host = content.substring(passwordIdx + 1, hostIdx)
val port = content.substring(hostIdx + 1)
val profile = new Profile val profile = new Profile
profile.name = serverinfo(0) profile.name = host
profile.host = serverinfo(0) profile.host = host
profile.remotePort = serverinfo(1).toInt profile.remotePort = port.toInt
profile.localPort = 1080 profile.localPort = 1080
profile.method = encinfo(0) profile.method = method
profile.password = encinfo(1) profile.password = password
return Some(profile) return Some(profile)
} }
} catch { } catch {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment