From eacf80ed5c88a16222a5f31fd2b0530ccd57880e Mon Sep 17 00:00:00 2001 From: rfi Date: Sat, 7 Oct 2023 17:18:43 +0700 Subject: [PATCH] minimum sdk done --- .../Controllers/ConfigController.cs | 36 +++++++++++++++---- AscNet.SDKServer/Models/LoginGate.cs | 20 +++++++++++ AscNet.SDKServer/Models/LoginNotice.cs | 26 ++++++++++++++ proxy.py | 2 +- 4 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 AscNet.SDKServer/Models/LoginGate.cs create mode 100644 AscNet.SDKServer/Models/LoginNotice.cs diff --git a/AscNet.SDKServer/Controllers/ConfigController.cs b/AscNet.SDKServer/Controllers/ConfigController.cs index 15a8cab..53c940c 100644 --- a/AscNet.SDKServer/Controllers/ConfigController.cs +++ b/AscNet.SDKServer/Controllers/ConfigController.cs @@ -1,5 +1,7 @@ using AscNet.Common.Util; using AscNet.SDKServer.Models; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; namespace AscNet.SDKServer.Controllers @@ -35,10 +37,10 @@ namespace AscNet.SDKServer.Controllers remoteConfigs.AddConfig("MemoryLimit", 2048); remoteConfigs.AddConfig("CloseMsgEncrypt", false); remoteConfigs.AddConfig("ServerListStr", $"{Common.Common.config.GameServer.RegionName}#{Common.Common.config.GameServer.Host}/api/Login/Login"); - remoteConfigs.AddConfig("AndroidPayCallbackUrl", $"{Common.Common.config.GameServer.Host}/api/XPay/HeroHgAndroidPayResult"); // i just wanna know what this is - remoteConfigs.AddConfig("IosPayCallbackUrl", $"{Common.Common.config.GameServer.Host}/api/XPay/HeroHgIosPayResult"); // i just wanna know what this is - remoteConfigs.AddConfig("WatermarkEnabled", true); // i just wanna know what this is - remoteConfigs.AddConfig("PicComposition", "empty"); // i just wanna know what this is + remoteConfigs.AddConfig("AndroidPayCallbackUrl", $"{Common.Common.config.GameServer.Host}/api/XPay/HeroHgAndroidPayResult"); + remoteConfigs.AddConfig("IosPayCallbackUrl", $"{Common.Common.config.GameServer.Host}/api/XPay/HeroHgIosPayResult"); + remoteConfigs.AddConfig("WatermarkEnabled", false); // i just wanna know what this is + remoteConfigs.AddConfig("PicComposition", "empty"); remoteConfigs.AddConfig("DeepLinkEnabled", true); remoteConfigs.AddConfig("DownloadMethod", 1); remoteConfigs.AddConfig("PcPayCallbackList", $"{Common.Common.config.GameServer.Host}/api/XPay/KuroPayResult"); @@ -46,12 +48,32 @@ namespace AscNet.SDKServer.Controllers return TsvTool.SerializeObject(remoteConfigs); }); + app.MapGet("/prod/client/notice/config/com.kurogame.punishing.grayraven.en.pc/{version}/LoginNotice.json", (HttpContext ctx) => + { + return JsonConvert.SerializeObject(new LoginNotice() + { + BeginTime = 0, + EndTime = 0, + HtmlUrl = "/", + Id = "1", + ModifyTime = 0, + Title = "NOTICE" + }); + }); + app.MapPost("/feedback", (HttpContext ctx) => { - return ctx.Response.WriteAsJsonAsync(new + return "1"; + }); + + app.MapGet("/api/Login/Login", ([FromQuery] int loginType, [FromQuery] int userId, [FromQuery] string token, [FromQuery] string clientIp) => + { + return JsonConvert.SerializeObject(new LoginGate() { - code = 0, - msg = "ok" + Code = 0, + Ip = Common.Common.config.GameServer.Host, + Port = Common.Common.config.GameServer.Port, + Token = token }); }); } diff --git a/AscNet.SDKServer/Models/LoginGate.cs b/AscNet.SDKServer/Models/LoginGate.cs new file mode 100644 index 0000000..dc4e83f --- /dev/null +++ b/AscNet.SDKServer/Models/LoginGate.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json; + +namespace AscNet.SDKServer.Models +{ +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public partial class LoginGate + { + [JsonProperty("code", NullValueHandling = NullValueHandling.Ignore)] + public long? Code { get; set; } + + [JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)] + public string Token { get; set; } + + [JsonProperty("port", NullValueHandling = NullValueHandling.Ignore)] + public long? Port { get; set; } + + [JsonProperty("ip", NullValueHandling = NullValueHandling.Ignore)] + public string Ip { get; set; } + } +} diff --git a/AscNet.SDKServer/Models/LoginNotice.cs b/AscNet.SDKServer/Models/LoginNotice.cs new file mode 100644 index 0000000..42ea6ed --- /dev/null +++ b/AscNet.SDKServer/Models/LoginNotice.cs @@ -0,0 +1,26 @@ +using Newtonsoft.Json; + +namespace AscNet.SDKServer.Models +{ +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public partial class LoginNotice + { + [JsonProperty("BeginTime", NullValueHandling = NullValueHandling.Ignore)] + public long BeginTime { get; set; } + + [JsonProperty("EndTime", NullValueHandling = NullValueHandling.Ignore)] + public long EndTime { get; set; } + + [JsonProperty("HtmlUrl", NullValueHandling = NullValueHandling.Ignore)] + public string HtmlUrl { get; set; } + + [JsonProperty("Id", NullValueHandling = NullValueHandling.Ignore)] + public string Id { get; set; } + + [JsonProperty("ModifyTime", NullValueHandling = NullValueHandling.Ignore)] + public long ModifyTime { get; set; } + + [JsonProperty("Title", NullValueHandling = NullValueHandling.Ignore)] + public string Title { get; set; } + } +} diff --git a/proxy.py b/proxy.py index 9abc6b6..94150cb 100644 --- a/proxy.py +++ b/proxy.py @@ -21,7 +21,7 @@ def next_layer(nextlayer: layer.NextLayer): nextlayer.context.server.address = ("127.0.0.1", 443) def request(flow: http.HTTPFlow) -> None: - if "kurogame.net" in flow.request.pretty_url or "kurogame-service.com" in flow.request.pretty_url: + if "kurogame.net" in flow.request.pretty_url: flow.request.host = "localhost" flow.request.headers["Host"] = "localhost" pass