Init enter game

This commit is contained in:
Naruse
2025-06-14 11:15:32 +08:00
commit 6a03b39f07
568 changed files with 92872 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using KianaBH.Data.Models.Sdk;
using Microsoft.AspNetCore.Mvc;
namespace KianaBH.SdkServer.Handlers.Sdk;
[ApiController]
public class AbTestController : ControllerBase
{
[HttpPost("/data_abtest_api/config/experiment/list")]
public IActionResult GetExperimentList()
{
return Ok(new ResponseBase
{
Data = new[]
{
new
{
code = 1000,
type = 2,
config_id = "169",
period_id = "6524_721",
version = 2,
configs = new
{
hoyopass_enable = false
},
sceneWhiteList = false,
experimentWhiteList = false,
}
}
});
}
}

View File

@@ -0,0 +1,123 @@
using Microsoft.AspNetCore.Mvc;
using KianaBH.Data.Models.Sdk;
using KianaBH.Database.Account;
using KianaBH.Util;
namespace KianaBH.SdkServer.Handlers.Sdk;
[ApiController]
public class ComboGranterController : Controller
{
[HttpPost("/{productName}/combo/granter/login/v2/login")]
public async Task<IActionResult> ComboLoginV2(string productName, [FromBody] ComboGranterRequest request)
{
// TODO: Reuse this logic with MDK Controller Verify Token
int accountUid;
try
{
accountUid = int.Parse(request.Data?.Uid!);
}
catch
{
return Ok(new ResponseBase
{
Retcode = -101,
Success = false,
Message = "Account token error"
});
}
var account = AccountData.GetAccountByUid(accountUid,true);
if (account == null || account!.ComboToken != request.Data!.Token)
{
return Ok(new ResponseBase
{
Retcode = -101,
Success = false,
Message = "Account token error"
});
}
return Ok(new ComboGranterResponse
{
Data = new ComboGranterResponse.ComboGranterResponseData
{
AccountType = 1,
Data = "{\"guest\": false}",
Heartbeat = false,
OpenId = account!.Uid.ToString(),
ComboToken = account!.ComboToken,
},
});
}
[HttpPost("/{productName}/combo/granter/api/compareProtocolVersion")]
public IActionResult CompareProtocolVersion(string productName)
{
return Ok(new ResponseBase
{
Data = new
{
Modified = false,
}
});
}
[HttpGet("/{productName}/combo/granter/api/getConfig")]
public IActionResult GetConfig()
{
return Ok(new ResponseBase
{
Data = new
{
protocol = true,
qr_enabled = false,
log_level = "INFO",
announce_url =
$"{ConfigManager.Config.HttpServer.GetDisplayAddress()}/announcement/index.html",
push_alias_type = 2,
disable_ysdk_guard = false,
enable_announce_popup = false,
app_name = "崩坏3-东南亚",
qr_enabled_apps = new
{
bbs = false,
cloud = false
},
qr_app_icons = new
{
app = "",
bbs = "",
cloud = "",
},
qr_cloud_display_name = "",
enable_user_center = false,
functional_switch_configs = new { }
}
});
}
[HttpGet("/combo/box/api/config/sdk/combo")]
public IActionResult GetComboConfig()
{
return Ok(new ResponseBase
{
Data = new
{
vals = new
{
network_report_config =
"{ \"enable\": 1, \"status_codes\": [206], \"url_paths\": [\"dataUpload\", \"red_dot\"] }",
list_price_tierv2_enable = "false",
default_os_pay_dialog_type = "old",
kibana_pc_config = "{ \"enable\": 1, \"level\": \"Info\",\"modules\": [\"download\"]\n",
telemetry_config = "{\n \"dataupload_enable\": 1,\n}",
h5log_filter_config =
"{\n\t\"function\": {\n\t\t\"event_name\": [\"info_get_cps\", \"notice_close_notice\", \"info_get_uapc\", \"report_set_info\", \"info_get_channel_id\", \"info_get_sub_channel_id\"]\n\t}\n}",
}
}
});
}
}

View File

