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

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

50
GameDownloader/Program.cs Normal file
View File

@@ -0,0 +1,50 @@
using System.Security.Cryptography;
namespace GameDownloader
{
public class Program
{
public static void Main(string[] args)
{
var key = "f8c65f692a6a021a688507a6e441786a";
var bytes = File.ReadAllBytes(@"C:\Users\Misha\Desktop\nikke-server\nksrv\bin\Debug\net8.0\win-x64\cache\PC\prod\rid.48-r.02587\manifestv2\48_5937488248518493556_0.manifest");
var x = Aes.Create();
x.KeySize = 128;
x.Key = StrToByteArray(key);
x.Mode = CipherMode.CFB;
x.Padding = PaddingMode.None;
x.IV = new byte[16];
var abc = x.CreateDecryptor();
var str = new CryptoStream(new MemoryStream(bytes), abc, CryptoStreamMode.Read);
var decr = new MemoryStream();
str.CopyTo(decr);
var res = decr.ToArray();
File.WriteAllBytes("test", res);
//var b2 = x.DecryptEcb(bytes, PaddingMode.None);
}
public static byte[] StrToByteArray(string str)
{
str = str.ToUpper();
Dictionary<string, byte> hexindex = new Dictionary<string, byte>();
for (int i = 0; i <= 255; i++)
hexindex.Add(i.ToString("X2"), (byte)i);
List<byte> hexres = new List<byte>();
for (int i = 0; i < str.Length; i += 2)
hexres.Add(hexindex[str.Substring(i, 2)]);
return hexres.ToArray();
}
}
}

View File

@@ -92,6 +92,8 @@ namespace ServerSelector
{ip} na-community.playerinfinite.com
{ip} common-web.intlgame.com
{ip} li-sg.intlgame.com
255.255.221.21 na.fleetlogd.com
{ip} www.jupiterlauncher.com
{ip} data-aws-na.intlgame.com
255.255.221.21 sentry.io";

View File

@@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServerSelector.Desktop", "S
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{4BB2E77F-84A6-4644-9FB3-38E2A7DCDEC0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameDownloader", "GameDownloader\GameDownloader.csproj", "{E3512D9F-CB94-4C80-B673-0EB83CA21D12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -151,6 +153,30 @@ Global
{01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|x64.Build.0 = Release|Any CPU
{01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|x86.ActiveCfg = Release|Any CPU
{01D0A73A-A881-439D-9318-54DB5B00D6F5}.ReleaseDLL|x86.Build.0 = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Debug|x64.ActiveCfg = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Debug|x64.Build.0 = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Debug|x86.ActiveCfg = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Debug|x86.Build.0 = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.DebugDLL|Any CPU.ActiveCfg = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.DebugDLL|Any CPU.Build.0 = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.DebugDLL|x64.ActiveCfg = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.DebugDLL|x64.Build.0 = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.DebugDLL|x86.ActiveCfg = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.DebugDLL|x86.Build.0 = Debug|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Release|Any CPU.Build.0 = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Release|x64.ActiveCfg = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Release|x64.Build.0 = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Release|x86.ActiveCfg = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.Release|x86.Build.0 = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.ReleaseDLL|Any CPU.ActiveCfg = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.ReleaseDLL|Any CPU.Build.0 = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.ReleaseDLL|x64.ActiveCfg = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.ReleaseDLL|x64.Build.0 = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.ReleaseDLL|x86.ActiveCfg = Release|Any CPU
{E3512D9F-CB94-4C80-B673-0EB83CA21D12}.ReleaseDLL|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -158,6 +184,7 @@ Global
GlobalSection(NestedProjects) = preSolution
{EC613C24-8A35-42E8-92C1-9A8431F74F58} = {4BB2E77F-84A6-4644-9FB3-38E2A7DCDEC0}
{01D0A73A-A881-439D-9318-54DB5B00D6F5} = {4BB2E77F-84A6-4644-9FB3-38E2A7DCDEC0}
{E3512D9F-CB94-4C80-B673-0EB83CA21D12} = {4BB2E77F-84A6-4644-9FB3-38E2A7DCDEC0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F779F2DC-B207-4091-83B8-0EA250461DCE}

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);
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);
}
}
}

View File

@@ -10,7 +10,15 @@ namespace nksrv.LobbyServer.Msgs.System
{
var req = await ReadData<CheckVersionRequest>();
var response = new CheckVersionResponse();
if (GameConfig.Root.GameMaxVer != req.Version)
{
response.VersionStatus = 1;
}
else
{
response.VersionStatus = 0;
}
await WriteDataAsync(response);
}

