Ability to provide app dl (#303)

This commit is contained in:
Nikhil Badyal
2023-08-23 20:51:50 +05:30
committed by GitHub
parent 08747af95f
commit ecd80dffda
2 changed files with 31 additions and 12 deletions
+15 -4
View File
@@ -152,6 +152,7 @@ You can use any of the following methods 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*_DL](#app-dl) | | |
`**` - By default all patches for a given app are included.<br>
`**` - Can be used to included universal patch.
@@ -331,7 +332,17 @@ You can use any of the following methods to build.
YOUTUBE_MUSIC_VERSION=X.X.X
TWITTER_VERSION=latest
```
14. <a id="telegram-support"></a>For Telegram Upload.
14. <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
the format
```ini
<APP_NAME>_DL=<direct-app-download>
```
Example:
```ini
YOUTUBE_DL=https://d.apkpure.com/b/APK/com.google.android.youtube?version=latest
```
15. <a id="telegram-support"></a>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`<br>
@@ -345,12 +356,12 @@ You can use any of the following methods to build.
<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>
<img src="https://i.imgur.com/Cjifz1M.png" width="400">
15. Configuration defined in `ENVS` in `GitHub secrets` will override the configuration in `.env` file. You can use this
16. 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`.<br>
16. Sample Envs<br>
17. Sample Envs<br>
<img src="https://i.imgur.com/FxOtiGs.png" width="600" style="left">
17. Make sure your Action has write access. If not click
18. Make sure your Action has write access. If not click
[here](https://github.com/nikhilbadyal/docker-py-revanced/settings/actions).
In the bottom give read and write access to Actions.
<img src="https://i.imgur.com/STSv2D3.png" width="400">
+16 -8
View File
@@ -8,6 +8,7 @@ from typing import Dict, List
from loguru import logger
from src.config import RevancedConfig
from src.downloader.download import Downloader
from src.exceptions import PatchingFailed
from src.utils import slugify
@@ -44,20 +45,27 @@ class APP(object):
f"{app_name}_ARCHS_TO_BUILD".upper(), config.global_archs_to_build
)
self.download_file_name = ""
self.download_dl = ""
self.download_dl = config.env.str(f"{app_name}_DL".upper(), "")
self.download_patch_resources(config)
def download_apk_for_patching(self, config: RevancedConfig) -> None:
"""Download apk to be patched."""
from src.downloader.factory import DownloaderFactory
logger.info("Downloading apk to be patched")
downloader = DownloaderFactory.create_downloader(
app=self.app_name, config=config
)
self.download_file_name, self.download_dl = downloader.download(
self.app_version, self.app_name
)
if self.download_dl:
logger.info("Downloading apk to be patched using provided dl")
self.download_file_name = f"{self.app_name}.apk"
Downloader(config).direct_download(
self.download_dl, self.download_file_name
)
else:
logger.info("Downloading apk to be patched by scrapping")
downloader = DownloaderFactory.create_downloader(
app=self.app_name, config=config
)
self.download_file_name, self.download_dl = downloader.download(
self.app_version, self.app_name
)
def get_output_file_name(self) -> str:
"""The function returns a string representing the output file name for