mirror of
https://github.com/MikuLeaks/KianaBH3.git
synced 2026-03-22 22:32:22 +01:00
Init enter game
This commit is contained in:
41
SdkServer/Handlers/Dispatch/QueryDispatchController.cs
Normal file
41
SdkServer/Handlers/Dispatch/QueryDispatchController.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using KianaBH.Configuration;
|
||||
using KianaBH.Data.Models.Dispatch;
|
||||
using KianaBH.Util;
|
||||
using KianaBH.Util.Crypto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KianaBH.SdkServer.Handlers.Dispatch;
|
||||
|
||||
[ApiController]
|
||||
public class QueryDispatchController : ControllerBase
|
||||
{
|
||||
[HttpGet("/query_dispatch")]
|
||||
public IActionResult QueryDispatch([FromQuery] DispatchQuery query, Logger logger)
|
||||
{
|
||||
var version = HotfixContainer.ExtractVersionNumber(query.Version);
|
||||
if (!ConfigManager.Hotfix.Hotfixes.ContainsKey(version))
|
||||
{
|
||||
logger.Warn($"Client sent requesting unsupported game version: {version}");
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
var response = new QueryDispatchResponse
|
||||
{
|
||||
Retcode = 0,
|
||||
RegionList =
|
||||
[
|
||||
new QueryDispatchResponse.RegionInfo
|
||||
{
|
||||
Retcode = 0,
|
||||
DispatchUrl =
|
||||
$"{ConfigManager.Config.HttpServer.GetDisplayAddress()}/query_gateway",
|
||||
Ext = null,
|
||||
Name = "KianaBH",
|
||||
Title = "KianaBH",
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
return Ok(DispatchEncryption.EncryptDispatchContent(version, response));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user