View File

@@ -249,6 +249,7 @@ namespace nksrv
.WithModule(new ActionModule("/media/", HttpVerbs.Any, HandleAsset))
.WithModule(new ActionModule("/PC/", HttpVerbs.Any, HandleAsset))
.WithModule(new ActionModule("/$batch", HttpVerbs.Any, HandleBatchRequests))
.WithModule(new ActionModule("/api/v1/", HttpVerbs.Any, IntlHandler.Handle))
.WithStaticFolder("/nikke_launcher", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "www", "launcher"), true)
.WithStaticFolder("/admin/assets/", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "www", "admin", "assets"), true)
.WithModule(new ActionModule("/admin", HttpVerbs.Any, HandleAdminRequest))
@@ -433,12 +434,13 @@ namespace nksrv
{
if (ctx.RequestedPath.Contains("/route_config.json"))
{
await ctx.SendStringAsync(@"{
var response = @"{
""Config"": [
{
""VersionRange"": {
""From"": ""122.8.19"",
""To"": ""122.8.20"",
""From"": ""{GameMinVer}"",
""To"": ""{GameMaxVer}"",
""PackageName"": ""com.proximabeta.nikke""
},
""Route"": [
@@ -481,8 +483,8 @@ namespace nksrv
},
{
""VersionRange"": {
""From"": ""121.8.19"",
""To"": ""122.8.20"",
""From"": ""{GameMinVer}"",
""To"": ""{GameMaxVer}"",
""PackageName"": ""com.gamamobi.nikke""
},
""Route"": [
@@ -496,7 +498,10 @@ namespace nksrv
]
}
]
}", "application/json", Encoding.Default);
}";
response = response.Replace("{GameMinVer}", GameConfig.Root.GameMinVer);
response = response.Replace("{GameMaxVer}", GameConfig.Root.GameMaxVer);
await ctx.SendStringAsync(response, "application/json", Encoding.Default);
}
else
{

View File

@@ -7,6 +7,8 @@ namespace nksrv.Utils
{
public StaticData StaticData { get; set; } = new();
public string ResourceBaseURL { get; set; } = "";
public string GameMinVer { get; set; } = "";
public string GameMaxVer { get; set; } = "";
}
public class StaticData

View File

@@ -9,5 +9,9 @@
},
// Extracted from POST https://global-lobby.nikke-kr.com/v1/resourcehosts2
"ResourceBaseURL": "https://cloud.nikke-kr.com/prdenv/122-b0255105e0/{Platform}"
"ResourceBaseURL": "https://cloud.nikke-kr.com/prdenv/122-b0255105e0/{Platform}",
// Extracted from route config
"GameMinVer": "122.8.19",
"GameMaxVer": "122.8.20"
}

49
nksrv/gameversion.json Normal file
View File