@@ -0,0 +1,57 @@
using KianaBH.Data.Models.Sdk;
using Microsoft.AspNetCore.Mvc;
namespace KianaBH.SdkServer.Handlers.Sdk;
[ApiController]
public class DeviceFingerprintController : ControllerBase
{
[HttpPost("/device-fp/api/getFp")]
public IActionResult GetDeviceFingerprint([FromBody] GetDeviceFingerprintRequest request)
{
return Ok(new ResponseBase
{
Data = new { request.DeviceFp, Code = 0, Msg = "ok" }
});
}
[HttpGet("/device-fp/api/getExtList")]
public IActionResult GetExtList()
{
var extList = new[]
{
"cpuName",
"deviceModel",
"deviceName",
"deviceType",
"deviceUID",
"gpuID",
"gpuName",
"gpuAPI",
"gpuVendor",
"gpuVersion",
"gpuMemory",
"osVersion",
"cpuCores",
"cpuFrequency",
"gpuVendorID",
"isGpuMultiTread",
"memorySize",
"screenSize",
"engineName",
"addressMAC",
"packageVersion"
};
return Ok(new ResponseBase
{
Data = new
{
code = 200,
msg = "ok",
ext_list = extList,
pkg_list = Array.Empty<object>()
}
});
}
}

View File

@@ -0,0 +1,31 @@
using KianaBH.Data.Models.Sdk;
using Microsoft.AspNetCore.Mvc;
namespace KianaBH.SdkServer.Handlers.Sdk;
[ApiController]
public class GameWeatherController : ControllerBase
{
[HttpGet("/game_weather/weather/get_weather")]
public IActionResult GetWeather()
{
var now = DateTime.Now;
var dateString = now.ToString("yyyy-MM-dd");
return Ok(new GetWeatherResponse
{
Data = new GetWeatherResponse.GetWeatherResponseData
{
Timezone = (int)TimeZoneInfo.Local.GetUtcOffset(now).TotalHours,
Hourly = Enumerable.Range(1, 24).Select(i =>
new GetWeatherResponse.GetWeatherResponseData.HourlyWeatherData
{
Condition = 3,
Date = dateString,
Hour = i,
Temp = 21
}).ToList()
}
});
}
}

View File

@@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Mvc;
namespace KianaBH.SdkServer.Handlers.Sdk;
[ApiController]
public class LogDataUploadController : ControllerBase
{
[HttpGet("/report")]
public IActionResult Report()
{
return Ok(new { code = 0, message = "OK" });
}
[HttpPost("/{logType}/dataUpload")]
public IActionResult LogDataUpload(string logType)
{
return Ok(new { code = 0, message = "OK" });
}
[HttpPost("/common/h5log/log/batch")]
public IActionResult H5LogBatch()
{
return Ok(new { code = 0, message = "OK" });
}
[HttpGet("/_ts")]
public IActionResult GetTs()
{
return Ok(new
{
code = 0,
message = "app running",
milliTs = DateTime.Now.Millisecond.ToString()
});
}
}

View File

@@ -0,0 +1,50 @@
// TODO: Since these stuff requires client patch, we will disable it for now
// using Microsoft.AspNetCore.Mvc;
// using KianaBH.Database.Repositories;
// using KianaBH.SdkServer.Models;
// using KianaBH.SdkServer.Models.Sdk;
//
// namespace KianaBH.SdkServer.Handlers.Sdk;
//
// [ApiController]
// public class MaPassportController : ControllerBase
// {
// [HttpPost("/{productName}/account/ma-passport/api/appLoginByPassword")]
// public async Task<IActionResult> AppLoginByPassword(string productName,
// [FromBody] AppLoginByPasswordRequest request)
// {
// var account = AccountRepository.FindAccountByUsername(request.Account);
//
// // Make new account
// if (account == null)
// {
// var (success, accountUid) = await AccountRepository.CreateAccount(request.Account, request.Password);
// if (!success)
// {
// return Ok(new ResponseBase
// {
// Retcode = -101,
// Message = "Failed to create account"
// });
// }
//
// account = AccountRepository.FindAccountByAccountUid(accountUid);
// }
//
//
// return Ok(new AppLoginByPasswordResponse
// {
// Data = new AppLoginByPasswordResponse.AppLoginByPasswordResponseData
// {
// }
// });
// }
//
// [HttpPost("/{productName}/account/ma-passport/api/logout")]
// public IActionResult Logout(string productName, [FromBody] LogoutRequest request)
// {
// return Ok(new ResponseBase());
// }
// }

View File

