Add enable force proxy and proxy list to prohibit access to the official server

This commit is contained in:
方块君 2022-05-14 12:45:34 +08:00
parent c30eed1206
commit 650e7542ed
3 changed files with 13 additions and 0 deletions

View File

@ -141,6 +141,9 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
TrustMeAlready().initZygote(startupParam)
}
private var startForceUrl = false
private var startProxyList = false
@SuppressLint("WrongConstant", "ClickableViewAccessibility")
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
if (lpparam.packageName != "com.miHoYo.GenshinImpact") return
@ -149,8 +152,10 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
val context = it.args[0] as Context
sp = context.getSharedPreferences("serverConfig", 0)
forceUrl = sp.getBoolean("forceUrl", false)
startForceUrl = forceUrl
server = sp.getString("serverip", "") ?: ""
proxyList = sp.getBoolean("ProxyList", false)
startProxyList = proxyList
if (sp.getBoolean("KeepSSL", false)) sslHook()
}
hook()
@ -271,6 +276,10 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
setNeutralButton(moduleRes.getString(R.string.OfficialServer)) { _, _ ->
forceUrl = false
server = ""
if (startForceUrl || startProxyList) {
Toast.makeText(activity, moduleRes.getString(R.string.JoinServerError), Toast.LENGTH_LONG).show()
showDialog()
}
}
}.show()
}

View File

@ -27,4 +27,5 @@
<string name="LoginFailed">登录失败.</string>
<string name="LoginError">登录错误.</string>
<string name="Tools">工具</string>
<string name="JoinServerError">强制代理或代理列表已启用, 无法进入正式服务器.</string>
</resources>

View File

@ -26,4 +26,7 @@
<string name="LoginFailed">Login failed.</string>
<string name="LoginError">Login error.</string>
<string name="Tools">Tools</string>
<string name="JoinServerError">The force proxy or proxy list has been enabled and cannot enter the official
server.
</string>
</resources>