mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
Merge pull request #20 from nikhilbadyal/revanced-extend
Revanced extend
This commit is contained in:
@@ -30,9 +30,19 @@ supported_apps = [
|
|||||||
"warnwetter",
|
"warnwetter",
|
||||||
]
|
]
|
||||||
apps = env.list("PATCH_APPS", supported_apps)
|
apps = env.list("PATCH_APPS", supported_apps)
|
||||||
|
build_extended = env.bool("BUILD_EXTENDED", False)
|
||||||
|
extended_apps = ["youtube", "youtube_music"]
|
||||||
keystore_name = env.str("KEYSTORE_FILE_NAME", "revanced.keystore")
|
keystore_name = env.str("KEYSTORE_FILE_NAME", "revanced.keystore")
|
||||||
apk_mirror = "https://www.apkmirror.com"
|
apk_mirror = "https://www.apkmirror.com"
|
||||||
github = "https://www.github.com"
|
github = "https://www.github.com"
|
||||||
|
normal_cli_jar = "revanced-cli.jar"
|
||||||
|
normal_patches_jar = "revanced-patches.jar"
|
||||||
|
normal_integrations_apk = "revanced-integrations.apk"
|
||||||
|
cli_jar = f"inotia00-{normal_cli_jar}" if build_extended else normal_cli_jar
|
||||||
|
patches_jar = f"inotia00-{normal_patches_jar}" if build_extended else normal_patches_jar
|
||||||
|
integrations_apk = (
|
||||||
|
f"inotia00-{normal_integrations_apk}" if build_extended else normal_integrations_apk
|
||||||
|
)
|
||||||
apk_mirror_urls = {
|
apk_mirror_urls = {
|
||||||
"reddit": f"{apk_mirror}/apk/redditinc/reddit/",
|
"reddit": f"{apk_mirror}/apk/redditinc/reddit/",
|
||||||
"twitter": f"{apk_mirror}/apk/twitter-inc/twitter/",
|
"twitter": f"{apk_mirror}/apk/twitter-inc/twitter/",
|
||||||
@@ -181,8 +191,6 @@ class Patches(object):
|
|||||||
patches = resp.json()
|
patches = resp.json()
|
||||||
|
|
||||||
revanced_app_ids = {
|
revanced_app_ids = {
|
||||||
"com.google.android.youtube": ("youtube", "_yt"),
|
|
||||||
"com.google.android.apps.youtube.music": ("youtube-music", "_ytm"),
|
|
||||||
"com.reddit.frontpage": ("reddit", "_reddit"),
|
"com.reddit.frontpage": ("reddit", "_reddit"),
|
||||||
"com.ss.android.ugc.trill": ("tiktok", "_tiktok"),
|
"com.ss.android.ugc.trill": ("tiktok", "_tiktok"),
|
||||||
"com.twitter.android": ("twitter", "_twitter"),
|
"com.twitter.android": ("twitter", "_twitter"),
|
||||||
@@ -203,6 +211,36 @@ class Patches(object):
|
|||||||
p["version"] = version[-1] if version else "all"
|
p["version"] = version[-1] if version else "all"
|
||||||
getattr(self, app_name).append(p)
|
getattr(self, app_name).append(p)
|
||||||
|
|
||||||
|
if build_extended:
|
||||||
|
url = "https://raw.githubusercontent.com/inotia00/revanced-patches/revanced-extended/patches.json"
|
||||||
|
else:
|
||||||
|
url = "https://raw.githubusercontent.com/revanced/revanced-patches/main/patches.json"
|
||||||
|
|
||||||
|
resp_extended = session.get(url)
|
||||||
|
extended_patches = resp_extended.json()
|
||||||
|
revanced_extended_app_ids = {
|
||||||
|
"com.google.android.youtube": ("youtube", "_yt"),
|
||||||
|
"com.google.android.apps.youtube.music": ("youtube-music", "_ytm"),
|
||||||
|
}
|
||||||
|
for app_name in (
|
||||||
|
revanced_extended_app_ids[x][1] for x in revanced_extended_app_ids
|
||||||
|
):
|
||||||
|
setattr(self, app_name, [])
|
||||||
|
|
||||||
|
for patch in extended_patches:
|
||||||
|
for compatible_package, version in [
|
||||||
|
(x["name"], x["versions"]) for x in patch["compatiblePackages"]
|
||||||
|
]:
|
||||||
|
if compatible_package in revanced_extended_app_ids:
|
||||||
|
app_name = revanced_extended_app_ids[compatible_package][1]
|
||||||
|
p = {x: patch[x] for x in ["name", "description"]}
|
||||||
|
p["app"] = compatible_package
|
||||||
|
p["version"] = version[-1] if version else "all"
|
||||||
|
getattr(self, app_name).append(p)
|
||||||
|
|
||||||
|
for app_name, app_id in revanced_extended_app_ids.values():
|
||||||
|
n_patches = len(getattr(self, app_id))
|
||||||
|
logger.debug(f"Total patches in {app_name} are {n_patches}")
|
||||||
for app_name, app_id in revanced_app_ids.values():
|
for app_name, app_id in revanced_app_ids.values():
|
||||||
n_patches = len(getattr(self, app_id))
|
n_patches = len(getattr(self, app_id))
|
||||||
logger.debug(f"Total patches in {app_name} are {n_patches}")
|
logger.debug(f"Total patches in {app_name} are {n_patches}")
|
||||||
@@ -247,9 +285,13 @@ class ArgParser(object):
|
|||||||
|
|
||||||
def run(self, app: str, version: str, is_experimental: bool = False) -> None:
|
def run(self, app: str, version: str, is_experimental: bool = False) -> None:
|
||||||
logger.debug(f"Sending request to revanced cli for building {app} revanced")
|
logger.debug(f"Sending request to revanced cli for building {app} revanced")
|
||||||
cli = "revanced-cli.jar"
|
cli = normal_cli_jar
|
||||||
patches = "revanced-patches.jar"
|
patches = normal_patches_jar
|
||||||
integrations = "revanced-integrations.apk"
|
integrations = normal_integrations_apk
|
||||||
|
if build_extended and app in extended_apps:
|
||||||
|
cli = cli_jar
|
||||||
|
patches = patches_jar
|
||||||
|
integrations = integrations_apk
|
||||||
args = [
|
args = [
|
||||||
"-jar",
|
"-jar",
|
||||||
cli,
|
cli,
|
||||||
@@ -312,11 +354,17 @@ def pre_requisite():
|
|||||||
|
|
||||||
def download_revanced(downloader: Type[Downloader]) -> None:
|
def download_revanced(downloader: Type[Downloader]) -> None:
|
||||||
assets = (
|
assets = (
|
||||||
("revanced", "revanced-cli", "revanced-cli.jar"),
|
("revanced", "revanced-cli", normal_cli_jar),
|
||||||
("revanced", "revanced-integrations", "revanced-integrations.apk"),
|
("revanced", "revanced-integrations", normal_integrations_apk),
|
||||||
("revanced", "revanced-patches", "revanced-patches.jar"),
|
("revanced", "revanced-patches", normal_patches_jar),
|
||||||
("inotia00", "VancedMicroG", "VancedMicroG.apk"),
|
("inotia00", "VancedMicroG", "VancedMicroG.apk"),
|
||||||
)
|
)
|
||||||
|
if build_extended:
|
||||||
|
assets += (
|
||||||
|
("inotia00", "revanced-cli", cli_jar),
|
||||||
|
("inotia00", "revanced-integrations", integrations_apk),
|
||||||
|
("inotia00", "revanced-patches", patches_jar),
|
||||||
|
)
|
||||||
with ThreadPoolExecutor() as executor:
|
with ThreadPoolExecutor() as executor:
|
||||||
executor.map(lambda repo: downloader.repository(*repo), assets)
|
executor.map(lambda repo: downloader.repository(*repo), assets)
|
||||||
logger.info("Downloaded revanced microG ,cli, integrations and patches.")
|
logger.info("Downloaded revanced microG ,cli, integrations and patches.")
|
||||||
@@ -338,7 +386,10 @@ def main() -> None:
|
|||||||
|
|
||||||
def get_patches() -> None:
|
def get_patches() -> None:
|
||||||
logger.debug(f"Excluding patches for app {app}")
|
logger.debug(f"Excluding patches for app {app}")
|
||||||
excluded_patches = env.list(f"EXCLUDE_PATCH_{app}".upper(), [])
|
if build_extended and app in extended_apps:
|
||||||
|
excluded_patches = env.list(f"EXCLUDE_PATCH_{app}_EXTENDED".upper(), [])
|
||||||
|
else:
|
||||||
|
excluded_patches = env.list(f"EXCLUDE_PATCH_{app}".upper(), [])
|
||||||
for patch in app_patches:
|
for patch in app_patches:
|
||||||
arg_parser.include(patch["name"]) if patch[
|
arg_parser.include(patch["name"]) if patch[
|
||||||
"name"
|
"name"
|
||||||
|
|||||||
Reference in New Issue
Block a user