Merge pull request #2660 from yuhan6665/xudp
Use Android ID as XUDP basekey
This commit is contained in:
3 files changed
+8
-2
No files matched your search
@@ -50,7 +50,7 @@ object V2RayServiceManager {
|
|||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
Seq.setContext(value?.get()?.getService()?.applicationContext)
|
Seq.setContext(value?.get()?.getService()?.applicationContext)
|
||||||
Libv2ray.initV2Env(Utils.userAssetPath(value?.get()?.getService()))
|
Libv2ray.initV2Env(Utils.userAssetPath(value?.get()?.getService()), Utils.getDeviceIdForXUDPBaseKey())
|
||||||
}
|
}
|
||||||
var currentConfig: ServerConfig? = null
|
var currentConfig: ServerConfig? = null
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class V2RayTestService : Service() {
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
Seq.setContext(this)
|
Seq.setContext(this)
|
||||||
Libv2ray.initV2Env(Utils.userAssetPath(this))
|
Libv2ray.initV2Env(Utils.userAssetPath(this), Utils.getDeviceIdForXUDPBaseKey())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import android.content.res.Configuration.UI_MODE_NIGHT_NO
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.LocaleList
|
import android.os.LocaleList
|
||||||
|
import android.provider.Settings
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.util.Patterns
|
import android.util.Patterns
|
||||||
import android.webkit.URLUtil
|
import android.webkit.URLUtil
|
||||||
@@ -317,6 +318,11 @@ object Utils {
|
|||||||
return extDir.absolutePath
|
return extDir.absolutePath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getDeviceIdForXUDPBaseKey(): String {
|
||||||
|
val androidId = Settings.Secure.ANDROID_ID.toByteArray(charset("UTF-8"))
|
||||||
|
return Base64.encodeToString(androidId.copyOf(32), Base64.NO_PADDING.or(Base64.URL_SAFE))
|
||||||
|
}
|
||||||
|
|
||||||
fun getUrlContext(url: String, timeout: Int): String {
|
fun getUrlContext(url: String, timeout: Int): String {
|
||||||
var result: String
|
var result: String
|
||||||
var conn: HttpURLConnection? = null
|
var conn: HttpURLConnection? = null
|
||||||
|
|||||||
Reference in new issue
Block a user