patcher: add option to specify predefined patch url
This option adds patch_provider to Patcher class, currently you can choose either y0soro or Krock (by default it uses y0soro for latest 3.0.0 patch)
This commit is contained in:
parent
8449c104d9
commit
184e96fa2d
2
setup.py
2
setup.py
@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text()
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='worthless',
|
name='worthless',
|
||||||
version='2.2.0-2',
|
version='2.2.1',
|
||||||
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
|
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
|
||||||
url='https://git.froggi.es/tretrauit/worthless-launcher',
|
url='https://git.froggi.es/tretrauit/worthless-launcher',
|
||||||
license='MIT License',
|
license='MIT License',
|
||||||
|
@ -7,7 +7,10 @@ APPDIRS=AppDirs(APP_NAME, APP_AUTHOR)
|
|||||||
LAUNCHER_API_URL_OS = "https://sdk-os-static.hoyoverse.com/hk4e_global/mdk/launcher/api"
|
LAUNCHER_API_URL_OS = "https://sdk-os-static.hoyoverse.com/hk4e_global/mdk/launcher/api"
|
||||||
LAUNCHER_API_URL_CN = "https://sdk-static.mihoyo.com/hk4e_cn/mdk/launcher/api"
|
LAUNCHER_API_URL_CN = "https://sdk-static.mihoyo.com/hk4e_cn/mdk/launcher/api"
|
||||||
HDIFFPATCH_GIT_URL="https://github.com/sisong/HDiffPatch"
|
HDIFFPATCH_GIT_URL="https://github.com/sisong/HDiffPatch"
|
||||||
PATCH_GIT_URL = "https://notabug.org/y0soro/dawn"
|
PATCH_LIST = {
|
||||||
|
"Krock": "https://notabug.org/Krock/dawn",
|
||||||
|
"y0soro": "https://notabug.org/y0soro/dawn"
|
||||||
|
}
|
||||||
TELEMETRY_URL_LIST = [
|
TELEMETRY_URL_LIST = [
|
||||||
"log-upload-os.mihoyo.com",
|
"log-upload-os.mihoyo.com",
|
||||||
"log-upload-eur.mihoyo.com",
|
"log-upload-eur.mihoyo.com",
|
||||||
|
@ -29,10 +29,12 @@ except ImportError:
|
|||||||
|
|
||||||
class Patcher:
|
class Patcher:
|
||||||
def __init__(self, gamedir: Path | AsyncPath | str = AsyncPath.cwd(), data_dir: str | Path | AsyncPath = None,
|
def __init__(self, gamedir: Path | AsyncPath | str = AsyncPath.cwd(), data_dir: str | Path | AsyncPath = None,
|
||||||
patch_url: str = None, overseas=True):
|
patch_url: str = None, overseas=True, patch_provider="y0soro"):
|
||||||
if isinstance(gamedir, str | Path):
|
if isinstance(gamedir, str | Path):
|
||||||
gamedir = AsyncPath(gamedir)
|
gamedir = AsyncPath(gamedir)
|
||||||
self._gamedir = gamedir
|
self._gamedir = gamedir
|
||||||
|
if not patch_url:
|
||||||
|
patch_url = constants.PATCH_LIST[patch_provider].replace("http://", "https://")
|
||||||
self._patch_url = (patch_url if patch_url else constants.PATCH_GIT_URL).replace('http://', 'https://')
|
self._patch_url = (patch_url if patch_url else constants.PATCH_GIT_URL).replace('http://', 'https://')
|
||||||
if not data_dir:
|
if not data_dir:
|
||||||
self._appdirs = constants.APPDIRS
|
self._appdirs = constants.APPDIRS
|
||||||
@ -309,3 +311,4 @@ class Patcher:
|
|||||||
|
|
||||||
async def clear_cache(self):
|
async def clear_cache(self):
|
||||||
await asyncio.to_thread(shutil.rmtree, self._temp_path, ignore_errors=True)
|
await asyncio.to_thread(shutil.rmtree, self._temp_path, ignore_errors=True)
|
||||||
|
await asyncio.to_thread(shutil.rmtree, self._patch_path, ignore_errors=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user