updates work in launcher now

This commit is contained in:
Mikhail
2024-07-24 10:11:07 -04:00
parent dea8d98db4
commit a8b13f8539
16 changed files with 329 additions and 13 deletions

View File

@@ -23,7 +23,11 @@ namespace nksrv.IntlServer
{"/gnconfig/acquire_config", new IntlReturnJsonHandler(AquireConfigResp) },
{"/auth/auto_login", new AutoLoginEndpoint() },
{"/reward/send", new IntlReturnJsonHandler(SetProtocolResp) }, // /v2/reward/send
{"/notice/get_notice_content", new GetNoticeContent() } // /v2/notice/get_notice_content
{"/notice/get_notice_content", new GetNoticeContent() }, // /v2/notice/get_notice_content
{"/fleet.repo.game.RepoSVC/GetVersion", new JuniperLauncherGetRepoVersion() }, // /api/v1/fleet.repo.game.RepoSVC/GetVersion
{"/fleet.repo.game.RepoMgr/GetGameLauncher", new JuniperLauncherGetGameLauncher() }, // /api/v1/fleet.repo.game.RepoMgr/
{"/fleet.repo.game.RepoSVC/GetRegion", new JuniperLauncherGetRegion() }, // /api/v1/fleet.repo.game.RepoMgr/ // GetGameLauncher
{"/fleet.auth.game.AuthSvr/Login", new JupiterAuthLogin() } // /api/v1/fleet.auth.game.AuthSvr/Login
};
public const string GetConfResp = "{\"conf_version\":\"102\",\"msg\":\"\",\"ret\":1,\"seq\":\"((SEGID))\"}";
public const string MinorcerResp = "{\"adult_age\":15,\"adult_age_map\":{},\"adult_check_status\":1,\"adult_check_status_expiration\":\"0\",\"adult_status_map\":{},\"certificate_type\":3,\"email\":\"\",\"eu_user_agree_status\":0,\"game_grade\":0,\"game_grade_map\":{},\"is_dma\":true,\"is_eea\":false,\"is_need_li_cert\":false,\"msg\":\"success\",\"need_parent_control\":0,\"need_realname_auth\":0,\"parent_certificate_status\":0,\"parent_certificate_status_expiration\":\"0\",\"parent_control_map\":{},\"qr_code_ret\":0,\"realname_auth_status\":0,\"region\":\"300\",\"ret\":0,\"seq\":\"((SEGID))\",\"ts\":\"1719156511\"}";
@@ -47,6 +51,7 @@ namespace nksrv.IntlServer
}
else
{
handler.Reset();
await handler.HandleAsync(context);
}
}

View File

@@ -14,6 +14,15 @@ namespace nksrv.IntlServer
protected string Seq = "";
protected AccessToken? UsedToken;
public abstract bool RequiresAuth { get; }
public void Reset()
{
UsedToken = null;
Seq = "";
User = null;
Content = "";
ctx = null;
}
public async Task HandleAsync(IHttpContext ctx)
{
this.ctx = ctx;
@@ -72,14 +81,22 @@ namespace nksrv.IntlServer
await HandleAsync();
}
protected abstract Task HandleAsync();
protected async Task WriteJsonStringAsync(string data)
protected async Task WriteJsonStringAsync(string data, bool juniper = false)
{
if (ctx != null)
{
var bt = Encoding.UTF8.GetBytes(data);
ctx.Response.ContentEncoding = null;
ctx.Response.ContentType = "application/json";
ctx.Response.ContentLength64 = bt.Length;
if (juniper)
{
ctx.Response.ContentEncoding = Encoding.UTF8;
ctx.Response.ContentType = "application/json";
}
else
{
ctx.Response.ContentEncoding = null;
ctx.Response.ContentType = "application/json";
ctx.Response.ContentLength64 = bt.Length;
}
await ctx.Response.OutputStream.WriteAsync(bt, ctx.CancellationToken);
await ctx.Response.OutputStream.FlushAsync();
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.IntlServer
{
internal class JuniperLauncherGetRegion : IntlMsgHandler
{
public override bool RequiresAuth => false;
protected override async Task HandleAsync()
{
await WriteJsonStringAsync(@"{
""result"": {
""error_code"": 0,
""error_message"": ""success""
},
""region_info"": [
{
""game_id"": ""16601"",
""region_id"": ""10001"",
""region_name_en_us"": ""Global"",
""region_name_i18n"": """",
""region_description_en_us"": ""Nikke Global Version"",
""region_description_i18n"": """",
""bind_branches"": """",
""meta_data"": """",
""sequence"": 0,
""status"": 2,
""branch_info"": [
{
""game_id"": ""16601"",
""branch_id"": ""1"",
""branch_name"": ""Official_release"",
""branch_type"": 0,
""description"": ""正式发布环境 release包""
}
]
}
]
}", true);
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.IntlServer
{
internal class JuniperLauncherGetRepoVersion : IntlMsgHandler
{
public override bool RequiresAuth => false;
protected override async Task HandleAsync()
{
await WriteJsonStringAsync(File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "gameversion.json")), true);
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.IntlServer
{
internal class JupiterAuthLogin : IntlMsgHandler
{
public override bool RequiresAuth => false;
protected override async Task HandleAsync()
{
await WriteJsonStringAsync(@"{
""result"": {
""error_code"": 0,
""error_message"": ""COMM_SUCC""
},
""game_launcher_info"": [
{
""id"": 27,
""execute_file"": ""NIKKE\\Game\\NIKKE.exe"",
""param"": """",
""description"": ""Nikke main process"",
""os"": ""any"",
""branch_id"": 0,
""status"": 1,
""param_type"": 1
}
]
}", true);
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.IntlServer
{
internal class JuniperLauncherGetGameLauncher : IntlMsgHandler
{
public override bool RequiresAuth => false;
protected override async Task HandleAsync()
{
await WriteJsonStringAsync(@"{
""result"": {
""error_code"": 0,
""error_message"": ""COMM_SUCC""
},
""game_launcher_info"": [
{
""id"": 27,
""execute_file"": ""NIKKE\\Game\\NIKKE.exe"",
""param"": """",
""description"": ""Nikke main process"",
""os"": ""any"",
""branch_id"": 0,
""status"": 1,
""param_type"": 1
}
]
}", true);
}
}
}