Ability to provide options file per app

This commit is contained in:
Nikhil Badyal
2024-04-04 15:03:46 +05:30
committed by Nikhil Badyal
parent c20407466c
commit c496931f3f
4 changed files with 37 additions and 22 deletions
+34 -21
View File
@@ -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_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_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 | <br/>[Builder's v3(old) 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 | <br/>[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 | | [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 | | REDDIT_CLIENT_ID | Reddit Client ID to patch reddit apps | None |
| VT_API_KEY | Virus Total Key to scan APKs | 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 ```dotenv
YOUTUBE_OLD_KEY=False YOUTUBE_OLD_KEY=False
``` ```
9. <a id="global-archs-to-build"></a>You can build only for a particular arch in order to get smaller apk files.This 9. <a id="global-options-file"></a>If you don't want to use default options.json file. You can provide your own by
can be done with by adding comma separated `ARCHS_TO_BUILD` in `ENVS` in `GitHub secrets` (Recommended) in the placing it inside `apks` folder. And adding the name of `options-file` in `.env` file or in `ENVS` in `GitHub
format. secrets` (Recommended) in the format
```dotenv ```dotenv
GLOABAL_ARCHS_TO_BUILD=arm64-v8a,armeabi-v7a GLOBAL_OPTIONS_FILE=my_options.json
``` ```
Tool also support configuring at app level.<br> Tool also support providing secret key at app level. You can sign A app with X key while signing B with Y
key.<br>
Example:
```dotenv
YOUTUBE_OPTIONS_FILE=my_cool_yt_options.json
```
10. <a id="global-archs-to-build"></a>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.<br>
Example: Example:
```dotenv ```dotenv
YOUTUBE_ARCHS_TO_BUILD=arm64-v8a,armeabi-v7a YOUTUBE_ARCHS_TO_BUILD=arm64-v8a,armeabi-v7a
``` ```
*Note* - *Note* -
1. Possible values are: `armeabi-v7a`,`x86`,`x86_64`,`arm64-v8a` 1. Possible values are: `armeabi-v7a`,`x86`,`x86_64`,`arm64-v8a`
2. Make sure the patching resource(CLI) support this feature. 2. Make sure the patching resource(CLI) support this feature.
10. <a id="extra-files"></a>If you want to include any extra file to the Github upload. Set comma arguments 11. <a id="extra-files"></a>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 in `.env` file or in `ENVS` in `GitHub secrets` (Recommended) in the format
```ini ```ini
EXTRA_FILES=<url>@<appName>.apk EXTRA_FILES=<url>@<appName>.apk
@@ -361,7 +374,7 @@ You can use any of the following methods to build.
```dotenv ```dotenv
EXTRA_FILES=https://github.com/inotia00/mMicroG/releases/latest@mmicrog.apk,https://github.com/revanced/revanced-integrations@integrations.apk EXTRA_FILES=https://github.com/inotia00/mMicroG/releases/latest@mmicrog.apk,https://github.com/revanced/revanced-integrations@integrations.apk
``` ```
11. <a id="custom-exclude-patching"></a>If you want to exclude any patch. Set comma separated patch in `.env` file 12. <a id="custom-exclude-patching"></a>If you want to exclude any patch. Set comma separated patch in `.env` file
or in `ENVS` in `GitHub secrets` (Recommended) in the format or in `ENVS` in `GitHub secrets` (Recommended) in the format
```ini ```ini
<APP_NAME>_EXCLUDE_PATCH=<PATCH_TO_EXCLUDE-1,PATCH_TO_EXCLUDE-2> <APP_NAME>_EXCLUDE_PATCH=<PATCH_TO_EXCLUDE-1,PATCH_TO_EXCLUDE-2>
@@ -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.<br> 1. **All** the patches for an app are **included** by default.<br>
2. Revanced patches are provided as space separated, make sure you type those **-** separated here. 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. It means a patch named _**Hey There**_ must be entered as **_hey-there_** in the above example.
12. <a id="custom-include-patching"></a>If you want to include any universal patch. Set comma separated patch in `.env` 13. <a id="custom-include-patching"></a>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 file or in `ENVS` in `GitHub secrets` (Recommended) in the format
```ini ```ini
<APP_NAME>_INCLUDE_PATCH=<PATCH_TO_EXCLUDE-1,PATCH_TO_EXCLUDE-2> <APP_NAME>_INCLUDE_PATCH=<PATCH_TO_EXCLUDE-1,PATCH_TO_EXCLUDE-2>
@@ -387,7 +400,7 @@ You can use any of the following methods to build.
Note - Note -
1. Revanced patches are provided as space separated, make sure you type those **-** separated here. 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. It means a patch named _**Hey There**_ must be entered as **_hey-there_** in the above example.
13. <a id="app-version"></a>If you want to build a specific version or latest version. Add `version` in `.env` file 14. <a id="app-version"></a>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 or in `ENVS` in `GitHub secrets` (Recommended) in the format
```ini ```ini
<APP_NAME>_VERSION=<VERSION> <APP_NAME>_VERSION=<VERSION>
@@ -398,7 +411,7 @@ You can use any of the following methods to build.
YOUTUBE_MUSIC_VERSION=X.X.X YOUTUBE_MUSIC_VERSION=X.X.X
TWITTER_VERSION=latest TWITTER_VERSION=latest
``` ```
14. <a id="app-dl"></a>If you have your personal source for apk to be downloaded. You can also provide that and tool 15. <a id="app-dl"></a>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 will not scarp links from apk sources.Add `dl` in `.env` file or in `ENVS` in `GitHub secrets` (Recommended) in
the format the format
```ini ```ini
@@ -408,7 +421,7 @@ You can use any of the following methods to build.
```ini ```ini
YOUTUBE_DL=https://d.apkpure.com/b/APK/com.google.android.youtube?version=latest YOUTUBE_DL=https://d.apkpure.com/b/APK/com.google.android.youtube?version=latest
``` ```
15. <a id="telegram-support"></a>For Telegram Upload. 16. <a id="telegram-support"></a>For Telegram Upload.
1. Set up a telegram channel, send a message to it and forward the message to 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) this telegram [bot](https://t.me/username_to_id_bot)
2. Copy `id` and save it to `TELEGRAM_CHAT_ID`<br> 2. Copy `id` and save it to `TELEGRAM_CHAT_ID`<br>
@@ -422,12 +435,12 @@ You can use any of the following methods to build.
<img src="https://i.imgur.com/7n5k1mp.png" width="300" style="left"><br> <img src="https://i.imgur.com/7n5k1mp.png" width="300" style="left"><br>
6. After Everything done successfully a part of the actions secrets of the repository may look like<br> 6. After Everything done successfully a part of the actions secrets of the repository may look like<br>
<img src="https://i.imgur.com/Cjifz1M.png" width="400"> <img src="https://i.imgur.com/Cjifz1M.png" width="400">
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 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`.<br> once. Add it in `GitHub secrets`.<br>
17. Sample Envs<br> 18. Sample Envs<br>
<img src="https://i.imgur.com/FxOtiGs.png" width="600" style="left"> <img src="https://i.imgur.com/FxOtiGs.png" width="600" style="left">
18. <a id="apprise"></a>[Apprise](https://github.com/caronc/apprise)<br> 19. <a id="apprise"></a>[Apprise](https://github.com/caronc/apprise)<br>
We also have apprise support to upload built apk anywhere.To use apprise. Add belows envs in `.env` file 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 or in `ENVS` in `GitHub secrets` (Recommended) in the format
```ini ```ini
+1
View File
@@ -40,6 +40,7 @@ class APP(object):
self.no_of_patches: int = 0 self.no_of_patches: int = 0
self.keystore_name = config.env.str(f"{app_name}_KEYSTORE_FILE_NAME".upper(), config.global_keystore_name) 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.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_file_name = ""
self.download_dl = config.env.str(f"{app_name}_DL".upper(), "") self.download_dl = config.env.str(f"{app_name}_DL".upper(), "")
self.download_patch_resources(config) self.download_patch_resources(config)
+1
View File
@@ -30,6 +30,7 @@ class RevancedConfig(object):
self.global_patches_json_dl = env.str("GLOBAL_PATCHES_JSON_DL", default_patches_json) 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_integrations_dl = env.str("GLOBAL_INTEGRATIONS_DL", default_integrations)
self.global_keystore_name = env.str("GLOBAL_KEYSTORE_FILE_NAME", "revanced.keystore") 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.global_archs_to_build = env.list("GLOBAL_ARCHS_TO_BUILD", [])
self.extra_download_files: list[str] = env.list("EXTRA_FILES", []) self.extra_download_files: list[str] = env.list("EXTRA_FILES", [])
self.apk_editor = "apkeditor-output.jar" self.apk_editor = "apkeditor-output.jar"
+1 -1
View File
@@ -185,7 +185,7 @@ class Parser(object):
self.KEYSTORE_ARG, self.KEYSTORE_ARG,
app.keystore_name, app.keystore_name,
self.OPTIONS_ARG, self.OPTIONS_ARG,
"options.json", app.options_file,
] ]
if app.experiment: if app.experiment:
logger.debug("Using experimental features") logger.debug("Using experimental features")