diff --git a/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt b/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt index 6132aeb..253025e 100644 --- a/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt +++ b/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt @@ -45,6 +45,7 @@ import com.cncat.vpn.service.ClashManager import com.cncat.vpn.service.remote.IClashManager import com.cncat.vpn.service.remote.wrap import com.github.gzuliyujiang.oaid.DeviceID +import com.github.gzuliyujiang.oaid.DeviceIdentifier import com.github.gzuliyujiang.oaid.IGetter import com.google.gson.JsonObject import com.orhanobut.logger.Logger @@ -495,6 +496,32 @@ class SplashActivity : BaseActivity() { @Synchronized fun doRegisterByEncryption() { + var userAgent= System.getProperty("http.agent") + Log.i("SplashRegister","userAgent::"+userAgent) + if (userAgent != null) { + if(userAgent.isEmpty()||userAgent.length<5){ + val webView = WebView(this@SplashActivity) + userAgent = webView.settings.userAgentString + } + }else{ + val webView = WebView(this@SplashActivity) + userAgent = webView.settings.userAgentString + } + + var oaId=OAID + Log.i("SplashRegister","OAID::"+OAID+"oaId.isEmpty()::"+oaId.isEmpty()+"userAgent::"+userAgent) + val equipmentModel = Utils.getEquipmentModel() + Log.i("equipmentModel","equipmentModel::"+equipmentModel) + if(oaId.isEmpty()){ + if (DeviceID.supportedOAID(MainApplication.getApp())) { + //同步获取oaid + val aOaId= DeviceIdentifier.getOAID(MainApplication.getApp()) + oaId=aOaId + OAID=aOaId + Log.i("doRegisterByEncryption","aOaId::"+aOaId+"oaId::"+oaId+"OAID::"+OAID) + } + + } var req_json = JsonObject() req_json.addProperty("password", BZYConstants.defaultPassword) req_json.addProperty("checkPassword", BZYConstants.defaultPassword) @@ -502,6 +529,9 @@ class SplashActivity : BaseActivity() { req_json.addProperty("clientIp", "127.0.0.1") req_json.addProperty("from", "5") req_json.addProperty("androidDevice", username) + req_json.addProperty("userAgent", userAgent) + req_json.addProperty("oaid", oaId) + req_json.addProperty("equipmentModel",equipmentModel) if (captchaInfo.isNotEmpty()) { req_json.addProperty("captchaVerifyParam", captchaInfo) }