Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutoiris committed Nov 1, 2024
0 parents commit 6413730
Show file tree
Hide file tree
Showing 4 changed files with 308 additions and 0 deletions.
145 changes: 145 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: CI

on:
push:
branches:
- main
tags:
- 'v*'

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: "BiliRoamingX/BiliRoamingX"
ref: "v1.24.1"
submodules: "recursive"

- name: Checkout patches
uses: actions/checkout@v4
with:
path: customPatches

- name: Apply custom patches
run: |
cat $(ls ./customPatches/*.patch | sort) | git apply -v
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"

- name: Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Retrieve version
run: |
version=`awk -F "=" '$1 == "version" {print $2}' gradle.properties`
commit_count=`git rev-list HEAD --count`
version="${version}.r${commit_count}"
echo "VERSION=$version" >> $GITHUB_ENV
- name: Build with gradle
env:
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew --no-daemon -Dorg.gradle.jvmargs=-Xmx2g -Pversion=$VERSION dist

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: build

integrate:
name: Integrate
runs-on: ubuntu-latest
needs: build

steps:
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: build
merge-multiple: 'true'

- name: Download revanced-cli
run: wget https://github.com/zjns/revanced-cli/releases/latest/download/revanced-cli.jar

- name: Cache
id: cache
uses: actions/cache@v4
with:
path: bilibili-8.14.0.apk
key: bilibili-8.14.0

- name: Retrive Bilibili-8.14.0
if: steps.cache.outputs.cache-hit != 'true'
run: |
wget -O bilibili-8.14.0.apk https://android-apps.pp.cn/fs08/2024/09/19/7/110_e45d2a32e0ab2f09ad89083b0804c561.apk
- name: Integrate
run: |
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
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: integrate
path: "*patched.apk"

release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs: integrate
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Download APK from integrate
uses: actions/download-artifact@v4
with:
name: integrate
merge-multiple: true

- name: Download JAR from build
uses: actions/download-artifact@v4
with:
name: build
merge-multiple: true

- name: Publish release
id: publish
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
*
- name: Attest Release Files
id: attest
uses: actions/attest-build-provenance@v1
with:
subject-path: |
*
107 changes: 107 additions & 0 deletions 01-removeCheckUserStatus.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
--- 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) {

45 changes: 45 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Copyright (c) <year> <copyright holders>

Anti 996 License Version 1.0 (Draft)

Permission is hereby granted to any individual or legal entity obtaining a copy
of this licensed work (including the source code, documentation and/or related
items, hereinafter collectively referred to as the "licensed work"), free of
charge, to deal with the licensed work for any purpose, including without
limitation, the rights to use, reproduce, modify, prepare derivative works of,
publish, distribute and sublicense the licensed work, subject to the following
conditions:

1. The individual or the legal entity must conspicuously display, without
modification, this License on each redistributed or derivative copy of the
Licensed Work.

2. The individual or the legal entity must strictly comply with all applicable
laws, regulations, rules and standards of the jurisdiction relating to
labor and employment where the individual is physically located or where
the individual was born or naturalized; or where the legal entity is
registered or is operating (whichever is stricter). In case that the
jurisdiction has no such laws, regulations, rules and standards or its
laws, regulations, rules and standards are unenforceable, the individual
or the legal entity are required to comply with Core International Labor
Standards.

3. The individual or the legal entity shall not induce or force its
employee(s), whether full-time or part-time, or its independent
contractor(s), in any methods, to agree in oral or written form,
to directly or indirectly restrict, weaken or relinquish his or
her rights or remedies under such laws, regulations, rules and
standards relating to labor and employment as mentioned above,
no matter whether such written or oral agreement are enforceable
under the laws of the said jurisdiction, nor shall such individual
or the legal entity limit, in any methods, the rights of its employee(s)
or independent contractor(s) from reporting or complaining to the copyright
holder or relevant authorities monitoring the compliance of the license
about its violation(s) of the said license.

THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT
HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION
WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RoamingX-Mod

![Anti-996 License](https://img.shields.io/badge/license-Anti--996%20License-blue)

`Issue`, `Pull Requests`, `Star`, `Fork` are all welcomed.

Designed for:

- Bypass restrictions of `RoamingX`.

Enjoy :)

0 comments on commit 6413730

Please sign in to comment.