diff --git a/build.gradle b/build.gradle
index 9abb7ce322..9839f640a7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,8 +10,8 @@ buildscript {
compileSdkVersion = 29
buildToolsVersion = '29.0.3'
desugarLibsVersion = '1.0.5'
- versionCode = 422
- versionName = '5.0.6.2R'
+ versionCode = 423
+ versionName = '5.0.6.3R'
resConfigs = ['ar', 'es', 'fa', 'fr', 'ja', 'ko', 'ru', 'tr', 'zh-rCN', 'zh-rTW']
}
diff --git a/core/src/main/java/SpeedUpVPN/VpnEncrypt.kt b/core/src/main/java/SpeedUpVPN/VpnEncrypt.kt
index ae881060d7..be7d570ef2 100644
--- a/core/src/main/java/SpeedUpVPN/VpnEncrypt.kt
+++ b/core/src/main/java/SpeedUpVPN/VpnEncrypt.kt
@@ -3,6 +3,7 @@ package SpeedUpVPN
import android.os.Build
import android.util.Log
import java.io.File
+import java.util.*
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
@@ -10,16 +11,30 @@ import javax.crypto.spec.SecretKeySpec
object VpnEncrypt{
private const val theKey="your aes key"
- const val freesuburl="https://raw.githubusercontent.com/ssrsub/ssr/master/ssrsub"
const val vpnGroupName="SpeedUp.VPN"
const val freesubGroupName="https://git.io/jmsfq"
const val testing="test..."
+ const val HTTP_PROXY_PORT = 58200
@JvmStatic fun aesEncrypt(v:String, secretKey:String=theKey) = AES256.encrypt(v, secretKey)
@JvmStatic fun aesDecrypt(v:String, secretKey:String=theKey) = AES256.decrypt(v, secretKey)
@JvmStatic fun readFileAsTextUsingInputStream(fileName: String) = File(fileName).inputStream().readBytes().toString(Charsets.UTF_8)
- const val HTTP_PROXY_PORT = 58200
-}
+ @JvmStatic fun getUniqueID(): Int {
+ var szDevIDShort = "168169"
+ try {
+ szDevIDShort+=Build.BOARD.length % 10 + Build.BRAND.length % 10 + Build.DEVICE.length % 10 + Build.MANUFACTURER.length % 10 + Build.MODEL.length % 10 + Build.PRODUCT.length % 10
+ } catch (exception: Exception) {}
+ var serial: String? = null
+ try {
+ serial = Build::class.java.getField("SERIAL")[null].toString()
+ // Go ahead and return the serial for api => 9
+ return UUID(szDevIDShort.hashCode() as Long, serial.hashCode() as Long).hashCode()
+ } catch (exception: Exception) { // String needs to be initialized
+ serial = "https://git.io/jww" // some value
+ }
+ return UUID(szDevIDShort.hashCode().toLong(), serial.hashCode().toLong()).hashCode()
+ }
+}
private object AES256{
private fun cipher(opmode:Int, secretKey:String):Cipher{
diff --git a/core/src/main/java/com/github/shadowsocks/Core.kt b/core/src/main/java/com/github/shadowsocks/Core.kt
index 03fc473eeb..11cd602071 100644
--- a/core/src/main/java/com/github/shadowsocks/Core.kt
+++ b/core/src/main/java/com/github/shadowsocks/Core.kt
@@ -19,7 +19,6 @@
*******************************************************************************/
package com.github.shadowsocks
-
import SpeedUpVPN.VpnEncrypt
import android.app.*
import android.app.admin.DevicePolicyManager
@@ -129,7 +128,11 @@ object Core {
fun importFreeSubs(): Boolean {
try {
GlobalScope.launch {
- SSRSubManager.createBuiltinSub(VpnEncrypt.freesuburl)
+ var freesuburl = app.resources.getStringArray(R.array.freesuburl)
+ for (i in freesuburl.indices) {
+ var freeSub=SSRSubManager.createBuiltinSub(freesuburl[i])
+ if (freeSub != null) break
+ }
}
} catch (e: Exception) {
e.printStackTrace()
diff --git a/core/src/main/java/com/github/shadowsocks/database/ProfileManager.kt b/core/src/main/java/com/github/shadowsocks/database/ProfileManager.kt
index 50f94e163b..901b5020a7 100644
--- a/core/src/main/java/com/github/shadowsocks/database/ProfileManager.kt
+++ b/core/src/main/java/com/github/shadowsocks/database/ProfileManager.kt
@@ -144,7 +144,7 @@ object ProfileManager {
* Note: It's caller's responsibility to update DirectBoot profile if necessary.
*/
@Throws(SQLException::class)
- fun updateProfile(profile: Profile) = check(PrivateDatabase.profileDao.update(profile) == 1)
+ fun updateProfile(profile: Profile) = try {check(PrivateDatabase.profileDao.update(profile) == 1)}catch (t:Throwable){printLog(t)}
@Throws(IOException::class)
fun getProfile(id: Long): Profile? = try {
@@ -165,10 +165,10 @@ object ProfileManager {
check(PrivateDatabase.profileDao.delete(id) == 1)
listener?.onRemove(id)
if (id in Core.activeProfileIds && DataStore.directBootAware) DirectBoot.clean()
- } catch (e: Exception) {
- Log.e("speedup.vpn","",e)
}
-
+ catch (e:Exception){
+ Log.e("delProfile",e.toString())
+ }
}
@Throws(SQLException::class)
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 3eafb96ef2..c33991175d 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -220,5 +220,8 @@
- https://your_builtinSubUrls.com/path/sub.txt
+
+ - https://your_freeSubUrls.com/path/sub.txt
+
https://raw.githubusercontent.com/bannedbook/SpeedUp.VPN/master/update.json
diff --git a/gitupdate.bat b/gitupdate.bat
index ea52b18421..667a7287d5 100644
--- a/gitupdate.bat
+++ b/gitupdate.bat
@@ -3,6 +3,6 @@ git pull origin master
git add -A
git commit -m "update"
git push origin master
-git tag -a v5.0.6.2 -m "release v5.0.6.2"
+git tag -a v5.0.6.3 -m "release v5.0.6.3"
git push origin --tags
pause
\ No newline at end of file
diff --git a/mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt b/mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
index 6473dc513b..494ac10253 100644
--- a/mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
+++ b/mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
@@ -706,9 +706,9 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
Core.stopService()
var isProxyStarted=false
for (k in 0 until profilesAdapter.profiles.size) {
- if(testInvalidOnly && profilesAdapter.profiles[k].elapsed>0)continue
- Log.e("real_ping_all",k.toString())
try {
+ if(testInvalidOnly && profilesAdapter.profiles[k].elapsed>0)continue
+ Log.e("real_ping_all",k.toString())
profilesAdapter.profiles[k].elapsed=-2
val old = DataStore.profileId
Core.switchProfile(profilesAdapter.profiles[k].id)
@@ -728,7 +728,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
while (tcping("127.0.0.1", DataStore.portProxy) < 0 || tcping("127.0.0.1", VpnEncrypt.HTTP_PROXY_PORT) < 0) {
Log.e("starting", "$k try $ttt ...")
if (ttt == 5) {
- activity.runOnUiThread() {Core.alertMessage(activity.getString(R.string.toast_test_interrupted,profilesAdapter.profiles[k].name),activity)}
+ activity?.runOnUiThread() {Core.alertMessage(activity.getString(R.string.toast_test_interrupted,profilesAdapter.profiles[k].name),activity)}
Log.e("realTestProfiles","Server: "+profilesAdapter.profiles[k].name+" or the one before it caused the test to be interrupted.")
Core.stopService()
return@launch