diff --git a/README.md b/README.md
index 920eb2b..8a88fcf 100644
--- a/README.md
+++ b/README.md
@@ -103,43 +103,47 @@ You can use any of the following methods to build.
### Global Config
-| **Env Name** | **Description** | **Default** |
-|:---------------------------------------------------------|:-------------------------------------------------:|:---------------------------------------------------------------------------------------------------------|
-| [PATCH_APPS](#patch-apps) | Apps to patch/build | youtube |
-| [EXISTING_DOWNLOADED_APKS ](#existing-downloaded-apks) | Already downloaded clean apks | [] |
-| [PERSONAL_ACCESS_TOKEN](#personal-access-token) | Github Token to be used | None |
-| DRY_RUN | Do a dry run | False |
-| [GLOBAL_CLI_DL*](#global-resources) | DL for CLI to be used for patching apps. | [Revanced CLI](https://github.com/revanced/revanced-cli) |
-| [GLOBAL_PATCHES_DL*](#global-resources) | DL for Patches to be used for patching apps. | [Revanced Patches](https://github.com/revanced/revanced-patches) |
-| [GLOBAL_PATCHES_JSON_DL*](#global-resources) | DL for Patches Json to be used for patching apps. | [Revanced Patches](https://github.com/revanced/revanced-patches) |
-| [GLOBAL_INTEGRATIONS_DL*](#global-resources) | DL for Integrations to be used for patching apps. | [Revanced Integrations](https://github.com/revanced/revanced-integrations) |
-| [GLOBAL_KEYSTORE_FILE_NAME*](#global-keystore-file-name) | Key file to be used for signing apps | [Builder's own key](https://github.com/nikhilbadyal/docker-py-revanced/blob/main/apks/revanced.keystore) |
-| [GLOBAL_ARCHS_TO_BUILD*](#global-archs-to-build) | Arch to keep in the patched apk. | All |
-| REDDIT_CLIENT_ID | Reddit Client ID to patch reddit apps | None |
-| VT_API_KEY | Virus Total Key to scan APKs | None |
-| [TELEGRAM_CHAT_ID](#telegram-support) | Receiver in Telegram upload | None |
-| [TELEGRAM_BOT_TOKEN](#telegram-support) | APKs Sender for Telegram upload | None |
-| [TELEGRAM_API_ID](#telegram-support) | Used for telegram Authentication | None |
-| [TELEGRAM_API_HASH](#telegram-support) | Used for telegram Authentication | None |
-| [EXTRA_FILES](#extra-files) | Extra files apk to upload in GitHub upload. | None |
+| **Env Name** | **Description** | **Default** |
+|:---------------------------------------------------------|:-------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------|
+| [PATCH_APPS](#patch-apps) | Apps to patch/build | youtube |
+| [EXISTING_DOWNLOADED_APKS ](#existing-downloaded-apks) | Already downloaded clean apks | [] |
+| [PERSONAL_ACCESS_TOKEN](#personal-access-token) | Github Token to be used | None |
+| DRY_RUN | Do a dry run | False |
+| [GLOBAL_CLI_DL*](#global-resources) | DL for CLI to be used for patching apps. | [Revanced CLI](https://github.com/revanced/revanced-cli) |
+| [GLOBAL_PATCHES_DL*](#global-resources) | DL for Patches to be used for patching apps. | [Revanced Patches](https://github.com/revanced/revanced-patches) |
+| [GLOBAL_SPACE_FORMATTED_PATCHES*](#global-resources) | Whether patches are space formatted. | True |
+| [GLOBAL_PATCHES_JSON_DL*](#global-resources) | DL for Patches Json to be used for patching apps. | [Revanced Patches](https://github.com/revanced/revanced-patches) |
+| [GLOBAL_INTEGRATIONS_DL*](#global-resources) | DL for Integrations to be used for patching apps. | [Revanced Integrations](https://github.com/revanced/revanced-integrations) |
+| [GLOBAL_KEYSTORE_FILE_NAME*](#global-keystore-file-name) | Key file to be used for signing apps | [Builder's own key](https://github.com/nikhilbadyal/docker-py-revanced/blob/main/apks/revanced.keystore) |
+| [GLOBAL_OLK_KEY*](#global-keystore-file-name) | Whether key was generated with cli v4(new) or not |
[Builder's v3(old) own key](https://github.com/nikhilbadyal/docker-py-revanced/blob/main/apks/revanced.keystore) |
+| [GLOBAL_ARCHS_TO_BUILD*](#global-archs-to-build) | Arch to keep in the patched apk. | All |
+| REDDIT_CLIENT_ID | Reddit Client ID to patch reddit apps | None |
+| VT_API_KEY | Virus Total Key to scan APKs | None |
+| [TELEGRAM_CHAT_ID](#telegram-support) | Receiver in Telegram upload | None |
+| [TELEGRAM_BOT_TOKEN](#telegram-support) | APKs Sender for Telegram upload | None |
+| [TELEGRAM_API_ID](#telegram-support) | Used for telegram Authentication | None |
+| [TELEGRAM_API_HASH](#telegram-support) | Used for telegram Authentication | None |
+| [EXTRA_FILES](#extra-files) | Extra files apk to upload in GitHub upload. | None |
`*` - Can be overridden for individual app.
### App Level Config
-| Env Name | Description | Default |
-|:------------------------------------------------------------|:---------------------------------------------------------:|:-------------------------------|
-| [*APP_NAME*_CLI_DL](#global-resources) | DL for CLI to be used for patching **APP_NAME**. | GLOBAL_CLI_DL |
-| [*APP_NAME*_PATCHES_DL](#global-resources) | DL for Patches to be used for patching **APP_NAME**. | GLOBAL_PATCHES_DL |
-| [*APP_NAME*_PATCHES_JSON_DL](#global-resources) | DL for Patches Json to be used for patching **APP_NAME**. | GLOBAL_PATCHES_JSON_DL |
-| [*APP_NAME*_INTEGRATIONS_DL](#global-resources) | DL for Integrations to be used for patching **APP_NAME**. | GLOBAL_INTEGRATIONS_DL |
-| [*APP_NAME*_KEYSTORE_FILE_NAME](#global-keystore-file-name) | Key file to be used for signing **APP_NAME**. | GLOBAL_KEYSTORE_FILE_NAME |
-| [*APP_NAME*_ARCHS_TO_BUILD](#global-archs-to-build) | Arch to keep in the patched **APP_NAME**. | GLOBAL_ARCHS_TO_BUILD |
-| [*APP_NAME*_EXCLUDE_PATCH**](#custom-exclude-patching) | Patches to exclude while patching **APP_NAME**. | [] |
-| [*APP_NAME*_INCLUDE_PATCH**](#custom-include-patching) | Patches to include while patching **APP_NAME**. | [] |
-| [*APP_NAME*_VERSION](#app-version) | Version to use for download for patching. | Recommended by patch resources |
-| [*APP_NAME*_PACKAGE_NAME***](#any-patch-apps) | Package name of the app to be patched | None |
-| [*APP_NAME*_DL_SOURCE***](#any-patch-apps) | Download source of any of the supported scrapper | None |
-| [*APP_NAME*_DL***](#app-dl) | Direct download Link for clean apk | None |
+| Env Name | Description | Default |
+|:------------------------------------------------------------|:--------------------------------------------------------------------------------------------:|:-------------------------------|
+| [*APP_NAME*_CLI_DL](#global-resources) | DL for CLI to be used for patching **APP_NAME**. | GLOBAL_CLI_DL |
+| [*APP_NAME*_PATCHES_DL](#global-resources) | DL for Patches to be used for patching **APP_NAME**. | GLOBAL_PATCHES_DL |
+| [*APP_NAME*_PATCHES_JSON_DL](#global-resources) | DL for Patches Json to be used for patching **APP_NAME**. | GLOBAL_PATCHES_JSON_DL |
+| [*APP_NAME*_SPACE_FORMATTED_PATCHES](#global-resources) | Whether patches are space formatted. **APP_NAME**. | GLOBAL_SPACE_FORMATTED_PATCHES |
+| [*APP_NAME*_INTEGRATIONS_DL](#global-resources) | DL for Integrations to be used for patching **APP_NAME**. | GLOBAL_INTEGRATIONS_DL |
+| [*APP_NAME*_KEYSTORE_FILE_NAME](#global-keystore-file-name) | Key file to be used for signing **APP_NAME**. | GLOBAL_KEYSTORE_FILE_NAME |
+| [*APP_NAME*_OLD_KEY](#global-keystore-file-name) | Whether key used was generated with cli > v4(new)
**APP_NAME**.
| GLOBAL_OLK_KEY |
+| [*APP_NAME*_ARCHS_TO_BUILD](#global-archs-to-build) | Arch to keep in the patched **APP_NAME**. | GLOBAL_ARCHS_TO_BUILD |
+| [*APP_NAME*_EXCLUDE_PATCH**](#custom-exclude-patching) | Patches to exclude while patching **APP_NAME**. | [] |
+| [*APP_NAME*_INCLUDE_PATCH**](#custom-include-patching) | Patches to include while patching **APP_NAME**. | [] |
+| [*APP_NAME*_VERSION](#app-version) | Version to use for download for patching. | Recommended by patch resources |
+| [*APP_NAME*_PACKAGE_NAME***](#any-patch-apps) | Package name of the app to be patched | None |
+| [*APP_NAME*_DL_SOURCE***](#any-patch-apps) | Download source of any of the supported scrapper | None |
+| [*APP_NAME*_DL***](#app-dl) | Direct download Link for clean apk | None |
`**` - By default all patches for a given app are included.
`**` - Can be used to included universal patch.
@@ -288,6 +292,9 @@ You can use any of the following methods to build.
If you have want to provide resource locally in the apks folder. You can specify that by mentioning filename
prefixed with `local://`.
*Note* - The link provided must be DLs. Unless they are from GitHub.
+ *Note* - Some of the patch source like inotia00 still provides **-** seperated patches while revanced shifted to
+ Space formatted patches. Use `SPACE_FORMATTED_PATCHES` to define the type of patches.
+
8. If you don't want to use default keystore. You can provide your own by
placing it inside `apks` folder. And adding the name of `keystore-file` in `.env` file or in `ENVS` in `GitHub
secrets` (Recommended) in the format
@@ -300,6 +307,15 @@ You can use any of the following methods to build.
```dotenv
YOUTUBE_KEYSTORE_FILE_NAME=youtube.keystore
```
+ Note - If you are using your own keystore.And it was generated with cli > v4 Add
+ Example:
+ ```dotenv
+ GLOBAL_OLD_KEY=False
+ ```
+ if you are using different key for different apps. You need to specify at app level.
+ ```dotenv
+ YOUTUBE_OLD_KEY=False
+ ```
9. You can build only for a particular arch in order to get smaller apk files.This
can be done with by adding comma separated `ARCHS_TO_BUILD` in `ENVS` in `GitHub secrets` (Recommended) in the
format.
diff --git a/main.py b/main.py
index 2dec4e52..d8cc377 100644
--- a/main.py
+++ b/main.py
@@ -6,7 +6,6 @@ from loguru import logger
from src.app import APP
from src.config import RevancedConfig
-from src.downloader.download import Downloader
from src.exceptions import AppNotFoundError, BuilderError, PatchesJsonLoadError, PatchingFailedError
from src.parser import Parser
from src.patches import Patches
@@ -25,7 +24,6 @@ def main() -> None:
env = Env()
env.read_env()
config = RevancedConfig(env)
- Downloader.extra_downloads(config)
if not config.dry_run:
check_java()
diff --git a/src/app.py b/src/app.py
index ae9fbd6..7b506c7 100644
--- a/src/app.py
+++ b/src/app.py
@@ -42,6 +42,11 @@ class APP(object):
self.download_patch_resources(config)
self.download_source = config.env.str(f"{app_name}_DL_SOURCE".upper(), "")
self.package_name = package_name
+ self.old_key = config.env.bool(f"{app_name}_OLD_KEY".upper(), config.global_old_key)
+ self.space_formatted = config.env.bool(
+ f"{app_name}_SPACE_FORMATTED_PATCHES".upper(),
+ config.global_space_formatted,
+ )
def download_apk_for_patching(self: Self, config: RevancedConfig) -> None:
"""Download apk to be patched."""
diff --git a/src/config.py b/src/config.py
index c1fcfe0..949e713 100644
--- a/src/config.py
+++ b/src/config.py
@@ -34,3 +34,5 @@ class RevancedConfig(object):
self.apk_editor = "apkeditor-output.jar"
self.extra_download_files.append("https://github.com/REAndroid/APKEditor@apkeditor.jar")
self.apps = env.list("PATCH_APPS", default_build)
+ self.global_old_key = env.bool("GLOBAL_OLD_KEY", True)
+ self.global_space_formatted = env.bool("GLOBAL_SPACE_FORMATTED_PATCHES", True)
diff --git a/src/parser.py b/src/parser.py
index 13d0a16..ad430ea 100644
--- a/src/parser.py
+++ b/src/parser.py
@@ -110,16 +110,27 @@ class Parser(object):
patches_dict: dict[str, str],
) -> None:
"""The function `include_exclude_patch` includes and excludes patches for a given app."""
- for patch in patches:
- normalized_patch = patch["name"].lower().replace(" ", "-")
- self.include(normalized_patch) if normalized_patch not in app.exclude_request else self.exclude(
- normalized_patch,
- )
- for normalized_patch in app.include_request:
- self.include(normalized_patch) if normalized_patch not in patches_dict["universal_patch"] else ()
+ if app.space_formatted:
+ for patch in patches:
+ normalized_patch = patch["name"].lower().replace(" ", "-")
+ self.include(patch["name"]) if normalized_patch not in app.exclude_request else self.exclude(
+ patch["name"],
+ )
+ for normalized_patch in app.include_request:
+ self.include(normalized_patch.lower().replace("-", " ")) if normalized_patch not in patches_dict[
+ "universal_patch"
+ ] else ()
+ else:
+ for patch in patches:
+ normalized_patch = patch["name"].lower().replace(" ", "-")
+ self.include(normalized_patch) if normalized_patch not in app.exclude_request else self.exclude(
+ normalized_patch,
+ )
+ for normalized_patch in app.include_request:
+ self.include(normalized_patch) if normalized_patch not in patches_dict["universal_patch"] else ()
@staticmethod
- def is_new_cli(cli_path: Path) -> bool:
+ def is_new_cli(cli_path: Path) -> tuple[bool, str]:
"""Check if new cli is being used."""
process = Popen(["java", "-jar", cli_path, "-V"], stdout=PIPE)
output = process.stdout
@@ -127,11 +138,11 @@ class Parser(object):
msg = "Failed to send request for patching."
raise PatchingFailedError(msg)
combined_result = "".join(line.decode() for line in output)
- if "v3" in combined_result:
+ if "v3" in combined_result or "v4" in combined_result:
logger.debug("New cli")
- return True
+ return True, combined_result
logger.debug("Old cli")
- return False
+ return False, combined_result
# noinspection IncorrectFormatting
def patch_app(
@@ -146,7 +157,8 @@ class Parser(object):
The `app` parameter is an instance of the `APP` class. It represents an application that needs
to be patched.
"""
- if self.is_new_cli(self.config.temp_folder.joinpath(app.resource["cli"])):
+ is_new, version = self.is_new_cli(self.config.temp_folder.joinpath(app.resource["cli"]))
+ if is_new:
apk_arg = self.NEW_APK_ARG
exp = "--force"
else:
@@ -172,6 +184,10 @@ class Parser(object):
logger.debug("Using experimental features")
args.append(exp)
args[1::2] = map(self.config.temp_folder.joinpath, args[1::2])
+ if app.old_key and "v4" in version:
+ # https://github.com/ReVanced/revanced-cli/issues/272#issuecomment-1740587534
+ old_key_flags = ["--alias=alias", "--keystore-entry-password=ReVanced", "--keystore-password=ReVanced"]
+ args.extend(old_key_flags)
if self.config.ci_test:
self.exclude_all_patches()
if self._PATCHES: