Add support for downloading HDiffPatch
This commit is contained in:
@ -6,11 +6,18 @@ from pathlib import Path
|
||||
import shutil
|
||||
import aiohttp
|
||||
import asyncio
|
||||
from worthless import linux
|
||||
from worthless import constants
|
||||
from worthless.launcher import Launcher
|
||||
from worthless.installer import Installer
|
||||
|
||||
match platform.system():
|
||||
case "Linux":
|
||||
from worthless import linux
|
||||
case "Windows":
|
||||
pass # TODO
|
||||
case "Darwin":
|
||||
pass # TODO
|
||||
|
||||
NO_XDELTA3_MODULE = False
|
||||
try:
|
||||
import xdelta3
|
||||
@ -104,7 +111,7 @@ class Patcher:
|
||||
"""
|
||||
await self._download_repo()
|
||||
|
||||
async def is_telemetry_blocked(self):
|
||||
async def is_telemetry_blocked(self, optional=False):
|
||||
"""
|
||||
Check if the telemetry is blocked.
|
||||
|
||||
@ -122,10 +129,18 @@ class Patcher:
|
||||
continue
|
||||
else:
|
||||
unblocked_list.append(url)
|
||||
if optional:
|
||||
for url in constants.TELEMETRY_OPTIONAL_URL_LIST:
|
||||
try:
|
||||
await session.get("https://" + url)
|
||||
except (aiohttp.ClientResponseError, aiohttp.ClientConnectorError):
|
||||
continue
|
||||
else:
|
||||
unblocked_list.append(url)
|
||||
return None if unblocked_list == [] else unblocked_list
|
||||
|
||||
async def block_telemetry(self):
|
||||
telemetry = await self.is_telemetry_blocked()
|
||||
async def block_telemetry(self, optional=False):
|
||||
telemetry = await self.is_telemetry_blocked(optional)
|
||||
if not telemetry:
|
||||
raise ValueError("All telemetry are blocked")
|
||||
telemetry_hosts = "\n"
|
||||
|
||||
Reference in New Issue
Block a user