mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
✨ Use Dict for storing patches (#304)
This commit is contained in:
@@ -6,6 +6,7 @@ from urllib.parse import urlparse
|
||||
import requests
|
||||
from loguru import logger
|
||||
|
||||
from src.app import APP
|
||||
from src.config import RevancedConfig
|
||||
from src.downloader.download import Downloader
|
||||
from src.exceptions import DownloadFailure
|
||||
@@ -15,17 +16,17 @@ from src.utils import handle_request_response, update_changelog
|
||||
class Github(Downloader):
|
||||
"""Files downloader."""
|
||||
|
||||
def latest_version(self, app: str, **kwargs: Dict[str, str]) -> Tuple[str, str]:
|
||||
def latest_version(self, app: APP, **kwargs: Dict[str, str]) -> Tuple[str, str]:
|
||||
"""Function to download files from GitHub repositories.
|
||||
|
||||
:param app: App to download
|
||||
"""
|
||||
logger.debug(f"Trying to download {app} from github")
|
||||
if self.config.dry_run or app == "microg":
|
||||
logger.debug(f"Trying to download {app.app_name} from github")
|
||||
if self.config.dry_run:
|
||||
logger.debug(
|
||||
f"Skipping download of {app}. File already exists or dry running."
|
||||
f"Skipping download of {app.app_name}. File already exists or dry running."
|
||||
)
|
||||
return app, f"local://{app}"
|
||||
return app.app_name, f"local://{app.app_name}"
|
||||
owner = str(kwargs["owner"])
|
||||
repo_name = str(kwargs["name"])
|
||||
repo_url = f"https://api.github.com/repos/{owner}/{repo_name}/releases/latest"
|
||||
@@ -42,8 +43,8 @@ class Github(Downloader):
|
||||
else:
|
||||
download_url = response.json()["assets"][0]["browser_download_url"]
|
||||
update_changelog(f"{owner}/{repo_name}", response.json())
|
||||
self._download(download_url, file_name=app)
|
||||
return app, download_url
|
||||
self._download(download_url, file_name=app.app_name)
|
||||
return app.app_name, download_url
|
||||
|
||||
@staticmethod
|
||||
def _extract_repo_owner_and_tag(url: str) -> Tuple[str, str, str]:
|
||||
|
||||
Reference in New Issue
Block a user