mirror of
https://github.com/MikuLeaks/KianaBH3.git
synced 2025-12-14 05:44:34 +01:00
Initial commit
This commit is contained in:
121
sdk_server/controllers/account_controller.py
Normal file
121
sdk_server/controllers/account_controller.py
Normal file
@@ -0,0 +1,121 @@
|
||||
import json
|
||||
from flask import Blueprint, request, jsonify
|
||||
from sdk_server.models.risky_check import RiskyCheck,DataScheme
|
||||
from sdk_server.models.granter_login_body import GranterLoginBody
|
||||
|
||||
account_blueprint = Blueprint('account', __name__)
|
||||
|
||||
@account_blueprint.route('/account/risky/api/check', methods=['POST'])
|
||||
def check_risky():
|
||||
return jsonify({
|
||||
"retcode":0,
|
||||
"message":"",
|
||||
"data":{
|
||||
"id":"",
|
||||
"action":"ACTION_NONE",
|
||||
"geetest":None
|
||||
}
|
||||
})
|
||||
|
||||
@account_blueprint.route('/<game_biz>/combo/granter/login/v2/login', methods=['POST'])
|
||||
def granter_login(game_biz):
|
||||
body = request.json
|
||||
granter_login_body = GranterLoginBody(**body)
|
||||
|
||||
granter_login_body_data = json.loads(granter_login_body.data)
|
||||
|
||||
return jsonify({
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"combo_id": "0",
|
||||
"open_id": granter_login_body_data['uid'],
|
||||
"combo_token": granter_login_body_data['token'],
|
||||
"data": {"guest": granter_login_body_data['guest']},
|
||||
"heartbeat": False,
|
||||
"account_type": 1
|
||||
}
|
||||
})
|
||||
|
||||
@account_blueprint.route('/<game_biz>/mdk/shield/api/verify', methods=['POST'])
|
||||
def verify_shield(game_biz):
|
||||
shield_login_response = {
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"account": {
|
||||
"uid": "1337",
|
||||
"name": "Miku",
|
||||
"email": "",
|
||||
"mobile": "",
|
||||
"is_email_verify": "0",
|
||||
"realname": "",
|
||||
"identity_card": "",
|
||||
"token": "12931313131",
|
||||
"safe_mobile": "",
|
||||
"facebook_name": "",
|
||||
"google_name": "",
|
||||
"twitter_name": "",
|
||||
"game_center_name": "",
|
||||
"apple_name": "",
|
||||
"sony_name": "",
|
||||
"tap_name": "",
|
||||
"country": "SG",
|
||||
"reactivate_ticket": "",
|
||||
"area_code": "**",
|
||||
"device_grant_ticket": "",
|
||||
"steam_name": "",
|
||||
"unmasked_email": "",
|
||||
"unmasked_email_type": 0
|
||||
},
|
||||
"device_grant_required": False,
|
||||
"safe_mobile_required": False,
|
||||
"realperson_required": False,
|
||||
"reactivate_required": False,
|
||||
"realname_operation": "None"
|
||||
}
|
||||
}
|
||||
|
||||
return jsonify(shield_login_response)
|
||||
|
||||
@account_blueprint.route('/<game_biz>/mdk/shield/api/login', methods=['POST'])
|
||||
def shield_login(game_biz):
|
||||
|
||||
shield_login_response = {
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"account": {
|
||||
"uid": "1337",
|
||||
"name": "Miku",
|
||||
"email": "",
|
||||
"mobile": "",
|
||||
"is_email_verify": "0",
|
||||
"realname": "",
|
||||
"identity_card": "",
|
||||
"token": "12931313131",
|
||||
"safe_mobile": "",
|
||||
"facebook_name": "",
|
||||
"google_name": "",
|
||||
"twitter_name": "",
|
||||
"game_center_name": "",
|
||||
"apple_name": "",
|
||||
"sony_name": "",
|
||||
"tap_name": "",
|
||||
"country": "SG",
|
||||
"reactivate_ticket": "",
|
||||
"area_code": "**",
|
||||
"device_grant_ticket": "",
|
||||
"steam_name": "",
|
||||
"unmasked_email": "",
|
||||
"unmasked_email_type": 0
|
||||
},
|
||||
"device_grant_required": False,
|
||||
"safe_mobile_required": False,
|
||||
"realperson_required": False,
|
||||
"reactivate_required": False,
|
||||
"realname_operation": "None"
|
||||
}
|
||||
}
|
||||
|
||||
return jsonify(shield_login_response)
|
||||
204
sdk_server/controllers/config_controller.py
Normal file
204
sdk_server/controllers/config_controller.py
Normal file
@@ -0,0 +1,204 @@
|
||||
from flask import Blueprint, jsonify, request
|
||||
import random
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
config_blueprint = Blueprint('config', __name__)
|
||||
|
||||
@config_blueprint.route('/<game_biz>/mdk/agreement/api/getAgreementInfos', methods=['GET'])
|
||||
def get_agreement_infos(game_biz):
|
||||
return jsonify({
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"marketing_agreements": []
|
||||
}
|
||||
})
|
||||
|
||||
@config_blueprint.route('/data_abtest_api/config/experiment/list', methods=['POST'])
|
||||
def get_experiment_list():
|
||||
return jsonify({
|
||||
"retcode": 0,
|
||||
"success": True,
|
||||
"message": "",
|
||||
"data": []
|
||||
})
|
||||
|
||||
@config_blueprint.route('/account/device/api/listNewerDevices', methods=['POST'])
|
||||
def list_newer_devices():
|
||||
return jsonify({
|
||||
"data": {
|
||||
"devices": [],
|
||||
"latest_id": "0"
|
||||
},
|
||||
"message": "OK",
|
||||
"retcode": 0
|
||||
})
|
||||
|
||||
@config_blueprint.route('/<game_biz>/combo/granter/api/getConfig', methods=['GET'])
|
||||
def get_config(game_biz):
|
||||
return jsonify({
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"protocol": True,
|
||||
"qr_enabled": False,
|
||||
"log_level": "DEBUG",
|
||||
"announce_url": f"https://127.0.0.1/bh3/announcement/",
|
||||
"push_alias_type": 2,
|
||||
"disable_ysdk_guard": False,
|
||||
"enable_announce_pic_popup": False,
|
||||
"app_name": "崩坏3-东南亚",
|
||||
"qr_enabled_apps": {
|
||||
"bbs": False,
|
||||
"cloud": False
|
||||
},
|
||||
"qr_app_icons": {
|
||||
"app": "",
|
||||
"bbs": "",
|
||||
"cloud": ""
|
||||
},
|
||||
"qr_cloud_display_name": ""
|
||||
}
|
||||
})
|
||||
|
||||
@config_blueprint.route('/game_weather/weather/get_weather', methods=['GET'])
|
||||
def get_weather():
|
||||
weather_data = {
|
||||
"Retcode": 0,
|
||||
"Message": "OK",
|
||||
"Data": {
|
||||
"Timezone": 8,
|
||||
"Hourly": []
|
||||
}
|
||||
}
|
||||
for i in range(24):
|
||||
date_time = (datetime.now() + timedelta(hours=i)).strftime("%Y-%m-%d %H")
|
||||
weather_data["Data"]["Hourly"].append({
|
||||
"Condition": 1,
|
||||
"Date": date_time.split()[0],
|
||||
"Hour": int(date_time.split()[1].split(':')[0]),
|
||||
"Temp": random.randint(20, 30)
|
||||
})
|
||||
return jsonify(weather_data)
|
||||
|
||||
@config_blueprint.route('/<game_biz>/mdk/shield/api/loadConfig', methods=['GET'])
|
||||
def load_config(game_biz):
|
||||
game_key = request.args.get('game_key', '')
|
||||
return jsonify({
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"id": 16,
|
||||
"game_key": game_key,
|
||||
"client": "PC",
|
||||
"identity": "I_IDENTITY",
|
||||
"guest": False,
|
||||
"ignore_versions": "",
|
||||
"scene": "S_NORMAL",
|
||||
"name": "崩坏3rd-东南亚",
|
||||
"disable_regist": False,
|
||||
"enable_email_captcha": False,
|
||||
"thirdparty": [],
|
||||
"disable_mmt": False,
|
||||
"server_guest": False,
|
||||
"thirdparty_ignore": {},
|
||||
"enable_ps_bind_account": False,
|
||||
"thirdparty_login_configs": {},
|
||||
"initialize_firebase": False
|
||||
}
|
||||
})
|
||||
|
||||
@config_blueprint.route('/combo/box/api/config/sdk/combo', methods=['GET'])
|
||||
def sdk_combo():
|
||||
return jsonify({
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"vals": {
|
||||
"list_price_tierv2_enable": "false",
|
||||
"network_report_config": {
|
||||
"enable": 0,
|
||||
"status_codes": [206],
|
||||
"url_paths": ["dataUpload", "red_dot"]
|
||||
},
|
||||
"kibana_pc_config": {
|
||||
"enable": 1,
|
||||
"level": "Debug",
|
||||
"modules": ["download"]
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@config_blueprint.route('/device-fp/api/getExtList', methods=['GET'])
|
||||
def get_ext_list():
|
||||
return jsonify({
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"code": 200,
|
||||
"msg": "ok",
|
||||
"ext_list": [
|
||||
"cpuName", "deviceModel", "deviceName", "deviceType", "deviceUID", "gpuID", "gpuName", "gpuAPI",
|
||||
"gpuVendor", "gpuVersion", "gpuMemory", "osVersion", "cpuCores", "cpuFrequency", "gpuVendorID",
|
||||
"isGpuMultiTread", "memorySize", "screenSize", "engineName", "addressMAC"
|
||||
],
|
||||
"pkg_list": [],
|
||||
"pkg_str": "/vK5WTh5SS3SAj8Zm0qPWg=="
|
||||
}
|
||||
})
|
||||
|
||||
@config_blueprint.route('/device-fp/api/getFp', methods=['GET'])
|
||||
def get_fp():
|
||||
device_fp = request.args.get('device_fp', '')
|
||||
return jsonify({
|
||||
"data": {
|
||||
"code": 200,
|
||||
"device_fp": device_fp,
|
||||
"msg": "ok"
|
||||
},
|
||||
"message": "OK",
|
||||
"retcode": 0
|
||||
})
|
||||
|
||||
@config_blueprint.route('/report', methods=['GET'])
|
||||
def report():
|
||||
return "GET LOG"
|
||||
|
||||
@config_blueprint.route('/admin/mi18n/<path:remainder>', methods=['GET'])
|
||||
def admin_mi18n(remainder):
|
||||
return jsonify({
|
||||
"version": 74
|
||||
})
|
||||
|
||||
@config_blueprint.route('/sdk/dataUpload', methods=['GET'])
|
||||
def data_upload():
|
||||
return jsonify({
|
||||
"code": 0
|
||||
})
|
||||
|
||||
@config_blueprint.route('/<game_biz>/combo/granter/api/compareProtocolVersion', methods=['POST'])
|
||||
def compare_protocol_version(game_biz):
|
||||
body = request.json
|
||||
app_id = body.get('AppId')
|
||||
language = body.get('Language')
|
||||
return jsonify({
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"modified": True,
|
||||
"protocol": {
|
||||
"id": 0,
|
||||
"app_id": app_id,
|
||||
"language": language,
|
||||
"user_proto": "",
|
||||
"priv_proto": "",
|
||||
"major": 0,
|
||||
"minimum": 3,
|
||||
"create_time": "0",
|
||||
"teenager_proto": "",
|
||||
"third_proto": ""
|
||||
}
|
||||
}
|
||||
})
|
||||
198
sdk_server/controllers/dispatch_controller.py
Normal file
198
sdk_server/controllers/dispatch_controller.py
Normal file
@@ -0,0 +1,198 @@
|
||||
from game_server.config import *
|
||||
|
||||
dispatch_blueprint = Blueprint('dispatch', __name__)
|
||||
|
||||
@dispatch_blueprint.route('/query_dispatch', methods=['GET'])
|
||||
def query_dispatch():
|
||||
version = request.args.get('version')
|
||||
response_data = {
|
||||
'retcode': 0,
|
||||
'region_list': [{
|
||||
'retcode': 0,
|
||||
'dispatch_url': f"http://{Config.GameServer.Ip}/query_gateway",
|
||||
'name': Config.RegionName,
|
||||
'title': "",
|
||||
'ext': get_ext(version)
|
||||
}]
|
||||
}
|
||||
return jsonify(response_data)
|
||||
|
||||
@dispatch_blueprint.route('/query_gateway', methods=['GET'])
|
||||
def query_gateway():
|
||||
version = request.args.get('version')
|
||||
gameserver = {
|
||||
'ip': Config.GameServer.Ip,
|
||||
'port': Config.GameServer.Port
|
||||
}
|
||||
|
||||
response_data = {
|
||||
'retcode': 0,
|
||||
'msg': "",
|
||||
'region_name': Config.RegionName,
|
||||
'account_url': f"http://{Config.GameServer.Ip}/account",
|
||||
'account_url_backup': f"http://{Config.GameServer.Ip}/account",
|
||||
'asset_bundle_url_list': get_asset_bundle_url_list(version),
|
||||
'ex_audio_and_video_url_list': get_ex_audio_and_video_url_list(version),
|
||||
'ex_resource_url_list': get_ex_resource_url_list(version),
|
||||
'ext': get_ext(version),
|
||||
'gameserver': gameserver,
|
||||
'gateway': gameserver,
|
||||
'is_data_ready': True,
|
||||
'oaserver_url': f"http://{Config.GameServer.Ip}/oaserver",
|
||||
'server_cur_time': int(time.time()),
|
||||
'server_cur_timezone': 8,
|
||||
'server_ext': {
|
||||
'cdkey_url': f"http://{Config.GameServer.Ip}/common",
|
||||
'mihoyo_sdk_env': "2"
|
||||
}
|
||||
}
|
||||
|
||||
return jsonify(response_data)
|
||||
|
||||
def get_ext(version):
|
||||
return {
|
||||
'ai_use_asset_bundle': "0" if Config.UseLocalCache else "1",
|
||||
'apm_log_level': "0",
|
||||
'apm_log_dest': "2",
|
||||
'apm_switch': "0",
|
||||
'apm_switch_game_log': "1",
|
||||
'apm_switch_crash': "1",
|
||||
'block_error_dialog': "1",
|
||||
'elevator_model_path': "GameEntry/EVA/StartLoading_Model",
|
||||
'data_use_asset_bundle': "1",
|
||||
'enable_watermark': "1",
|
||||
'ex_audio_and_video_url_list': get_ex_audio_and_video_url_list(version),
|
||||
'ex_res_buff_size': "10485760",
|
||||
'ex_res_pre_publish': "0",
|
||||
'ex_res_use_http': "1",
|
||||
'ex_resource_url_list': get_ex_resource_url_list(version),
|
||||
'is_xxxx': "0",
|
||||
'mtp_switch': "0",
|
||||
'network_feedback_enable': "0",
|
||||
'offline_report_switch': "0",
|
||||
'forbid_recharge': "1",
|
||||
'is_checksum_off': "0" if Config.UseLocalCache else "1",
|
||||
'res_use_asset_bundle': "1",
|
||||
'show_version_text': "0",
|
||||
'update_streaming_asb': "0",
|
||||
'use_multy_cdn': "1",
|
||||
'show_bulletin_button': "1",
|
||||
'show_bulletin_empty_dialog_bg': "0"
|
||||
}
|
||||
|
||||
def get_asset_bundle_url_list(version):
|
||||
# Compile the regex pattern
|
||||
regex = re.compile(r"^(.*?)_(os|gf|global)_(.*?)$")
|
||||
match = regex.match(version)
|
||||
value = match.group(2)
|
||||
if Config.UseLocalCache:
|
||||
return get_local_url_list(value, version)
|
||||
# Proceed if there's a match
|
||||
if match:
|
||||
# Return URLs based on the OS type
|
||||
if value == "os":
|
||||
return [
|
||||
"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:
|
||||
return [
|
||||
"https://autopatchbeta.bh3.com/asset_bundle/beta_release/1.0",
|
||||
"https://autopatchbeta.bh3.com/asset_bundle/beta_release/1.0"
|
||||
]
|
||||
return [
|
||||
"https://bundle-qcloud.bh3.com/asset_bundle/android01/1.0",
|
||||
"https://bundle.bh3.com/asset_bundle/android01/1.0"
|
||||
]
|
||||
elif value == "global":
|
||||
return [
|
||||
"http://hk-bundle-west-mihayo.akamaized.net/asset_bundle/usa01/1.1",
|
||||
"http://bundle-aliyun-usa.honkaiimpact3.com/asset_bundle/usa01/1.1"
|
||||
]
|
||||
else:
|
||||
return [
|
||||
"https://bundle-aliyun-os.honkaiimpact3.com/asset_bundle/overseas01/1.1",
|
||||
"https://hk-bundle-os-mihayo.akamaized.net/asset_bundle/overseas01/1.1"
|
||||
]
|
||||
return []
|
||||
|
||||
def get_ex_audio_and_video_url_list(version):
|
||||
# Compile the regex pattern
|
||||
regex = re.compile(r"^(.*?)_(os|gf|global)_(.*?)$")
|
||||
match = regex.match(version)
|
||||
value = match.group(2)
|
||||
if Config.UseLocalCache:
|
||||
return get_local_url_list(value, version)
|
||||
if match:
|
||||
# Return URLs based on the OS type
|
||||
if value == "os":
|
||||
return [
|
||||
"bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea",
|
||||
"hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea"
|
||||
]
|
||||
elif value == "gf":
|
||||
if "beta" in version:
|
||||
return [
|
||||
"autopatchbeta.bh3.com/tmp/CGAudio",
|
||||
"autopatchbeta.bh3.com/tmp/CGAudio"
|
||||
]
|
||||
return [
|
||||
"bh3rd-beta-qcloud.bh3.com/tmp/CGAudio",
|
||||
"bh3rd-beta.bh3.com/tmp/CGAudio"
|
||||
]
|
||||
elif value == "global":
|
||||
return [
|
||||
"bh3rd-beta-qcloud.bh3.com/tmp/CGAudio",
|
||||
"bh3rd-beta.bh3.com/tmp/CGAudio"
|
||||
]
|
||||
else:
|
||||
return [
|
||||
"bh3rd-beta-qcloud.bh3.com/tmp/CGAudio",
|
||||
"bh3rd-beta.bh3.com/tmp/CGAudio"
|
||||
]
|
||||
return []
|
||||
|
||||
def get_ex_resource_url_list(version):
|
||||
# Compile the regex pattern
|
||||
regex = re.compile(r"^(.*?)_(os|gf|global)_(.*?)$")
|
||||
match = regex.match(version)
|
||||
value = match.group(2)
|
||||
if Config.UseLocalCache:
|
||||
return get_local_url_list(value, version)
|
||||
# Proceed if there's a match
|
||||
if match:
|
||||
# Return URLs based on the OS type
|
||||
if value == "os":
|
||||
return [
|
||||
"bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea",
|
||||
"hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea"
|
||||
]
|
||||
elif value == "gf":
|
||||
if "beta" in version:
|
||||
return [
|
||||
"autopatchbeta.bh3.com/tmp/beta",
|
||||
"autopatchbeta.bh3.com/tmp/beta"
|
||||
]
|
||||
return [
|
||||
"bundle-qcloud.bh3.com/tmp/Original",
|
||||
"bundle.bh3.com/tmp/Original"
|
||||
]
|
||||
elif value == "global":
|
||||
return [
|
||||
"hk-bundle-west-mihayo.akamaized.net/tmp/com.miHoYo.bh3global",
|
||||
"bigfile-aliyun-usa.honkaiimpact3.com/tmp/com.miHoYo.bh3global"
|
||||
]
|
||||
else:
|
||||
return [
|
||||
"bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea",
|
||||
"hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea"
|
||||
]
|
||||
return []
|
||||
|
||||
def get_local_url_list(type, version):
|
||||
return [
|
||||
f"http://{Config.GameServer.Ip}/statics/{type}/{version.replace('.', '_')}",
|
||||
f"http://{Config.GameServer.Ip}/statics/{type}/{version.replace('.', '_')}"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user