From 6b4f19c28f84477f84784c1ba47d871153e64250 Mon Sep 17 00:00:00 2001 From: Naruse <71993948+DevilProMT@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:20:54 +0800 Subject: [PATCH] feat: Update to support version 7.9.0 OS --- Config.json | 168 +++++++++++++++++- sdk_server/controllers/dispatch_controller.py | 87 ++------- utils/config.py | 15 +- 3 files changed, 187 insertions(+), 83 deletions(-) diff --git a/Config.json b/Config.json index 2856285..cba7d20 100644 --- a/Config.json +++ b/Config.json @@ -12,8 +12,168 @@ "RegionName": "MikuBH3", "UseLocalCache": false, "AESKeys": { - "7.9.0_gf_pc": "36 31 65 37 64 33 65 66 33 32 30 63 31 35 66 66 61 64 37 61 66 32 31 34 61 64 65 64 32 34 33 38", - "7.8.0_os_pc": "64 34 32 33 30 30 31 62 32 36 38 34 62 33 62 30 61 33 30 38 66 37 65 35 63 30 61 38 66 33 65 32" + "7.9.0": "36 31 65 37 64 33 65 66 33 32 30 63 31 35 66 66 61 64 37 61 66 32 31 34 61 64 65 64 32 34 33 38", + "7.8.0": "64 34 32 33 30 30 31 62 32 36 38 34 62 33 62 30 61 33 30 38 66 37 65 35 63 30 61 38 66 33 65 32" }, - "EnableDispatchEncryption": true -} \ No newline at end of file + "EnableDispatchEncryption": true, + "HotpatchConfig": { + "7.9.0_os_pc": { + "ext": { + "64252704": "0", + "98533854": "0", + "156881973": "GameEntry/EVA/StartLoading_Model", + "203732861": "1", + "234319255": "0", + "570959929": [ + "autopatchos.honkaiimpact3.com/com.miHoYo.bh3oversea", + "bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea" + ], + "763305743": "1", + "935684753": [ + "autopatchos.honkaiimpact3.com/com.miHoYo.bh3oversea", + "bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea" + ], + "1025006418": "2", + "1058891250": "1", + "1245473982": "1", + "1297410903": "10485760", + "1344653749": "0", + "1360176971": "1", + "1501014376": "1", + "1744250417": "1", + "1745366296": "0", + "1839631329": "1", + "1851523843": "0", + "1866171907": "1", + "1887219073": "1" + }, + "manifest": { + "Asb": { + "android": { + "enable_time": 0, + "revision": "7.9.0.0", + "suffix": "d5a3bd0dd81edaa3fa2d3e436c1bce0d" + }, + "iphone": { + "enable_time": 0, + "revision": "7.9.0.0", + "suffix": "fe6dd877612491a7508af7c584a88a17" + }, + "pc": { + "enable_time": 0, + "revision": "7.9.0.0", + "suffix": "5e57f6090867ca698d288105495cb2c1" + } + }, + "AsbPreDownload": { + "android": { + "enable_time": 1732593600, + "encrypt_key": "298FC85F5988308213B6462562A3B095", + "revision": "7.9.0.0", + "suffix": "d5a3bd0dd81edaa3fa2d3e436c1bce0d" + }, + "iphone": { + "enable_time": 1732593600, + "encrypt_key": "298FC85F5988308213B6462562A3B095", + "revision": "7.9.0.0", + "suffix": "fe6dd877612491a7508af7c584a88a17" + } + }, + "Audio": { + "platform": { + "Android": "manifest_76417dab7a9e4362eba7fbe8c4bad310.m", + "Windows": "manifest_97e3dab51f6259fe373ed73d4ea86bd3.m", + "iOS": "manifest_72b69e05e5541fa7c55a64a21b29edf3.m" + }, + "revision": 730530 + }, + "AudioPreDownload": { + "enable_time": 1732593600, + "platform": { + "Android": "manifest_76417dab7a9e4362eba7fbe8c4bad310.m", + "Windows": "manifest_97e3dab51f6259fe373ed73d4ea86bd3.m", + "iOS": "manifest_72b69e05e5541fa7c55a64a21b29edf3.m" + }, + "revision": 730530 + }, + "VideoEncrypt": { + "filename": "product_os_video_encrypt_2ab2e22bd8f7eda7c753618d081d3f01" + } + } + }, + "7.9.0_gf_pc": { + "ext": { + "203732861": "1", + "308332524": "1", + "763305743": "1", + "1058891250": "1", + "1095990871": "1", + "1245473982": "1", + "1324767488": "前往米游社", + "1344653749": "0", + "1360176971": "1", + "1501014376": "1", + "1744250417": "1", + "1745366296": "2", + "1747909614": "https://m.bbs.mihoyo.com/bh3ToBBS.html", + "1794460900": "Recommend", + "1839631329": "1", + "1887219073": "1", + "2110930505": "1" + }, + "manifest": { + "Asb": { + "android": { + "enable_time": 0, + "revision": "7.9.0.7", + "suffix": "ab2679bd532f9135b8aab5975206dfb0" + }, + "iphone": { + "enable_time": 0, + "revision": "7.9.0.7", + "suffix": "c0ae76925b8dca4e62cb814877ba455a" + }, + "pc": { + "enable_time": 0, + "revision": "7.9.0.7", + "suffix": "54ab3753430c9ad4a9ddae16eb8c386a" + } + }, + "AsbPreDownload": { + "android": { + "enable_time": 1730174400, + "encrypt_key": "298FC85F5988308213B6462562A3B095", + "revision": "7.9.0.0", + "suffix": "874af0171cec4d992537ed029906bc6e" + }, + "iphone": { + "enable_time": 1730174400, + "encrypt_key": "298FC85F5988308213B6462562A3B095", + "revision": "7.9.0.0", + "suffix": "166391e65f2d4de973b1cd87d583a230" + } + }, + "Audio": { + "platform": { + "Android": "manifest_cb84c3bd719a8c06fa63b9e0a4092d8d.m", + "Windows": "manifest_8f7a55b834a47a6be376ec64739042a7.m", + "iOS": "manifest_9191d8f30c3634f9fc723d6fd1a75dc0.m" + }, + "revision": 727721 + }, + "AudioPreDownload": { + "enable_time": 1730174400, + "platform": { + "Android": "manifest_74bc85237052ae2eba6a1937f90aa39e.m", + "Windows": "manifest_73a4b3611cff2b3bdd20405b8528e8f9.m", + "iOS": "manifest_5e3020c93eb651f8c8c25a87aea860f5.m" + }, + "revision": 725668 + }, + "VideoEncrypt": { + "filename": "product_video_encrypt_b8619f8ad0069903815286b5c59c089c" + } + } + } + } +} diff --git a/sdk_server/controllers/dispatch_controller.py b/sdk_server/controllers/dispatch_controller.py index 8feaa05..02d4279 100644 --- a/sdk_server/controllers/dispatch_controller.py +++ b/sdk_server/controllers/dispatch_controller.py @@ -26,7 +26,7 @@ def query_dispatch(): if Config.EnableDispatchEncryption: return Response( - encrypt_ecb(Config.AESKeys.get(version), json.dumps(response_data)), + encrypt_ecb(Config.get_aes_key(version=version), json.dumps(response_data)), mimetype="text/plain", ) @@ -36,7 +36,7 @@ def query_dispatch(): @dispatch_blueprint.route("/query_gateway", methods=["GET"]) def query_gateway(): version = request.args.get("version") - gameserver = {"ip": Config.GameServer.IP, "port": Config.GameServer.Port} + server = {"ip": Config.GameServer.IP, "port": Config.GameServer.Port} response_data = { "account_url": f"http://{Config.GameServer.IP}/account", @@ -45,78 +45,11 @@ def query_gateway(): # "ex_audio_and_video_url_list": get_ex_audio_and_video_url_list(version), "ex_resource_url_list": get_ex_resource_url_list(version), # TODO: Revisit this - "ext": { - "1058891250": "1", - "1095990871": "1", - "1245473982": "1", - "1344653749": "0", - "1360176971": "1", - "1501014376": "1", - "1744250417": "1", - "1745366296": "2", - "1839631329": "1", - "1887219073": "1", - "203732861": "1", - "2110930505": "1", - "308332524": "1", - "763305743": "1", - }, - "gameserver": gameserver, - "gateway": gameserver, + "ext": Config.get_hotpatch_ext(version), + "gameserver": server, + "gateway": server, "is_data_ready": True, - "manifest": { - "Asb": { - "android": { - "enable_time": 0.0, - "revision": "7.9.0.3", - "suffix": "32e095538f496ce873b84f7d800ad9fd", - }, - "iphone": { - "enable_time": 0.0, - "revision": "7.9.0.3", - "suffix": "899786bb3ad18295da593e3a930e4d7c", - }, - "pc": { - "enable_time": 0.0, - "revision": "7.9.0.3", - "suffix": "6bee17b8b2ffec47182c8c3c9aed21a9", - }, - }, - "AsbPreDownload": { - "android": { - "enable_time": 1730174400.0, - "encrypt_key": "298FC85F5988308213B6462562A3B095", - "revision": "7.9.0.0", - "suffix": "874af0171cec4d992537ed029906bc6e", - }, - "iphone": { - "enable_time": 1730174400.0, - "encrypt_key": "298FC85F5988308213B6462562A3B095", - "revision": "7.9.0.0", - "suffix": "166391e65f2d4de973b1cd87d583a230", - }, - }, - "Audio": { - "platform": { - "Android": "manifest_2291f5be319191f1c1473e1c8abdd325.m", - "Windows": "manifest_b12c79d9ec59454e8695e049a4b2aa90.m", - "iOS": "manifest_6b1113eeaf6cd9e8b149efeeff64e4a9.m", - }, - "revision": 727034, - }, - "AudioPreDownload": { - "enable_time": 1730174400, - "platform": { - "Android": "manifest_74bc85237052ae2eba6a1937f90aa39e.m", - "Windows": "manifest_73a4b3611cff2b3bdd20405b8528e8f9.m", - "iOS": "manifest_5e3020c93eb651f8c8c25a87aea860f5.m", - }, - "revision": 725668, - }, - "VideoEncrypt": { - "filename": "product_video_encrypt_0d89026956cc2bdd5714d4515f1d5df5" - }, - }, + "manifest": Config.get_hotpatch_manifest(version), "msg": "", "oaserver_url": f"http://{Config.GameServer.IP}/oaserver", "region_name": Config.RegionName, @@ -133,7 +66,7 @@ def query_gateway(): if Config.EnableDispatchEncryption: return Response( - encrypt_ecb(Config.AESKeys.get(version), json.dumps(response_data)), + encrypt_ecb(Config.get_aes_key(version), json.dumps(response_data)), mimetype="text/plain", ) @@ -184,8 +117,8 @@ def get_asset_bundle_url_list(version): # Return URLs based on the OS type if value == "os": return [ + "https://autopatchos.honkaiimpact3.com/asset_bundle/overseas01/1.1", "https://bundle-aliyun-os.honkaiimpact3.com/asset_bundle/overseas01/1.1", - "https://hk-bundle-os-mihayo.akamaized.net/asset_bundle/overseas01/1.1", ] elif value == "gf": if "beta" in version: @@ -221,8 +154,8 @@ def get_ex_audio_and_video_url_list(version): # Return URLs based on the OS type if value == "os": return [ + "autopatchos.honkaiimpact3.com/com.miHoYo.bh3oversea", "bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea", - "hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea", ] elif value == "gf": if "beta" in version: @@ -259,8 +192,8 @@ def get_ex_resource_url_list(version): # Return URLs based on the OS type if value == "os": return [ + "autopatchos.honkaiimpact3.com/com.miHoYo.bh3oversea", "bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea", - "hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea", ] elif value == "gf": if "beta" in version: diff --git a/utils/config.py b/utils/config.py index 2071d48..69b578e 100644 --- a/utils/config.py +++ b/utils/config.py @@ -20,6 +20,7 @@ class ConfigData: UseLocalCache: bool AESKeys: dict[str, str] EnableDispatchEncryption: bool + HotpatchConfig: dict[str, dict] def write_default_config(): config = ConfigData( @@ -31,9 +32,10 @@ class ConfigData: UseLocalCache=False, EnableDispatchEncryption=True, AESKeys={ - "7.9.0_gf_pc": "36 31 65 37 64 33 65 66 33 32 30 63 31 35 66 66 61 64 37 61 66 32 31 34 61 64 65 64 32 34 33 38", - "7.8.0_os_pc": "64 34 32 33 30 30 31 62 32 36 38 34 62 33 62 30 61 33 30 38 66 37 65 35 63 30 61 38 66 33 65 32", + "7.9.0": "36 31 65 37 64 33 65 66 33 32 30 63 31 35 66 66 61 64 37 61 66 32 31 34 61 64 65 64 32 34 33 38", + "7.8.0": "64 34 32 33 30 30 31 62 32 36 38 34 62 33 62 30 61 33 30 38 66 37 65 35 63 30 61 38 66 33 65 32" }, + HotpatchConfig=dict(), ) with open("Config.json", "w") as f: f.write(json.dumps(asdict(config), indent=2)) @@ -50,5 +52,14 @@ class ConfigData: except Exception: return ConfigData.write_default_config() + def get_aes_key(self, version: str): + return self.AESKeys[version.split("_")[0]] + + def get_hotpatch_manifest(self, version: str): + return self.HotpatchConfig.get(version, dict()).get("manifest", dict()) + + def get_hotpatch_ext(self, version: str): + return self.HotpatchConfig.get(version, dict()).get("ext", dict()) + Config = ConfigData.load()