From c496931f3f558d2fea29275fb98aec6aa6c417a8 Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Thu, 4 Apr 2024 15:03:46 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Ability=20to=20provide=20options=20?= =?UTF-8?q?file=20per=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 55 +++++++++++++++++++++++++++++++-------------------- src/app.py | 1 + src/config.py | 1 + src/parser.py | 2 +- 4 files changed, 37 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 8d04b3c..2195f12 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ You can use any of the following methods to build. | [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_OLD_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_OPTIONS_FILE*](#global-options-file) | Options file to be used | [Builder's default file](https://github.com/nikhilbadyal/docker-py-revanced/blob/main/apks/options.json) | | [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 | @@ -337,22 +338,34 @@ You can use any of the following methods to build. ```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. +9. If you don't want to use default options.json file. You can provide your own by + placing it inside `apks` folder. And adding the name of `options-file` in `.env` file or in `ENVS` in `GitHub + secrets` (Recommended) in the format ```dotenv - GLOABAL_ARCHS_TO_BUILD=arm64-v8a,armeabi-v7a + GLOBAL_OPTIONS_FILE=my_options.json ``` - Tool also support configuring at app level.
+ Tool also support providing secret key at app level. You can sign A app with X key while signing B with Y + key.
+ Example: + ```dotenv + YOUTUBE_OPTIONS_FILE=my_cool_yt_options.json + ``` +10. 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. + ```dotenv + GLOABAL_ARCHS_TO_BUILD=arm64-v8a,armeabi-v7a + ``` + Tool also support configuring at app level.
- Example: - ```dotenv - YOUTUBE_ARCHS_TO_BUILD=arm64-v8a,armeabi-v7a - ``` - *Note* - - 1. Possible values are: `armeabi-v7a`,`x86`,`x86_64`,`arm64-v8a` - 2. Make sure the patching resource(CLI) support this feature. -10. If you want to include any extra file to the Github upload. Set comma arguments + Example: + ```dotenv + YOUTUBE_ARCHS_TO_BUILD=arm64-v8a,armeabi-v7a + ``` + *Note* - + 1. Possible values are: `armeabi-v7a`,`x86`,`x86_64`,`arm64-v8a` + 2. Make sure the patching resource(CLI) support this feature. +11. If you want to include any extra file to the Github upload. Set comma arguments in `.env` file or in `ENVS` in `GitHub secrets` (Recommended) in the format ```ini EXTRA_FILES=@.apk @@ -361,7 +374,7 @@ You can use any of the following methods to build. ```dotenv EXTRA_FILES=https://github.com/inotia00/mMicroG/releases/latest@mmicrog.apk,https://github.com/revanced/revanced-integrations@integrations.apk ``` -11. If you want to exclude any patch. Set comma separated patch in `.env` file +12. If you want to exclude any patch. Set comma separated patch in `.env` file or in `ENVS` in `GitHub secrets` (Recommended) in the format ```ini _EXCLUDE_PATCH= @@ -375,7 +388,7 @@ You can use any of the following methods to build. 1. **All** the patches for an app are **included** by default.
2. Revanced patches are provided as space separated, make sure you type those **-** separated here. It means a patch named _**Hey There**_ must be entered as **_hey-there_** in the above example. -12. If you want to include any universal patch. Set comma separated patch in `.env` +13. If you want to include any universal patch. Set comma separated patch in `.env` file or in `ENVS` in `GitHub secrets` (Recommended) in the format ```ini _INCLUDE_PATCH= @@ -387,7 +400,7 @@ You can use any of the following methods to build. Note - 1. Revanced patches are provided as space separated, make sure you type those **-** separated here. It means a patch named _**Hey There**_ must be entered as **_hey-there_** in the above example. -13. If you want to build a specific version or latest version. Add `version` in `.env` file +14. If you want to build a specific version or latest version. Add `version` in `.env` file or in `ENVS` in `GitHub secrets` (Recommended) in the format ```ini _VERSION= @@ -398,7 +411,7 @@ You can use any of the following methods to build. YOUTUBE_MUSIC_VERSION=X.X.X TWITTER_VERSION=latest ``` -14. If you have your personal source for apk to be downloaded. You can also provide that and tool +15. If you have your personal source for apk to be downloaded. You can also provide that and tool will not scarp links from apk sources.Add `dl` in `.env` file or in `ENVS` in `GitHub secrets` (Recommended) in the format ```ini @@ -408,7 +421,7 @@ You can use any of the following methods to build. ```ini YOUTUBE_DL=https://d.apkpure.com/b/APK/com.google.android.youtube?version=latest ``` -15. For Telegram Upload. +16. For Telegram Upload. 1. Set up a telegram channel, send a message to it and forward the message to this telegram [bot](https://t.me/username_to_id_bot) 2. Copy `id` and save it to `TELEGRAM_CHAT_ID`
@@ -422,12 +435,12 @@ You can use any of the following methods to build.
6. After Everything done successfully a part of the actions secrets of the repository may look like
-16. Configuration defined in `ENVS` in `GitHub secrets` will override the configuration in `.env` file. You can use this +17. Configuration defined in `ENVS` in `GitHub secrets` will override the configuration in `.env` file. You can use this fact to define your normal configurations in `.env` file and sometimes if you want to build something different just once. Add it in `GitHub secrets`.
-17. Sample Envs
+18. Sample Envs
-18. [Apprise](https://github.com/caronc/apprise)
+19. [Apprise](https://github.com/caronc/apprise)
We also have apprise support to upload built apk anywhere.To use apprise. Add belows envs in `.env` file or in `ENVS` in `GitHub secrets` (Recommended) in the format ```ini diff --git a/src/app.py b/src/app.py index d390b67..90b7953 100644 --- a/src/app.py +++ b/src/app.py @@ -40,6 +40,7 @@ class APP(object): self.no_of_patches: int = 0 self.keystore_name = config.env.str(f"{app_name}_KEYSTORE_FILE_NAME".upper(), config.global_keystore_name) self.archs_to_build = config.env.list(f"{app_name}_ARCHS_TO_BUILD".upper(), config.global_archs_to_build) + self.options_file = config.env.str(f"{app_name}_OPTIONS_FILE".upper(), config.global_options_file) self.download_file_name = "" self.download_dl = config.env.str(f"{app_name}_DL".upper(), "") self.download_patch_resources(config) diff --git a/src/config.py b/src/config.py index 4a3dfa9..6b9646a 100644 --- a/src/config.py +++ b/src/config.py @@ -30,6 +30,7 @@ class RevancedConfig(object): self.global_patches_json_dl = env.str("GLOBAL_PATCHES_JSON_DL", default_patches_json) self.global_integrations_dl = env.str("GLOBAL_INTEGRATIONS_DL", default_integrations) self.global_keystore_name = env.str("GLOBAL_KEYSTORE_FILE_NAME", "revanced.keystore") + self.global_options_file = env.str("GLOBAL_OPTIONS_FILE", "options.json") self.global_archs_to_build = env.list("GLOBAL_ARCHS_TO_BUILD", []) self.extra_download_files: list[str] = env.list("EXTRA_FILES", []) self.apk_editor = "apkeditor-output.jar" diff --git a/src/parser.py b/src/parser.py index 2188c71..aad0f1b 100644 --- a/src/parser.py +++ b/src/parser.py @@ -185,7 +185,7 @@ class Parser(object): self.KEYSTORE_ARG, app.keystore_name, self.OPTIONS_ARG, - "options.json", + app.options_file, ] if app.experiment: logger.debug("Using experimental features")