Skip to content

Commit 6413730

Browse files
committed
init
0 parents  commit 6413730

File tree

4 files changed

+308
-0
lines changed

4 files changed

+308
-0
lines changed

.github/workflows/ci.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
build:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
repository: "BiliRoamingX/BiliRoamingX"
21+
ref: "v1.24.1"
22+
submodules: "recursive"
23+
24+
- name: Checkout patches
25+
uses: actions/checkout@v4
26+
with:
27+
path: customPatches
28+
29+
- name: Apply custom patches
30+
run: |
31+
cat $(ls ./customPatches/*.patch | sort) | git apply -v
32+
33+
- name: Set up JDK
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: "temurin"
37+
java-version: "17"
38+
39+
- name: Cache
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
~/.gradle/caches
44+
~/.gradle/wrapper
45+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
46+
restore-keys: |
47+
${{ runner.os }}-gradle-
48+
49+
- name: Retrieve version
50+
run: |
51+
version=`awk -F "=" '$1 == "version" {print $2}' gradle.properties`
52+
commit_count=`git rev-list HEAD --count`
53+
version="${version}.r${commit_count}"
54+
echo "VERSION=$version" >> $GITHUB_ENV
55+
56+
- name: Build with gradle
57+
env:
58+
GITHUB_TOKEN: ${{ github.token }}
59+
run: ./gradlew --no-daemon -Dorg.gradle.jvmargs=-Xmx2g -Pversion=$VERSION dist
60+
61+
- name: Upload artifacts
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: build
65+
path: build
66+
67+
integrate:
68+
name: Integrate
69+
runs-on: ubuntu-latest
70+
needs: build
71+
72+
steps:
73+
- name: Set up JDK
74+
uses: actions/setup-java@v4
75+
with:
76+
distribution: "temurin"
77+
java-version: "17"
78+
79+
- name: Download artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: build
83+
merge-multiple: 'true'
84+
85+
- name: Download revanced-cli
86+
run: wget https://github.com/zjns/revanced-cli/releases/latest/download/revanced-cli.jar
87+
88+
- name: Cache
89+
id: cache
90+
uses: actions/cache@v4
91+
with:
92+
path: bilibili-8.14.0.apk
93+
key: bilibili-8.14.0
94+
95+
- name: Retrive Bilibili-8.14.0
96+
if: steps.cache.outputs.cache-hit != 'true'
97+
run: |
98+
wget -O bilibili-8.14.0.apk https://android-apps.pp.cn/fs08/2024/09/19/7/110_e45d2a32e0ab2f09ad89083b0804c561.apk
99+
100+
- name: Integrate
101+
run: |
102+
java -jar revanced-cli.jar patch --merge $(ls *integrations*.apk) --patch-bundle $(ls *patches*.jar) --signing-levels 1,2,3 bilibili-8.14.0.apk
103+
104+
- name: Upload artifacts
105+
uses: actions/upload-artifact@v4
106+
with:
107+
name: integrate
108+
path: "*patched.apk"
109+
110+
release:
111+
name: Release
112+
if: startsWith(github.ref, 'refs/tags/v')
113+
needs: integrate
114+
runs-on: ubuntu-latest
115+
permissions:
116+
contents: write
117+
id-token: write
118+
attestations: write
119+
steps:
120+
- name: Download APK from integrate
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: integrate
124+
merge-multiple: true
125+
126+
- name: Download JAR from build
127+
uses: actions/download-artifact@v4
128+
with:
129+
name: build
130+
merge-multiple: true
131+
132+
- name: Publish release
133+
id: publish
134+
uses: softprops/action-gh-release@v1
135+
with:
136+
fail_on_unmatched_files: true
137+
files: |
138+
*
139+
140+
- name: Attest Release Files
141+
id: attest
142+
uses: actions/attest-build-provenance@v1
143+
with:
144+
subject-path: |
145+
*

01-removeCheckUserStatus.patch

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

LICENSE

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Copyright (c) <year> <copyright holders>
2+
3+
Anti 996 License Version 1.0 (Draft)
4+
5+
Permission is hereby granted to any individual or legal entity obtaining a copy
6+
of this licensed work (including the source code, documentation and/or related
7+
items, hereinafter collectively referred to as the "licensed work"), free of
8+
charge, to deal with the licensed work for any purpose, including without
9+
limitation, the rights to use, reproduce, modify, prepare derivative works of,
10+
publish, distribute and sublicense the licensed work, subject to the following
11+
conditions:
12+
13+
1. The individual or the legal entity must conspicuously display, without
14+
modification, this License on each redistributed or derivative copy of the
15+
Licensed Work.
16+
17+
2. The individual or the legal entity must strictly comply with all applicable
18+
laws, regulations, rules and standards of the jurisdiction relating to
19+
labor and employment where the individual is physically located or where
20+
the individual was born or naturalized; or where the legal entity is
21+
registered or is operating (whichever is stricter). In case that the
22+
jurisdiction has no such laws, regulations, rules and standards or its
23+
laws, regulations, rules and standards are unenforceable, the individual
24+
or the legal entity are required to comply with Core International Labor
25+
Standards.
26+
27+
3. The individual or the legal entity shall not induce or force its
28+
employee(s), whether full-time or part-time, or its independent
29+
contractor(s), in any methods, to agree in oral or written form,
30+
to directly or indirectly restrict, weaken or relinquish his or
31+
her rights or remedies under such laws, regulations, rules and
32+
standards relating to labor and employment as mentioned above,
33+
no matter whether such written or oral agreement are enforceable
34+
under the laws of the said jurisdiction, nor shall such individual
35+
or the legal entity limit, in any methods, the rights of its employee(s)
36+
or independent contractor(s) from reporting or complaining to the copyright
37+
holder or relevant authorities monitoring the compliance of the license
38+
about its violation(s) of the said license.
39+
40+
THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
42+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT
43+
HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
44+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION
45+
WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RoamingX-Mod
2+
3+
![Anti-996 License](https://img.shields.io/badge/license-Anti--996%20License-blue)
4+
5+
`Issue`, `Pull Requests`, `Star`, `Fork` are all welcomed.
6+
7+
Designed for:
8+
9+
- Bypass restrictions of `RoamingX`.
10+
11+
Enjoy :)

0 commit comments

Comments
 (0)