Skip to content

Commit e54cf43

Browse files
author
esdeathlove
committed
fix qrcode
1 parent e6db81e commit e54cf43

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/main/scala/com/github/shadowsocks/database/Profile.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ class Profile {
118118

119119
override def toString = "ssr://" + Base64.encodeToString("%s:%d:%s:%s:%s:%s/?obfsparam=%s&protoparam=%s&remarks=%s".formatLocal(Locale.ENGLISH,
120120
host, remotePort, protocol, method, obfs, Base64.encodeToString("%s".formatLocal(Locale.ENGLISH,
121-
password).getBytes, Base64.URL_SAFE | Base64.NO_WRAP), Base64.encodeToString("%s".formatLocal(Locale.ENGLISH,
122-
obfs_param).getBytes, Base64.URL_SAFE | Base64.NO_WRAP), Base64.encodeToString("%s".formatLocal(Locale.ENGLISH,
123-
protocol_param).getBytes, Base64.URL_SAFE | Base64.NO_WRAP), Base64.encodeToString("%s".formatLocal(Locale.ENGLISH,
124-
name).getBytes, Base64.URL_SAFE | Base64.NO_WRAP)).getBytes, Base64.URL_SAFE | Base64.NO_WRAP)
121+
password).getBytes, Base64.NO_PADDING | Base64.URL_SAFE | Base64.NO_WRAP), Base64.encodeToString("%s".formatLocal(Locale.ENGLISH,
122+
obfs_param).getBytes, Base64.NO_PADDING | Base64.URL_SAFE | Base64.NO_WRAP), Base64.encodeToString("%s".formatLocal(Locale.ENGLISH,
123+
protocol_param).getBytes, Base64.NO_PADDING | Base64.URL_SAFE | Base64.NO_WRAP), Base64.encodeToString("%s".formatLocal(Locale.ENGLISH,
124+
name).getBytes, Base64.NO_PADDING | Base64.URL_SAFE | Base64.NO_WRAP)).getBytes, Base64.NO_PADDING | Base64.URL_SAFE | Base64.NO_WRAP)
125125

126126
def isMethodUnsafe = "table".equalsIgnoreCase(method) || "rc4".equalsIgnoreCase(method)
127127
}

src/main/scala/com/github/shadowsocks/utils/Parser.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ object Parser {
7676
}).filter(_ != null)
7777

7878
def findAll_ssr(data: CharSequence) = pattern_ssr.findAllMatchIn(if (data == null) "" else data).map(m => try{
79-
val uri = new String(Base64.decode(m.group(1).replaceAll("=", ""), Base64.NO_PADDING | Base64.URL_SAFE), "UTF-8")
79+
val uri = new String(Base64.decode(m.group(1).replaceAll("=", ""), Base64.URL_SAFE), "UTF-8")
8080
decodedPattern_ssr.findFirstMatchIn(uri) match {
8181
case Some(ss) =>
8282
val profile = new Profile
@@ -85,23 +85,23 @@ object Parser {
8585
profile.protocol = ss.group(4).toLowerCase
8686
profile.method = ss.group(5).toLowerCase
8787
profile.obfs = ss.group(6).toLowerCase
88-
profile.password = new String(Base64.decode(ss.group(7).replaceAll("=", ""), Base64.NO_PADDING | Base64.URL_SAFE), "UTF-8")
88+
profile.password = new String(Base64.decode(ss.group(7).replaceAll("=", ""), Base64.URL_SAFE), "UTF-8")
8989

9090
decodedPattern_ssr_obfsparam.findFirstMatchIn(uri) match {
9191
case Some(param) =>
92-
profile.obfs_param = new String(Base64.decode(param.group(1).replaceAll("=", ""), Base64.NO_PADDING | Base64.URL_SAFE), "UTF-8")
92+
profile.obfs_param = new String(Base64.decode(param.group(1).replaceAll("=", ""), Base64.URL_SAFE), "UTF-8")
9393
case _ => null
9494
}
9595

9696
decodedPattern_ssr_protocolparam.findFirstMatchIn(uri) match {
9797
case Some(param) =>
98-
profile.protocol_param = new String(Base64.decode(param.group(1).replaceAll("=", ""), Base64.NO_PADDING | Base64.URL_SAFE), "UTF-8")
98+
profile.protocol_param = new String(Base64.decode(param.group(1).replaceAll("=", ""), Base64.URL_SAFE), "UTF-8")
9999
case _ => null
100100
}
101101

102102
decodedPattern_ssr_remarks.findFirstMatchIn(uri) match {
103103
case Some(param) =>
104-
profile.name = new String(Base64.decode(param.group(1).replaceAll("=", ""), Base64.NO_PADDING | Base64.URL_SAFE), "UTF-8")
104+
profile.name = new String(Base64.decode(param.group(1).replaceAll("=", ""), Base64.URL_SAFE), "UTF-8")
105105
case _ => profile.name = ss.group(2).toLowerCase
106106
}
107107

0 commit comments

Comments
 (0)