@@ -0,0 +1,153 @@
using KianaBH.Data.Models.Sdk;
using KianaBH.Database.Account;
using Microsoft.AspNetCore.Mvc;
namespace KianaBH.SdkServer.Models.Sdk;
[ApiController]
public class MdkController : Controller
{
[HttpPost("/{productName}/mdk/shield/api/login")]
public async Task<IActionResult> MdkShieldLogin(string productName, [FromBody] MdkShieldLoginRequest request)
{
var account = AccountData.GetAccountByUserName(request.Account!);
// Make new account
if (account == null)
{
AccountData.CreateAccount(request.Account!, 0, request.Password!);
account = AccountData.GetAccountByUserName(request.Account!)!;
}
return Ok(new MdkShieldResponse
{
Data = new MdkShieldResponse.MdkShieldResponseData
{
Account = new MdkShieldAccountData
{
Uid = account.Uid.ToString(),
Token = account.GenerateComboToken(),
Name = account.Username,
Realname = account.Username,
IsEmailVerify = "0",
Email = $"{account!.Username}@neonteam.dev",
AreaCode = "**",
Country = "US",
},
}
});
}
[HttpPost("/{productName}/mdk/shield/api/verify")]
public async Task<IActionResult> MdkShieldVerify(string productName, [FromBody] MdkShieldVerifyRequest request)
{
int accountUid;
try
{
accountUid = int.Parse(request.Uid!);
}
catch
{
return Ok(new ResponseBase
{
Retcode = -101,
Success = false,
Message = "Account cache error"
});
}
var account = AccountData.GetAccountByUid(accountUid,true);
if (account == null)
{
return Ok(new ResponseBase
{
Retcode = -101,
Success = false,
Message = "Account cache error"
});
}
if (account.ComboToken != request.Token)
{
return Ok(new ResponseBase
{
Retcode = -101,
Success = false,
Message = "For account safety, please log in again"
});
}
return Ok(new MdkShieldResponse
{
Data = new MdkShieldResponse.MdkShieldResponseData
{
Account = new MdkShieldAccountData
{
Uid = account.Uid.ToString(),
Token = account.ComboToken!,
Name = account.Username,
Realname = account.Username,
IsEmailVerify = "0",
Email = $"{account!.Username}@neonteam.dev",
AreaCode = "**",
Country = "US",
},
}
});
}
[HttpGet("/{productName}/mdk/agreement/api/getAgreementInfos")]
public IActionResult MdkGetAgreementInfos(string productName)
{
return Ok(new ResponseBase
{
Data = new { marketing_agreements = Array.Empty<object>() }
});
}
[HttpGet("/{productName}/mdk/shield/api/loadConfig")]
public IActionResult MdkLoadConfig(string productName)
{
return Ok(new ResponseBase
{
Data = new
{
id = 16,
game_key = productName,
client = "PC",
identity = "I_IDENTITY",
guest = false,
ignore_versions = "",
scene = "S_NORMAL",
name = "崩坏3rd-东南亚",
disable_regist = false,
enable_email_captcha = false,
thirdparty = Array.Empty<string>(),
disable_mmt = false,
server_guest = false,
thirdparty_ignore = new { },
enable_ps_bind_account = false,
thirdparty_login_configs = new { },
initialize_firebase = false,
bbs_auth_login = false,
bbs_auth_login_ignore = Array.Empty<string>(),
fetch_instance_id = false,
enable_flash_login = false,
enable_logo_18 = false,
logo_height = "0",
logo_width = "0",
enable_cx_bind_account = false,
firebase_blacklist_devices_switch = false,
firebase_blacklist_devices_version = 0,
hoyolab_auth_login = false,
hoyolab_auth_login_ignore = Array.Empty<string>(),
hoyoplay_auth_login = true,
enable_douyin_flash_login = false,
enable_age_gate = false,
enable_age_gate_ignore = Array.Empty<string>()
}
});
}
}

View File

@@ -0,0 +1,14 @@
using KianaBH.Data.Models.Sdk;
using Microsoft.AspNetCore.Mvc;
namespace KianaBH.SdkServer.Models.Sdk;
[ApiController]
public class RiskyController : ControllerBase
{
[HttpPost("/account/risky/api/check")]
public IActionResult ComboGranter()
{
return Ok(new ResponseBase { Data = new { } });
}
}