修改验证码界面,修改注册接口传输方式

This commit is contained in:
cyh 2025-05-21 10:26:47 +08:00
parent aca373cd8c
commit 064a6c4c3e
7 changed files with 94 additions and 48 deletions

View File

@ -71,8 +71,12 @@ import com.yingmao.clash.view.dialog.DialogAppVersion
import com.yingmao.clash.view.dialog.DialogDoMainChoose
import com.yingmao.clash.view.dialog.RxDialogSureCancel
import com.yingmao.clash.vm.SplashAtyVM
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.io.File
import java.util.Locale
@ -183,6 +187,9 @@ class SplashActivity : BaseActivity() {
// val Sgtr= AESUtil.decrypt("6A9E6037E4E31FDFE8E09A79FAD64B5CE7AA2D6C0DF34000998651C877C8005AD68274B63FCB1FC35DAFAD278B3EF19B79E83738A3AD5DB70D9601E43050BE0E")
// println("Sgtr==>$Sgtr")
// val Sgtr= AESUtil.Registerdecrypt(""
// , registerKey, registerIV2)
//com.cncat.vpn.common.log.Log.d("Sgtr==>$Sgtr")
// OpenInstall.getWakeUp(intent, wakeUpAdapter)
// OpenInstall.getInstall { appData, error ->
// var appData = appData
@ -340,13 +347,20 @@ class SplashActivity : BaseActivity() {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(registerHost)))
}
}
}
@SuppressLint("JavascriptInterface")
private fun setWebView() {
rlPb.visibility = View.INVISIBLE
webView.visibility = View.VISIBLE
but_skip.visibility = View.VISIBLE
lifecycleScope.launch(Dispatchers.Main) {
delay(3000) // 延迟3秒
com.cncat.vpn.common.log.Log.d("setWebView delay")
but_skip.visibility = View.VISIBLE
but_register.visibility = View.VISIBLE
}
// WebView设置
val webSettings = webView.settings
// 可选设置开启Chrome调试
@ -379,7 +393,7 @@ 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 {
@ -503,6 +517,7 @@ class SplashActivity : BaseActivity() {
if (MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_IS_REGISTER, false)) {
rlPb.visibility = View.VISIBLE
but_skip.visibility = View.INVISIBLE
but_register.visibility = View.INVISIBLE
splashAtyVM.checkLogin()
} else {
// doRegister()
@ -519,6 +534,7 @@ class SplashActivity : BaseActivity() {
ll_action.visibility = View.VISIBLE
rlPb.visibility = View.INVISIBLE
but_skip.visibility = View.INVISIBLE
but_register.visibility = View.INVISIBLE
if (MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_IS_REGISTER, false)) {
if (token != null && token.isNotEmpty()) {

View File

@ -54,11 +54,12 @@ interface HttpApi {
)
@GET("/netbarcloud/open/startImg")
suspend fun splashBg(): StartingBeans
@Headers(
"User-Agent: Octopus_Android"
)
@POST("/netbarcloud/vpn/phLogin.do")
fun login2(@QueryMap params: Map<String, String>): Call<LoginRsp2>
fun login2(@QueryMap params: Map<String, String>): Call<LoginRsp2>
//检查登录 http://10.10.23.115:8020/netbarcloud/api/userinfo
@Headers(
@ -87,7 +88,12 @@ interface HttpApi {
"User-Agent: Octopus_Android"
)
@POST("/netbarcloud/vpn/appRegister2")
suspend fun encryptionRegister(@QueryMap params: Map<String, String>): RegisterRsp
suspend fun encryptionRegister(
@Body requestBody: RequestBody,
): RegisterRsp
//显示赠送时长
@Headers(
@ -147,7 +153,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): String
//心跳 http://10.10.23.115:8020/netbarcloud/api/heartbeat
@ -160,7 +166,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): String
// @GET("/darkSuperman/lazy/blob/master/fire.json")
@ -169,40 +175,56 @@ interface HttpApi {
//影猫
@GET("/host_ym.txt")
suspend fun getHost(): String
@GET("/host_ym.txt")
suspend fun getHostAWS(): String
@GET("/ym-source/ym/main/host_ym.txt")
suspend fun getHostGithub(): String
//八爪鱼
@GET("/hostdef.txt")
suspend fun getBzyHostDef(): String
@GET("/hostdef.txt")
suspend fun getBzyHostAWS(): String
@GET("/ym-source/ym/main/hostdef.txt")
suspend fun getBzyHostGithub(): String
//太子
@GET("/hosttaizi.txt")
suspend fun getTzHostTZ(): String
@GET("/hosttaizi.txt")
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
@GET("/taiziregister.txt")
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
@ -256,9 +278,10 @@ interface HttpApi {
)
@POST("/netbarcloud/upload/uploadRequestLogs")
suspend fun uploadRequestLogs(
@Body param: RequestBody, @Header("token") string: String = MMKV.defaultMMKV().decodeString(
@Body param: RequestBody,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): NormalRsp
@ -269,7 +292,7 @@ interface HttpApi {
suspend fun getDomain(
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): String
//http://10.10.23.115:8020/netbarcloud/vpn/getPointCardSurplus.do
@ -279,7 +302,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): NormalRsp
//http://10.10.23.115:8020/netbarcloud/vpn/phRechargeInfo.do
@ -296,7 +319,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): RechargeInfoRsp
//http://10.10.23.115:8020/netbarcloud/vpn/phPay.do
@ -308,7 +331,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): PayRsp
@ -317,7 +340,7 @@ interface HttpApi {
@QueryMap params: HashMap<String, String?>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): PayRsp
//http://10.10.23.115:8020/netbarcloud/vpn/appAliPay.do
@ -329,7 +352,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): NormalRsp
//汇旺财二维码支付
@ -341,7 +364,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): QRPayRsp
//汇旺财二维码支付结果
@ -353,7 +376,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): QRPayStatusRsp
@ -366,7 +389,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): WXPayRsp
//http://10.10.23.115:8020/netbarcloud/vpn/pcPayStatus.do
@ -378,7 +401,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): NormalRsp
//http://10.10.23.115:8020/netbarcloud/vpn/phOrderList.do
@ -390,7 +413,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): ExpensesRecordRsp
//http://10.10.23.115:8020/netbarcloud/vpn/pointCardSurplusRecharge.do
@ -402,7 +425,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): NormalMessageRsp
//http://10.10.23.115:8020/netbarcloud/vpn/appPcPointCardPay.do
@ -414,7 +437,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): NormalMessageRsp
@Headers(
@ -425,7 +448,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): BiLaiNormalRsp
@Headers(
@ -436,7 +459,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): BiLaiNormalRsp
@Headers(
@ -447,7 +470,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): PhDownloadUrlRsp
@Headers(
@ -458,7 +481,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): BiLaiPayStatusRsp
@ -470,7 +493,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): SubscriptionRsp
//网页支付统一订单查询
@ -482,7 +505,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): NormalMessageRsp
@Headers(
@ -493,7 +516,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): AppVersionCheckRsp
@Headers(
@ -501,7 +524,7 @@ interface HttpApi {
)
@GET("/netbarcloud/vpn/upgradeVersion")
suspend fun upgradeVersion(
@QueryMap params: Map<String, String>
@QueryMap params: Map<String, String>,
): AppVersionCheckRsp
//忘记密码
@ -522,7 +545,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): SendSmsRsp
//会员签到
@ -534,7 +557,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): VipSignRsp
//会员签到
@ -546,7 +569,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): GetActivityRsp
//获取阿里云上传数据
@ -558,7 +581,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): UploadParamData
@Headers(
@ -570,7 +593,7 @@ interface HttpApi {
@Body requestBody: RequestBody,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): PayUploadParamData
@Headers(
@ -581,7 +604,7 @@ interface HttpApi {
@QueryMap params: Map<String, String>,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): AppStartupStatus
@Headers(
@ -593,7 +616,7 @@ interface HttpApi {
@Body requestBody: RequestBody,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): AppStopStatus
@Headers(
@ -605,6 +628,6 @@ interface HttpApi {
@Body requestBody: RequestBody,
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
BZYConstants.MMKV_KEY_TOKEN
).toString()
).toString(),
): AppStopStatus
}

View File

@ -2,6 +2,7 @@ package com.yingmao.clash.vm
import android.text.TextUtils
import android.util.Log
import com.google.gson.Gson
import com.orhanobut.logger.Logger
import com.tencent.mmkv.MMKV
@ -20,6 +21,9 @@ import com.yingmao.clash.net.http.NetService
import com.yingmao.clash.util.AESUtil
import kotlinx.coroutines.Job
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
class SplashAtyVM : PublicViewMode() {
@ -82,8 +86,12 @@ class SplashAtyVM : PublicViewMode() {
fun registerByEncryption(params: Map<String, String>) {
Log.e("data", "register ....")
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
val gson = Gson()
val jsonString = gson.toJson(params)
val requestBody: RequestBody = jsonString.toRequestBody("application/json; charset=utf-8".toMediaType())
doAsync(HttpReqType.REGISTER) {
httpApi.encryptionRegister(params)
httpApi.encryptionRegister(requestBody)
}
}

View File

@ -55,7 +55,7 @@
android:layout_weight="1"
android:background="@drawable/login_btn_bg_selector"
android:text="@string/skip"
android:visibility="visible">
android:visibility="invisible">
</Button>
<Button
@ -65,7 +65,7 @@
android:layout_weight="1"
android:background="@drawable/login_btn_bg_selector"
android:text="@string/email_or_phone_register"
android:visibility="visible">
android:visibility="invisible">
</Button>
</LinearLayout>

View File

@ -338,15 +338,15 @@
<string name="everyDay">每天</string>
<string name="PopularApplications">熱門應用</string>
<string name="PopularApplicationsStr">熱門應用導航</string>
<string name="sure_restart">"建議重啓 "</string>
<string name="restart">"重啓 "</string>
<string name="sure_restart">"建議重啓"</string>
<string name="restart">"重啓"</string>
<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>
<string name="email_or_phone_register">手動注册</string>
<string name="CZHY">充值會員</string>
</resources>

View File

@ -337,15 +337,14 @@
<string name="everyDay">每天</string>
<string name="PopularApplications">熱門應用</string>
<string name="PopularApplicationsStr">熱門應用導航</string>
<string name="sure_restart">"建議重啓 "</string>
<string name="restart">"重啓 "</string>
<string name="sure_restart">"建議重啓"</string>
<string name="restart">"重啓"</string>
<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>
<string name="email_or_phone_register">手動注册</string>
<string name="CZHY">充值會員</string>
</resources>

View File

@ -366,7 +366,7 @@
<string name="skip">直接登录</string>
<string name="app_name_yunti">云梯加速器</string>
<string name="email_or_phone_register">邮箱注册</string>
<string name="email_or_phone_register">手动注册</string>
<string name="CZHY">充值会员</string>
</resources>