fix 图形认证码,云梯产品

This commit is contained in:
cyh 2025-05-20 16:32:01 +08:00
parent 0b6a9433c7
commit 7e386d02a6
21 changed files with 643 additions and 215 deletions

View File

@ -161,7 +161,7 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
)
}
}
}else if(httpStatus.reqType == HttpReqType.GETAPPVERION){
} else if (httpStatus.reqType == HttpReqType.GETAPPVERION) {
(httpStatus.rsp as AppVersionCheckRsp).let { avcr ->
com.cncat.vpn.common.log.Log.i("App_VERION_CHECK ==>$avcr")
if (avcr.code == 200) {
@ -198,7 +198,11 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
var currentHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_CURRENT_HOST, "")
// com.cncat.vpn.common.log.Log.d("tryButton CHECK_LOGIN currentHost==>${currentHost}")
loginViewMode.login(username_encrypt, password_encrypt,user_oaid)
loginViewMode.login(
username_encrypt,
password_encrypt,
user_oaid
)
}
override fun cancel() {
@ -209,7 +213,11 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
dialogDoMainChoose?.setOnListItemListener(object :
DialogDoMainChoose.OnListItemListener {
override fun listItemClick() {
loginViewMode.login(username_encrypt, password_encrypt,user_oaid)
loginViewMode.login(
username_encrypt,
password_encrypt,
user_oaid
)
}
@ -481,8 +489,8 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
password_encrypt = AESUtil.byteArrayToHexStr(
AESUtil.encrypt(password)
)
Log.d("OALD","OAID.....::"+MainApplication.OAID)
user_oaid=AESUtil.byteArrayToHexStr(
Log.d("OALD", "OAID.....::" + MainApplication.OAID)
user_oaid = AESUtil.byteArrayToHexStr(
AESUtil.encrypt(MainApplication.OAID)
)
loginUserName = username
@ -490,37 +498,53 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
RxToast.warning(resources.getString(R.string.ReadAgreement))
return
}
loginViewMode.login(username_encrypt, password_encrypt,user_oaid)
loginViewMode.login(username_encrypt, password_encrypt, user_oaid)
}
R.id.tv_register -> {
// val intent = Intent(applicationContext, RegisterActivity::class.java)
// startActivityForResult(intent, LOGIN_TO_REGISTER_REQUEST_CODE)
if (TextUtils.isEmpty(registerHost)) {
if (BuildConfig.is_tz) {
getTzRegister()
} else {
if (BuildConfig.is_ym) {
getYmRegister()
} else {
getBzyRegister()
}
}
} else {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(registerHost)))
}
val intent = Intent(applicationContext, SplashActivity::class.java)
startActivity(intent)
// if (TextUtils.isEmpty(registerHost)) {
// when {
// BuildConfig.is_ym -> {
// getYmRegister()
// }
//
// BuildConfig.is_tz -> {
// getTzRegister()
// }
//
// BuildConfig.is_yunti -> {
// getYunTiRegister()
// }
//
// else -> {
// getBzyRegister()
// }
// }
// } else {
// startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(registerHost)))
// }
}
R.id.tv_kefu -> {
var mmkvHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_KEFU_HOST, "")
if (TextUtils.isEmpty(kefuHost)) {
if (BuildConfig.is_tz) {
getTzKefu(mmkvHost)
} else {
if (BuildConfig.is_ym) {
when {
BuildConfig.is_ym -> {
getYmKefu(mmkvHost)
} else {
}
BuildConfig.is_tz -> {
getTzKefu(mmkvHost)
}
BuildConfig.is_yunti -> {
getYunTiKefu(mmkvHost)
}
else -> {
getBzyKefu(mmkvHost)
}
}
@ -631,6 +655,37 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
})
}
private fun getYunTiRegister() {
var mmkvHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_REGISTER_HOST, "")
// com.cncat.vpn.common.log.Log.d("mmkvHost==>${mmkvHost}")
loginViewMode.getYunTiRegisterHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
// com.cncat.vpn.common.log.Log.d("str==>${str}")
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_REGISTER_HOST, str)
}
// mmkvHost = str
registerHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
private fun getYmKefu(mmkvHost: String?) {
loginViewMode.getYmKefuHost(object : AsyncBodyCallback {
@ -656,6 +711,30 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
})
}
private fun getYunTiKefu(mmkvHost: String?) {
loginViewMode.getYunTiKefuHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_KEFU_HOST, str)
}
kefuHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
private fun getBzyKefu(mmkvHost: String?) {
loginViewMode.getBzyKefuHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
@ -729,6 +808,7 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
passwordEt.transformationMethod = PasswordTransformationMethodBigDot()
}
}
private fun showUpdateDialog(url: String, illustrate: String, isForce: Boolean) {
if (TextUtils.isEmpty(url)) {
RxToast.error(resources.getString(R.string.downloadEmpty))
@ -785,6 +865,7 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
})
dialog.show()
}
fun installApk(filePath: String) {
val file = File(filePath)
val uri: Uri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {

View File

@ -51,7 +51,7 @@ public abstract class MyClickableSpan extends ClickableSpan {
*/
@Override
public void updateDrawState(@NonNull TextPaint ds) {
ds.setColor(Color.parseColor("#B0BFFA"));
ds.setColor(Color.parseColor("#f11f04"));
ds.setUnderlineText(false);
}

View File

@ -526,13 +526,13 @@ class NewMainActivity : BaseActivity() {
//todo 判断订阅地址是否修改过,未修改就用接口返回的地址反之使用本地修改的地址
var pro_sub_url =
MMKV.defaultMMKV().decodeString(BZYConstants.PROFILE_SUB_URL, "")
if (!TextUtils.isEmpty(pro_sub_url)){
if (!TextUtils.isEmpty(pro_sub_url)) {
if (pro_sub_url == url) {
subUrl = url
} else {
subUrl = pro_sub_url
}
}else{
} else {
subUrl = url
}
@ -786,26 +786,39 @@ class NewMainActivity : BaseActivity() {
drawer.close()
}
val telegramBtn = findViewById<TextView>(R.id.tv_dianbao)
telegramBtn.setOnClickListener {//电报
var uri = Uri.parse(BZYConstants.DefTGUrl)
val intent = Intent(Intent.ACTION_VIEW)
if (BuildConfig.is_tz) {
uri = Uri.parse(BZYConstants.TZTGUrl)
} else {
if (BuildConfig.is_ym) {
when {
BuildConfig.is_ym -> {
uri = Uri.parse(BZYConstants.YMTGUrl)
}
BuildConfig.is_tz -> {
uri = Uri.parse(BZYConstants.TZTGUrl)
}
BuildConfig.is_yunti -> {
uri = Uri.parse(BZYConstants.YunTiTGUrl)
}
else -> {
uri = Uri.parse(BZYConstants.DefTGUrl)
}
}
intent.setData(uri)
startActivity(intent)
drawer.close()
}
findViewById<TextView>(R.id.tv_kefu).setOnClickListener {//客服
startActivity(Intent(this, BZYWebViewKeFu::class.java))
drawer.close()
}
findViewById<TextView>(R.id.tv_fds).setOnClickListener {//防丢失
var fds_view = findViewById<TextView>(R.id.tv_fds);
fds_view.setOnClickListener {//防丢失
startActivity(Intent(this, LossPreventionActivity::class.java))
drawer.close()
@ -819,6 +832,10 @@ class NewMainActivity : BaseActivity() {
drawer.openDrawer(GravityCompat.START)
}
}
if (BuildConfig.is_tz && BuildConfig.productId == "182268") {
telegramBtn.visibility = View.INVISIBLE
fds_view.visibility = View.INVISIBLE
}
}
var checkPayResultDia: MaterialDialog? = null

View File

@ -22,6 +22,7 @@ import android.webkit.JavascriptInterface
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.Button
import android.widget.ProgressBar
import android.widget.RelativeLayout
import android.widget.TextView
@ -54,6 +55,7 @@ import com.yingmao.clash.conf.BZYConstants.Companion.MMKV_KEY_NOTE_DEFAULT_PSW
import com.yingmao.clash.conf.BZYConstants.Companion.MMKV_KEY_REMEMBER_PASSWORD
import com.yingmao.clash.conf.BZYConstants.Companion.MMKV_KEY_REMEMBER_USERNAME
import com.yingmao.clash.entity.CheckLoginRsp
import com.yingmao.clash.listener.AsyncBodyCallback
import com.yingmao.clash.listener.DownLoadListener
import com.yingmao.clash.net.http.HttpReqType
import com.yingmao.clash.net.http.HttpStatus
@ -85,11 +87,13 @@ class SplashActivity : BaseActivity() {
private val Captcha_REQUEST_CODE = 3333
private lateinit var rlPb: View
private lateinit var ll_action: View
private lateinit var but_skip: Button
private lateinit var but_register: Button
private lateinit var rlMain: RelativeLayout
private lateinit var splashAtyVM: SplashAtyVM
private var registerHost = ""
companion object {
public var registerKey = ""
public var registerIV2 = ""
@ -102,10 +106,7 @@ class SplashActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
super.onCreate(savedInstanceState)
setLocalLanguage()
initErrMsg = resources.getString(R.string.splashErrorTips)
// var username2 = Utils.getUniqueID2(this);
// com.cncat.vpn.common.log.Log.d("username==>" + username + ", username2==>" + username2)
splashAtyVM = ViewModelProvider(this).get(SplashAtyVM::class.java)
@ -123,14 +124,16 @@ class SplashActivity : BaseActivity() {
serStore.isBZY = true
}
}
if (BuildConfig.productId=="182268"){
}else{
//隐私政策先授权后获取
username = Utils.getUniqueID(this)
MainApplication.initUtil()
}
initWebView()
if (BuildConfig.productId == "182268") {
initAgreementPrivacy()
} else {
//隐私政策先授权后获取权限
initApplication(false)
}
// mPermissions.add(Manifest.permission.READ_PHONE_STATE)
// mPermissions.add(Manifest.permission.INTERNET)
// mPermissions.add(Manifest.permission.ACCESS_NETWORK_STATE)
@ -175,6 +178,40 @@ class SplashActivity : BaseActivity() {
// com.cncat.vpn.common.log.Log.d("onOAIDGetComplete result==>${ DeviceIdentifier.getOAID(this)}")
//获取配置背景
// val Sgtr= AESUtil.decrypt("6A9E6037E4E31FDFE8E09A79FAD64B5CE7AA2D6C0DF34000998651C877C8005AD68274B63FCB1FC35DAFAD278B3EF19B79E83738A3AD5DB70D9601E43050BE0E")
// println("Sgtr==>$Sgtr")
// OpenInstall.getWakeUp(intent, wakeUpAdapter)
// OpenInstall.getInstall { appData, error ->
// var appData = appData
// if (error != null && error.shouldRetry()) {
// // 获取数据异常,可以尝试重新获取
// } else {
// if (appData == null) appData = AppData()
// val channelCode = appData.getChannel() // 获取渠道编号参数
// val bindData = appData.getData() // 获取自定义参数
// Log.d("OpenInstall", "getInstall : channelCode = $channelCode"+"bindData::"+bindData)
// }
// }
}
// private var wakeUpAdapter: AppWakeUpAdapter = object : AppWakeUpAdapter() {
// override fun onWakeUp(appData: AppData) {
// // 打印数据便于调试
// Log.d("OpenInstall", "getWakeUp : wakeupData = $appData")
// // 获取渠道编号参数
// val channelCode = appData.getChannel()
// // 获取自定义参数
// val bindData = appData.getData()
// Log.d("OpenInstall", "channelCode : bindData = $channelCode"+"bindData::"+bindData)
// }
// }
private fun initApplication(isNeedRegister: Boolean) {
username = Utils.getUniqueID(this)
MainApplication.initUtil()
setLocalLanguage()
splashAtyVM.getSplashBg()
var clashBinder = MainApplication.getApp()?.let {
ClashManager(it).wrap() as IClashManager
@ -208,18 +245,17 @@ class SplashActivity : BaseActivity() {
val routerSet =
MMKV.defaultMMKV().decodeStringSet(BZYConstants.MMKV_KEY_ROUTER_HOST)
if (routerSet != null && routerSet.size > 0) {
isNeedRegister()
isNeedRegister(isNeedRegister)
} else {
rlPb.visibility = View.VISIBLE
if (BuildConfig.is_back_cn == true) { //没有备用域名所以无需调用getHost
isNeedRegister()
isNeedRegister(isNeedRegister)
} else {
SplashHelper(splashAtyVM).getHostWithFallback { success ->
MainScope().launch {
if (success) {
isNeedRegister()
isNeedRegister(isNeedRegister)
} else {
isNeedRegister()
isNeedRegister(isNeedRegister)
}
}
}
@ -228,33 +264,7 @@ class SplashActivity : BaseActivity() {
}
}
}
// val Sgtr= AESUtil.decrypt("73CC9D719D4B46616F7FB72DBFABFA88B716D1AF0F8B8A42929F9EE5D198EB059A7934DD0074D1810CD56B5312FD5FDACC25EED6C6B2351DB11A3BF78E3010A417CDE40EEFF768849AEF25773AF541C01464DB7C9B0B7C30D36EEA414EA86F9923AAF325C15BB75170C148C4F257AA2D6A32BFB582D498B13B38E49BB8DF1663")
// println("Sgtr==>$Sgtr")
// OpenInstall.getWakeUp(intent, wakeUpAdapter)
// OpenInstall.getInstall { appData, error ->
// var appData = appData
// if (error != null && error.shouldRetry()) {
// // 获取数据异常,可以尝试重新获取
// } else {
// if (appData == null) appData = AppData()
// val channelCode = appData.getChannel() // 获取渠道编号参数
// val bindData = appData.getData() // 获取自定义参数
// Log.d("OpenInstall", "getInstall : channelCode = $channelCode"+"bindData::"+bindData)
// }
// }
}
// private var wakeUpAdapter: AppWakeUpAdapter = object : AppWakeUpAdapter() {
// override fun onWakeUp(appData: AppData) {
// // 打印数据便于调试
// Log.d("OpenInstall", "getWakeUp : wakeupData = $appData")
// // 获取渠道编号参数
// val channelCode = appData.getChannel()
// // 获取自定义参数
// val bindData = appData.getData()
// Log.d("OpenInstall", "channelCode : bindData = $channelCode"+"bindData::"+bindData)
// }
// }
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
@ -265,45 +275,78 @@ class SplashActivity : BaseActivity() {
private lateinit var webView: WebView
private lateinit var pb_web: ProgressBar
var dialogAgreementPrivacyChoose: DialogAgreementPrivacyChoose? = null
private fun initAgreementPrivacy(){
private fun initAgreementPrivacy() {
if (BuildConfig.is_tz && BuildConfig.productId == "182268") {
if (dialogAgreementPrivacyChoose == null) {
dialogAgreementPrivacyChoose = DialogAgreementPrivacyChoose(this@SplashActivity)
}
if (dialogAgreementPrivacyChoose?.isShowing == false) {
dialogAgreementPrivacyChoose?.setOnTryButtonListener(object :
DialogAgreementPrivacyChoose.OnTryButtonListener {
override fun agree() {
username = Utils.getUniqueID(this@SplashActivity)
MainApplication.initUtil()
dialogAgreementPrivacyChoose?.dismiss()
}
if (MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_IS_REGISTER, false)) {
rlPb.visibility = View.VISIBLE
webView.visibility = View.GONE
initApplication(false)
} else {
setWebView()
if (dialogAgreementPrivacyChoose == null) {
dialogAgreementPrivacyChoose = DialogAgreementPrivacyChoose(this@SplashActivity)
}
if (dialogAgreementPrivacyChoose?.isShowing == false) {
dialogAgreementPrivacyChoose?.setOnTryButtonListener(object :
DialogAgreementPrivacyChoose.OnTryButtonListener {
override fun agree() {
initApplication(false)
dialogAgreementPrivacyChoose?.dismiss()
}
override fun cancel() {
dialogAgreementPrivacyChoose?.dismiss()
finish()
}
})
dialogAgreementPrivacyChoose?.show()
}
override fun cancel() {
dialogAgreementPrivacyChoose?.dismiss()
finish()
}
})
dialogAgreementPrivacyChoose?.show()
}
}
}
private fun initWebView() {
private fun initWebView() {
webView = findViewById(R.id.webView)
pb_web = findViewById(R.id.pb_web)
but_skip = findViewById(R.id.but_skip)
but_register = findViewById(R.id.but_register)
but_skip.setOnClickListener {
val intent = Intent(this@SplashActivity, LoginActivity::class.java)
startActivity(intent)
finish()
}
but_register.setOnClickListener {
if (TextUtils.isEmpty(registerHost)) {
when {
BuildConfig.is_ym -> {
getYmRegister()
}
if (!BuildConfig.is_ym) {
BuildConfig.is_tz -> {
getTzRegister()
}
rlPb.visibility = View.INVISIBLE
} else {
webView.visibility = View.GONE
BuildConfig.is_yunti -> {
getYunTiRegister()
}
else -> {
getBzyRegister()
}
}
} else {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(registerHost)))
}
}
}
@SuppressLint("JavascriptInterface")
private fun setWebView() {
initAgreementPrivacy()
rlPb.visibility = View.INVISIBLE
webView.visibility = View.VISIBLE
but_skip.visibility = View.VISIBLE
// WebView设置
val webSettings = webView.settings
// 可选设置开启Chrome调试
@ -336,16 +379,13 @@ class SplashActivity : BaseActivity() {
@JavascriptInterface
public fun getVerifyResult(verifyResult: String): Boolean {
com.cncat.vpn.common.log.Log.d("verifyResult==>${verifyResult}")
// com.cncat.vpn.common.log.Log.d("verifyResult==>${verifyResult}")
captchaInfo = verifyResult
launch {
webView.setOnTouchListener { _, _ -> true }
pb_web.visibility = View.VISIBLE
}
doRegisterByEncryption()
return true
}
@ -361,7 +401,7 @@ class SplashActivity : BaseActivity() {
private fun setLocalLanguage() {
var defLan = ""
if (BuildConfig.is_tz) {
if (BuildConfig.is_tz && BuildConfig.productId != "182268") {
defLan = "Chinese-HK"
}
val decodeString = MMKV.defaultMMKV().decodeString(BZYConstants.languageInfo, defLan)
@ -457,27 +497,30 @@ class SplashActivity : BaseActivity() {
}
}
private fun isNeedRegister() {
private fun isNeedRegister(isNeedRegister: Boolean) {
if (!BuildConfig.is_free && BuildConfig.productId.isNotEmpty()) { //渠道包都自动注册登录广州22222也是非自动注册
rlPb.visibility = View.VISIBLE
if (MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_IS_REGISTER, false)) {
rlPb.visibility = View.VISIBLE
but_skip.visibility = View.INVISIBLE
splashAtyVM.checkLogin()
} else {
// doRegister()
if (!BuildConfig.is_ym) {
rlPb.visibility = View.INVISIBLE
webView.visibility = View.VISIBLE
setWebView()
} else {
webView.visibility = View.GONE
if (isNeedRegister) {
doRegisterByEncryption()
} else {
setWebView()
}
}
} else {//非渠道自由包
val token = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_TOKEN)
ll_action.visibility = View.VISIBLE
rlPb.visibility = View.INVISIBLE
but_skip.visibility = View.INVISIBLE
if (MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_IS_REGISTER, false)) {
if (token != null && token.isNotEmpty()) {
ll_action.visibility = View.GONE
rlPb.visibility = View.VISIBLE
@ -1016,7 +1059,7 @@ class SplashActivity : BaseActivity() {
}
if (deniedAndNoLongerPromptPermissions.isNotEmpty()) {
if (checkPermissions(mPermissions)) {
isNeedRegister() //TODO
isNeedRegister(true) //TODO
return
}
val deniedAndNoLongerPromptPermissionsName = StringBuilder()
@ -1066,7 +1109,7 @@ class SplashActivity : BaseActivity() {
Logger.i("${deniedAndNoLongerPromptPermissions.size}需要${deniedAndNoLongerPromptPermissionsName.toString()}权限,由于您设置了不再提示,需要手动开启权限!")
} else {
if (checkPermissions(mPermissions)) {
isNeedRegister() //TODO
isNeedRegister(true) //TODO
} else {
finish()
}
@ -1079,7 +1122,7 @@ class SplashActivity : BaseActivity() {
com.cncat.vpn.common.log.Log.d("onActivityResult requestCode==>${requestCode}")
if (requestCode == PERMISSION_SETTING_REQUEST_CODE) {
if (checkPermissions(mPermissions)) {
isNeedRegister() //TODO
isNeedRegister(true) //TODO
} else {
requestPermissions(deniedPermissions.toTypedArray(), PERMISSION_REQUEST_CODE)
}
@ -1193,4 +1236,126 @@ class SplashActivity : BaseActivity() {
}
startActivity(intent)
}
private fun getYmRegister() {
var mmkvHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_REGISTER_HOST, "")
// com.cncat.vpn.common.log.Log.d("mmkvHost==>${mmkvHost}")
splashAtyVM.getRegisterHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
// com.cncat.vpn.common.log.Log.d("str==>${str}")
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_REGISTER_HOST, str)
}
// mmkvHost = str
registerHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
private fun getTzRegister() {
var mmkvHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_REGISTER_HOST, "")
// com.cncat.vpn.common.log.Log.d("mmkvHost==>${mmkvHost}")
splashAtyVM.getTzRegisterHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
// com.cncat.vpn.common.log.Log.d("str==>${str}")
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_REGISTER_HOST, str)
}
// mmkvHost = str
registerHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
private fun getBzyRegister() {
var mmkvHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_REGISTER_HOST, "")
// com.cncat.vpn.common.log.Log.d("mmkvHost==>${mmkvHost}")
splashAtyVM.getBzyRegisterHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
// com.cncat.vpn.common.log.Log.d("str==>${str}")
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_REGISTER_HOST, str)
}
// mmkvHost = str
registerHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
private fun getYunTiRegister() {
var mmkvHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_REGISTER_HOST, "")
// com.cncat.vpn.common.log.Log.d("mmkvHost==>${mmkvHost}")
splashAtyVM.getYunTiRegisterHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
// com.cncat.vpn.common.log.Log.d("str==>${str}")
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_REGISTER_HOST, str)
}
registerHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
}

View File

@ -15,10 +15,10 @@ import androidx.core.content.getSystemService
import com.cncat.vpn.common.Global
import com.cncat.vpn.common.compat.currentProcessName
import com.cncat.vpn.common.log.Log
import com.fm.openinstall.OpenInstall
import com.github.gzuliyujiang.oaid.DeviceID
import com.github.gzuliyujiang.oaid.DeviceIdentifier
import com.github.gzuliyujiang.oaid.IGetter
import com.jakewharton.processphoenix.ProcessPhoenix
import com.orhanobut.logger.Logger
import com.stripe.android.PaymentConfiguration
@ -93,8 +93,13 @@ class MainApplication : Application() {
fun initUtil() {
getApp()?.let { mainApplication ->
DeviceIdentifier.register(mApp);
val processName = mainApplication.currentProcessName
mainApplication.extractGeoFiles()
Log.d("Process $processName started")
mainApplication.updateNotificationChannels()
/*
* 错误日志上传捕获
* */
@ -142,23 +147,13 @@ class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
mApp = this
// if (privacyPolicyAgreed) {
DeviceIdentifier.register(mApp);
// }
Global.init(this)
val processName = currentProcessName
extractGeoFiles()
Log.d("Process $processName started")
// if (processName == packageName) {
// Log.d("Remote.launch()")
// Remote.launch()
// } else {
// Log.d("sendServiceRecreated")
// sendServiceRecreated()
// }
val MMKVRootDir = MMKV.initialize(applicationContext)
Global.init(mApp)
val MMKVRootDir = MMKV.initialize(mApp)
Logger.i("MMKV_ROOT_DIR:$MMKVRootDir")
updateNotificationChannels()
// if (privacyPolicyAgreed) {
// }
}

View File

@ -31,13 +31,20 @@ open class PublicViewMode : BaseViewMode() {
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = if (BuildConfig.is_ym) {
rt.getHost()
val host = when {
BuildConfig.is_ym -> {
rt.getHostGithub()
}
} else if (BuildConfig.is_tz) {
rt.getTzHostTZ()
} else {
rt.getBzyHostDef()
BuildConfig.is_tz -> {
rt.getTzHostGithub()
}
BuildConfig.is_yunti -> {
rt.getYunTiHost()
}
else -> {
rt.getBzyHostGithub()
}
}
// Log.e("data", "2:$host")
host?.takeIf { it.isNotEmpty() }?.let {
@ -71,7 +78,9 @@ open class PublicViewMode : BaseViewMode() {
BuildConfig.is_tz -> {
rt.getTzHostGithub()
}
BuildConfig.is_yunti -> {
rt.getYunTiHostGithub()
}
else -> {
rt.getBzyHostGithub()
}
@ -107,7 +116,9 @@ open class PublicViewMode : BaseViewMode() {
BuildConfig.is_tz -> {
rt.getTzHostAWS()
}
BuildConfig.is_yunti -> {
rt.getYunTiHostAWS()
}
else -> {
rt.getBzyHostAWS()
}
@ -223,4 +234,70 @@ open class PublicViewMode : BaseViewMode() {
}
}
}
fun getYunTiKefuHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getYunTiKefuHost()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
fun getRegisterHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getYmRegister()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
fun getTzRegisterHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getTzRegister()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
fun getBzyRegisterHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getBzyRegister()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
fun getYunTiRegisterHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getYuntiRegister()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
}

View File

@ -97,6 +97,7 @@ class BZYConstants {
const val YMTGUrl = "https://t.me/shadowcat_vpn";
const val DefTGUrl = "https://t.me/bazhuayuvpn";
const val YunTiTGUrl = "https://t.me/+0GFGw9JkM8EwMGRl";
const val TZTGUrl = "https://t.me/taizivpn";
const val PopularApplicationsUrl = "https://2828.im/"

View File

@ -470,12 +470,20 @@ class SettingFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatc
clTelegraph.setOnClickListener {
var uri = Uri.parse(BZYConstants.DefTGUrl)
val intent = Intent(Intent.ACTION_VIEW)
if (BuildConfig.is_tz) {
uri = Uri.parse(BZYConstants.TZTGUrl)
} else {
if (BuildConfig.is_ym) {
when {
BuildConfig.is_ym -> {
uri = Uri.parse(BZYConstants.YMTGUrl)
}
BuildConfig.is_tz -> {
uri = Uri.parse(BZYConstants.TZTGUrl)
}
BuildConfig.is_yunti -> {
uri = Uri.parse(BZYConstants.YunTiTGUrl)
}
else -> {
uri = Uri.parse(BZYConstants.DefTGUrl)
}
}
intent.setData(uri)
startActivity(intent)

View File

@ -187,7 +187,13 @@ interface HttpApi {
suspend fun getTzHostAWS(): String
@GET("/ym-source/ym/main/hosttaizi.txt")
suspend fun getTzHostGithub(): String
//云梯
@GET("/host_yunti.txt")
suspend fun getYunTiHost(): String
@GET("/host_yunti.txt")
suspend fun getYunTiHostAWS(): String
@GET("/ym-source/ym/main/host_yunti.txt")
suspend fun getYunTiHostGithub(): String
//注册链接
@GET("/ymregister.txt")
suspend fun getYmRegister(): String
@ -195,6 +201,8 @@ interface HttpApi {
suspend fun getTzRegister(): String
@GET("/bzyregister.txt")
suspend fun getBzyRegister(): String
@GET("/yunti_register.txt")
suspend fun getYuntiRegister(): String
//客服链接
@GET("/ymkefu.txt")
suspend fun getYingMaoKefuHost(): String
@ -204,6 +212,9 @@ interface HttpApi {
@GET("/bzy_kefu.txt")
suspend fun getBzyKefuHost(): String
@GET("/yt_kefu.txt")
suspend fun getYunTiKefuHost(): String
// @Headers(
// "User-Agent: Octopus_Android"
// )

View File

@ -96,45 +96,7 @@ class LoginAtyVM : PublicViewMode() {
}
}
fun getRegisterHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getYmRegister()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
fun getTzRegisterHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getTzRegister()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
fun getBzyRegisterHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://yingmao.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getBzyRegister()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
fun upgradeVersion() {
val httpApi = NetService.instances.createHttpsEncodeStr(HttpApi::class.java)
val phoneNumber =

View File

@ -84,14 +84,21 @@ class BZYWebViewKeFu : BaseActivity() {
//// Log.e("data", "==$newProgress")
// }
// }
if (BuildConfig.is_tz) {
// webView.loadUrl("file:///android_asset/TZKeFu.html")
getTzKefu()
} else {
if (BuildConfig.is_ym) {
when {
BuildConfig.is_ym -> {
ymKefu()
} else {
// webView.loadUrl("file:///android_asset/kefu.html")
}
BuildConfig.is_tz -> {
getTzKefu()
}
BuildConfig.is_yunti -> {
getYunTiKefu()
}
else -> {
getBzyKefu()
}
}
@ -148,7 +155,8 @@ class BZYWebViewKeFu : BaseActivity() {
finish()
}
}
private fun getBzyKefu(){
private fun getBzyKefu() {
val userName = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")
var enNmae = URLEncoder.encode(userName, "UTF-8")
Log.d("enNmae==>${enNmae}")
@ -197,7 +205,8 @@ class BZYWebViewKeFu : BaseActivity() {
finish()
}
}
private fun getTzKefu(){
private fun getTzKefu() {
val userName = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")
var enNmae = URLEncoder.encode(userName, "UTF-8")
Log.d("enNmae==>${enNmae}")
@ -246,4 +255,53 @@ class BZYWebViewKeFu : BaseActivity() {
finish()
}
}
private fun getYunTiKefu() {
val userName = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")
var enNmae = URLEncoder.encode(userName, "UTF-8")
Log.d("enNmae==>${enNmae}")
if (TextUtils.isEmpty(kefuHost)) {
var mmkvHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_KEFU_HOST, "")
// com.cncat.vpn.common.log.Log.d("mmkvHost kf ==>${mmkvHost}")
webViewAtyVM.getYunTiKefuHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
// com.cncat.vpn.common.log.Log.d("str==>${str}")
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_KEFU_HOST, str)
}
kefuHost = str
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(str + "&app_account=${enNmae}")
)
)
finish()
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost + "&app_account=${enNmae}")
)
)
finish()
}
}
})
} else {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(kefuHost + "&app_account=${enNmae}")
)
)
finish()
}
}
}

View File

@ -48,6 +48,7 @@
<TextView
android:id="@+id/dialog_agreement_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>

View File

@ -1,38 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rlMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash_background"
tools:context=".act.SplashActivity"
android:id="@+id/rlMain"
>
tools:context=".act.SplashActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
android:background="@color/main_bg"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/main_bg"
android:visibility="invisible" />
<ProgressBar
android:id="@+id/pb_web"
android:visibility="invisible"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateTint="@color/blue_0136CB" />
android:layout_centerInParent="true"
android:indeterminateTint="@color/blue_0136CB"
android:visibility="invisible" />
<LinearLayout
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="@dimen/dp_40"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/but_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_15"
android:layout_weight="1"
android:background="@drawable/login_btn_bg_selector"
android:text="@string/skip"
android:visibility="visible">
</Button>
<Button
android:id="@+id/but_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/login_btn_bg_selector"
android:text="@string/email_or_phone_register"
android:visibility="visible">
</Button>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:visibility="gone"
android:id="@+id/ll_action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -42,7 +81,7 @@
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="50dp"
android:orientation="horizontal"
>
android:visibility="gone">
<RelativeLayout
android:id="@+id/rl_action_login"
@ -51,10 +90,10 @@
android:layout_weight="1">
<ImageView
android:layout_centerHorizontal="true"
android:id="@+id/iv_login"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerHorizontal="true"
android:src="@mipmap/action_login" />
<TextView
@ -72,11 +111,11 @@
</RelativeLayout>
<RelativeLayout
android:visibility="gone"
android:id="@+id/rl_action_register"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
android:layout_weight="1"
android:visibility="gone">
<ImageView
android:id="@+id/iv_register"
@ -120,8 +159,8 @@
android:layout_below="@id/pb"
android:layout_marginTop="5dp"
android:text="@string/LoadingProgress"
android:textSize="15sp"
android:textColor="@color/blue_0136CB" />
android:textColor="@color/blue_0136CB"
android:textSize="15sp" />
</RelativeLayout>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

View File

@ -4,6 +4,7 @@
<string name="app_name_gz">影猫</string>
<string name="app_name_gz2">影猫加速器</string>
<string name="app_name_taizi">太子</string>
<string name="app_name_yunti">云梯加速器</string>
<string name="file">file</string>
<string name="rule">rule</string>
<string name="proxy">proxy</string>
@ -353,4 +354,6 @@ Service Description\n
<string name="node_item_test">Speed test</string>
<string name="agree">Agree</string>
<string name="disagree">Disagree</string>
<string name="skip">Go to login</string>
<string name="email_or_phone_register">Email registration</string>
</resources>

View File

@ -343,4 +343,7 @@
<string name="node_item_test">線路測速</string>
<string name="agree">同意</string>
<string name="disagree">不同意</string>
<string name="skip">前往登入</string>
<string name="app_name_yunti">雲梯加速器</string>
<string name="email_or_phone_register">郵箱註冊</string>
</resources>

View File

@ -342,4 +342,7 @@
<string name="node_item_test">線路測速</string>
<string name="agree">同意</string>
<string name="disagree">不同意</string>
<string name="skip">前往登入</string>
<string name="app_name_yunti">雲梯加速器</string>
<string name="email_or_phone_register">郵箱註冊</string>
</resources>

View File

@ -362,4 +362,8 @@
<string name="node_item_test">线路测速</string>
<string name="agree">同意</string>
<string name="disagree">不同意</string>
<string name="skip">前往登录</string>
<string name="app_name_yunti">云梯加速器</string>
<string name="email_or_phone_register">邮箱注册</string>
</resources>