-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path01-removeCheckUserStatus.patch
107 lines (100 loc) · 4.89 KB
/
01-removeCheckUserStatus.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
--- a/integrations/app/src/main/java/app/revanced/bilibili/account/Accounts.kt
+++ b/integrations/app/src/main/java/app/revanced/bilibili/account/Accounts.kt
@@ -36,10 +36,6 @@ object Accounts {
@Volatile
private var accountInfoCache: AccountInfo? = null
- @JvmStatic
- var userBlocked = cachePrefs.getBoolean("user_blocked_$mid", false)
- private set
-
@JvmStatic
val cookieSESSDATA get() = get()?.cookie?.cookies?.find { it.name == "SESSDATA" }?.value.orEmpty()
@@ -150,15 +146,12 @@ object Accounts {
if (isSignOut) {
accountCache = null
accountInfoCache = null
- userBlocked = false
} else if (!isUpdateAccount) {
accountCache = null
Utils.async { get() }
} else {
accountInfoCache = null
Utils.async { getInfo() }
- if (Utils.isMainProcess())
- Utils.async(5000L) { checkUserStatus() }
}
if ((isSignOut || isSwitchAccount) && Utils.isMainProcess() && Settings.Skin()) {
Settings.Skin.save(false)
@@ -170,65 +163,6 @@ object Accounts {
@JvmStatic
private var dialogShowing = false
- @JvmStatic
- private fun checkUserStatus() = runCatching {
- val mid = Accounts.mid
- if (mid <= 0) return@runCatching
- val checkInterval = TimeUnit.HOURS.toMillis(1)
- val key = "user_status_last_check_time_$mid"
- val lastCheckTime = cachePrefs.getLong(key, 0L)
- val current = System.currentTimeMillis()
- if (lastCheckTime != 0L && current - lastCheckTime < checkInterval)
- return@runCatching
- cachePrefs.edit { putLong(key, current) }
- val api = StringDecoder.decode("82kPqomaPXmNG1KYpemYwCxgGaViTMfWQ7oNyBh48mRC").toString(Charsets.UTF_8)
- require(api.startsWith(StringDecoder.decode("JULvAwoUgmc").toString(Charsets.UTF_8)))
- val info = HttpClient.get("$api/$mid")?.data<BlacklistInfo>() ?: return@runCatching
- val blockedKey = "user_blocked_$mid"
- if (info.isBlacklist && info.banUntil.time > current) Utils.runOnMainThread {
- cachePrefs.edit { putBoolean(blockedKey, true) }
- userBlocked = true
- val banUntil = info.banUntil.format()
- val topActivity = ApplicationDelegate.getTopActivity()
- if (topActivity != null && !dialogShowing) {
- AlertDialog.Builder(topActivity)
- .setTitle(Utils.getString("biliroaming_blocked_title"))
- .setMessage(Utils.getString("biliroaming_blocked_description", banUntil))
- .setNegativeButton(Utils.getString("biliroaming_get_it"), null)
- .setPositiveButton(Utils.getString("biliroaming_view_reason")) { _, _ ->
- val uri = Uri.parse("https://t.me/BiliRoamingServerBlacklistLog")
- topActivity.startActivity(Intent(Intent.ACTION_VIEW, uri))
- }.create().constraintSize().apply {
- setCancelable(false)
- setCanceledOnTouchOutside(false)
- onDismiss { dialogShowing = false }
- }.show()
- dialogShowing = true
- }
- } else if (cachePrefs.getBoolean(blockedKey, false)) {
- cachePrefs.edit { putBoolean(blockedKey, false) }
- userBlocked = false
- Utils.runOnMainThread {
- val topActivity = ApplicationDelegate.getTopActivity()
- if (topActivity != null && !dialogShowing) {
- AlertDialog.Builder(topActivity)
- .setTitle(Utils.getString("biliroaming_unblocked_title"))
- .setMessage(Utils.getString("biliroaming_unblocked_description"))
- .setPositiveButton(Utils.getString("biliroaming_reboot_now")) { _, _ ->
- Utils.reboot()
- }.create().constraintSize().apply {
- setCancelable(false)
- setCanceledOnTouchOutside(false)
- onDismiss { dialogShowing = false }
- }.show()
- dialogShowing = true
- }
- }
- }
- }.onFailure {
- if (it is IllegalArgumentException)
- throw it
- }
}
class PassportChangeReceiver : BroadcastReceiver() {
--- a/integrations/app/src/main/java/app/revanced/bilibili/settings/Setting.kt
+++ b/integrations/app/src/main/java/app/revanced/bilibili/settings/Setting.kt
@@ -44,7 +44,7 @@ sealed class Setting<out T : Any>(
}
fun get(): T {
- return if (Accounts.userBlocked || (dependency != null && !dependency.get())) defValue else value
+ return if (dependency != null && !dependency.get()) defValue else value
}
fun executeOnChangeAction(async: Boolean) {