@@ -0,0 +1,49 @@
{
"result": {
"error_code": 0,
"error_message": "success"
},
"version_info": {
"game_id": "16601",
"branch_id": "1",
"version_id": "0.0.0.37",
"version_name": "NIKKE.PC_Official_GL_122.8.20",
"version_status": 7,
"service_status": 0,
"build_id": "2810",
"cos_repo_files": "[{\"cdn_root\":\"https://cloud.nikke-kr.com/PC/prod/rid.48-r.02587\",\"chunk_encrypt_flag\":0,\"manifest_files\":[{\"chunks\":[{\"chunk_index\":0,\"chunk_md5\":\"7bcb43a7de15fae58cb5b626ff828910\",\"chunk_size\":109944,\"chunk_uncompress_md5\":\"7bcb43a7de15fae58cb5b626ff828910\",\"chunk_uncompress_size\":109944}],\"file_url\":\"/manifestv2/48_5937488248518493556_0.manifest\",\"manifest_md5\":\"7bcb43a7de15fae58cb5b626ff828910\",\"manifest_size\":109944}],\"manifest_flag\":13,\"manifest_id\":5937488248518493000,\"manifest_version\":2,\"patch_size\":96182631,\"repository_desc\":{\"zh_CN\":\"game repo\"},\"repository_id\":48,\"repository_name\":{\"en_US\":\"Game\",\"zh_CN\":\"Game\"},\"repository_size\":305372746,\"repository_type\":\"Game\",\"repository_uncompress_size\":787528757}]",
"cos_access_info": "[{\"repository_id\":48,\"repository_type\":\"Game\",\"repository_name\":\"Game\",\"repository_name_en\":\"Game\",\"description\":\"game repo\",\"cos_list\":[{\"public_cdn_domain\":\"https://cloud.nikke-kr.com\"}],\"encrytion_key\":\"158f36bf7e611c945320c399294c4a6d\",\"encrytion_algorithm_id\":6,\"manifest_encrytion_key\":\"0f448b096bb4dc5b339debdce77c4572\",\"manifest_encrytion_algorithm_id\":6,\"game_id\":16601,\"manifest_id\":5937488248518494316}]",
"key_file_info": "[{\"crc\":668752354,\"path\":\"NIKKE\\\\game\\\\nikke.exe\"}]",
"install_script": "{\"script_content\":{\"executable\":[]}}",
"installer_size": "305372746",
"installed_size": "787528757",
"publish_time_in_unix": "1720021809",
"is_first_version_in_branch": "1",
"version_description": "[{\"lang_code\":\"en\",\"text\":\"\"},{\"lang_code\":\"ja\",\"text\":\"\"},{\"lang_code\":\"ko\",\"text\":\"\"}]",
"update_type": 0
},
"pre_version_info": null,
"launcher_version_info": {
"game_id": "16701",
"branch_id": "1",
"version_id": "0.0.6.379",
"version_name": "nikke_launcher_0.0.6.379",
"version_status": 7,
"service_status": 0,
"build_id": "2813",
"cos_repo_files": "[{\"cdn_root\":\"https://cloud.nikke-kr.com/PC/prod/rid.50-r.971a3\",\"chunk_encrypt_flag\":0,\"manifest_files\":[{\"chunks\":[{\"chunk_index\":0,\"chunk_md5\":\"c470c01b495b3f24f671ecbb00504c2b\",\"chunk_size\":51800,\"chunk_uncompress_md5\":\"c470c01b495b3f24f671ecbb00504c2b\",\"chunk_uncompress_size\":51800}],\"file_url\":\"/manifestv2/50_5937488248518493869_0.manifest\",\"manifest_md5\":\"c470c01b495b3f24f671ecbb00504c2b\",\"manifest_size\":51800}],\"manifest_flag\":13,\"manifest_id\":5937488248518494000,\"manifest_version\":2,\"patch_size\":16110968,\"repository_desc\":{\"zh_CN\":\"game repo\"},\"repository_id\":50,\"repository_name\":{\"en_US\":\"Game\",\"zh_CN\":\"Game\"},\"repository_size\":150773851,\"repository_type\":\"Game\",\"repository_uncompress_size\":391274755}]",
"cos_access_info": "[{\"repository_id\":50,\"repository_type\":\"Game\",\"repository_name\":\"Game\",\"repository_name_en\":\"Game\",\"description\":\"game repo\",\"cos_list\":[{\"public_cdn_domain\":\"https://cloud.nikke-kr.com\"}],\"encrytion_key\":\"ab00cbd5b9e6f7c4759c12d489b34b61\",\"encrytion_algorithm_id\":10,\"manifest_encrytion_key\":\"f8c65f692a6a021a688507a6e441786a\",\"manifest_encrytion_algorithm_id\":6,\"game_id\":16701,\"manifest_id\":5937488248518494306}]",
"key_file_info": "[{\"crc\":2930257430,\"path\":\"nikke_launcher.exe\"}]",
"install_script": "{\"script_content\":{\"executable\":[]}}",
"installer_size": "150773851",
"installed_size": "391274755",
"publish_time_in_unix": "1720020044",
"is_first_version_in_branch": "1",
"version_description": "[{\"lang_code\":\"en\",\"text\":\"\"},{\"lang_code\":\"ja\",\"text\":\"\"},{\"lang_code\":\"id\",\"text\":\"\"},{\"lang_code\":\"th\",\"text\":\"\"},{\"lang_code\":\"pt\",\"text\":\"\"},{\"lang_code\":\"es\",\"text\":\"\"},{\"lang_code\":\"de\",\"text\":\"\"},{\"lang_code\":\"fr\",\"text\":\"\"},{\"lang_code\":\"zh-Hans\",\"text\":\"\"},{\"lang_code\":\"zh-Hant\",\"text\":\"\"}]",
"update_type": 2
},
"ip_2_location": {
"ip": "1.1.1.1",
"country_code": "GR"
}
}

View File

@@ -38,6 +38,9 @@
<None Update="gameconfig.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="gameversion.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="site.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>