From 482197b5feb72acc0b7f0b0746d8241c420c81c1 Mon Sep 17 00:00:00 2001 From: AlessandroCH Date: Fri, 23 May 2025 20:54:35 +0200 Subject: [PATCH] let's hope this work --- Campofinale/Game/GameConstants.cs | 14 +++++++++----- Campofinale/Http/Dispatch.cs | 32 +++++++++++++++++++++++++++++++ Campofinale/Http/DispatchCN.cs | 14 ++------------ Campofinale/Http/SDK.cs | 14 +++++++++++--- Campofinale/Server.cs | 4 ++-- 5 files changed, 56 insertions(+), 22 deletions(-) diff --git a/Campofinale/Game/GameConstants.cs b/Campofinale/Game/GameConstants.cs index 8bc42e0..fd35d24 100644 --- a/Campofinale/Game/GameConstants.cs +++ b/Campofinale/Game/GameConstants.cs @@ -4,18 +4,22 @@ { //TODO, have to check if this is really userful for support different platform or if android version doesn't need the GAME_VERSION_ASSET_URL (probably not?) //So, in case is useful only if the android build it's different than 0.5.28 - public static List GAME_VERSIONS = new() + /*public static List GAME_VERSIONS = new() { new GameVersionConst("0.5.28"), //Windows CBT2 - new GameVersionConst("x.x.xx"), //Android CBT2 + new GameVersionConst("0.5.5"), //Android CBT2 - }; + };*/ + + //Not used on top ^ public static string GAME_VERSION = "0.5.28"; //CBT 2 + public static string GAME_VERSION_ANDROID = "0.5.5"; //CBT 2 ANDROID public static string GAME_VERSION_ASSET_URL = "https://beyond.hg-cdn.com/uXUuLlNbIYmMMTlN/0.5/update/6/1/Windows/0.5.28_U1mgxrslUitdn3hb/files";//CBT 2 public static int MAX_TEAMS_NUMBER = 5; //Not used yet public static (long, string) SERVER_UID = (99, "99"); //Not used yet, no friend chat in current Beta } - public class GameVersionConst + + /* public class GameVersionConst { public string GAME_VERSION = "0.5.28"; public string GAME_VERSION_ASSET_URL = "https://beyond.hg-cdn.com/uXUuLlNbIYmMMTlN/0.5/update/6/1/Windows/0.5.28_U1mgxrslUitdn3hb/files";//CBT 2 @@ -25,5 +29,5 @@ { this.GAME_VERSION = version; } - } + }*/ } diff --git a/Campofinale/Http/Dispatch.cs b/Campofinale/Http/Dispatch.cs index aa372cd..210dd9d 100644 --- a/Campofinale/Http/Dispatch.cs +++ b/Campofinale/Http/Dispatch.cs @@ -74,6 +74,7 @@ namespace Campofinale.Http await ctx.Response.SendAsync(resp); } + //WINDOWS [StaticRoute(HttpServerLite.HttpMethod.GET, "/api/game/get_latest")] public static async Task get_latest(HttpContext ctx) { @@ -86,6 +87,18 @@ namespace Campofinale.Http await ctx.Response.SendAsync(resp); } + //ANDROID + [StaticRoute(HttpServerLite.HttpMethod.GET, "/api/game/get_latest_game_info")] + public static async Task get_latest_game_info(HttpContext ctx) + { + string resp = "{\"version\":\""+ GameConstants.GAME_VERSION_ANDROID + "\",\"action\":0,\"update_type\":0,\"update_info\":{\"package\":null,\"patch\":null,\"custom_info\":\"\",\"source_package\":null},\"client_version\":\"\"}"; + + ctx.Response.StatusCode = 200; + ctx.Response.ContentLength = resp.Length; + ctx.Response.ContentType = "application/json"; + + await ctx.Response.SendAsync(resp); + } [StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/1003/prod-cbt/default/default/network_config")] public static async Task network_config(HttpContext ctx) { @@ -128,8 +141,27 @@ namespace Campofinale.Http [StaticRoute(HttpServerLite.HttpMethod.GET, "/app/v1/config")] public static async Task config_check(HttpContext ctx) { + string appCode = ctx.Request.Query.Elements["appCode"]; + + string resp = "{\"data\":{\"agreementUrl\":{\"register\":\"https://user.gryphline.com/{language}/protocol/plain/terms_of_service\",\"privacy\":\"https://user.gryphline.com/{language}/protocol/plain/privacy_policy\",\"unbind\":\"https://user.gryphline.com/{language}/protocol/plain/endfield/privacy_policy\",\"account\":\"https://user.gryphline.com/{language}/protocol/plain/terms_of_service\",\"game\":\"https://user.gryphline.com/{language}/protocol/plain/endfield/privacy_policy\"},\"app\":{\"googleAndroidClientId\":\"\",\"googleIosClientId\":\"\",\"enableAutoLogin\":true,\"enablePayment\":true,\"enableGuestRegister\":false,\"needShowName\":true,\"displayName\":{\"en-us\":\"Arknights: Endfield\",\"ja-jp\":\"アークナイツ:エンドフィールド\",\"ko-kr\":\"명일방주:엔드필드\",\"zh-cn\":\"明日方舟:终末地\",\"zh-tw\":\"明日方舟:終末地\"},\"unbindAgreement\":[],\"unbindLimitedDays\":30,\"unbindCoolDownDays\":14,\"customerServiceUrl\":\"https://gryphline.helpshift.com/hc/{language}/4-arknights-endfield\",\"enableUnbindGrant\":false},\"customerServiceUrl\":\"https://gryphline.helpshift.com/hc/{language}/4-arknights-endfield\",\"thirdPartyRedirectUrl\":\"https://web-api.gryphline.com/callback/thirdPartyAuth.html\",\"scanUrl\":{\"login\":\"yj://scan_login\"},\"loginChannels\":[],\"userCenterUrl\":\"https://user.gryphline.com/pcSdk/userInfo?language={language}\"},\"msg\":\"OK\",\"status\":0,\"type\":\"A\"}"; + if(appCode == "a65356244d22261b") + { + resp = "{ \"data\": { \"antiAddiction\": { \"minorPeriodEnd\": 21, \"minorPeriodStart\": 20 }, \"payment\": [ { \"key\": \"alipay\", \"recommend\": true }, { \"key\": \"wechat\", \"recommend\": false }, { \"key\": \"pcredit\", \"recommend\": false } ], \"customerServiceUrl\": \"https://chat.hypergryph.com/chat/h5/v2/index.html?sysnum=889ee281e3564ddf883942fe85764d44&channelid=2\", \"cancelDeactivateUrl\": \"https://user-stable.hypergryph.com/cancellation\", \"agreementUrl\": { \"game\": \"https://hg-protocol-static-web-stable.hypergryph.net/protocol/plain/ak/index\", \"unbind\": \"https://hg-protocol-static-web-stable.hypergryph.net/protocol/plain/ak/cancellation\", \"gameService\": \"https://hg-protocol-static-web-stable.hypergryph.net/protocol/plain/ak/service\", \"account\": \"https://user.hypergryph.com/protocol/plain/index\", \"privacy\": \"https://user.hypergryph.com/protocol/plain/privacy\", \"register\": \"https://user.hypergryph.com/protocol/plain/registration\", \"updateOverview\": \"https://user.hypergryph.com/protocol/plain/overview_of_changes\", \"childrenPrivacy\": \"https://user.hypergryph.com/protocol/plain/children_privacy\" }, \"app\": { \"enablePayment\": true, \"enableAutoLogin\": true, \"enableAuthenticate\": true, \"enableAntiAddiction\": true, \"enableUnbindGrant\": true, \"wechatAppId\": \"wxeea7cc50e03edb28\", \"alipayAppId\": \"2021004129658342\", \"oneLoginAppId\": \"496b284079be97612a46266a9fdbfbd7\", \"enablePaidApp\": false, \"appName\": \"明日方舟终末地\", \"appAmount\": 600, \"needShowName\": true, \"customerServiceUrl\": \"https://web-biz-platform-cs-center-stable.hypergryph.net/hg/?hg_token={hg_token}&source_from=sdk\", \"needAntiAddictionAlert\": true, \"enableScanLogin\": false, \"deviceCheckMode\": 0, \"enableGiftCode\": false }, \"scanUrl\": { \"login\": \"hypergryph://scan_login\" }, \"userCenterUrl\": \"https://user-center-account-stable.hypergryph.net/pcSdk/userInfo\" }, \"msg\": \"OK\", \"status\": 0, \"type\": \"A\"}"; + } + + ctx.Response.StatusCode = 200; + //ctx.Response.ContentLength = resp.Length; + ctx.Response.ContentType = "application/json"; + + await ctx.Response.SendAsync(resp); + } + [StaticRoute(HttpServerLite.HttpMethod.GET, "/general/v1/server_time")] + public static async Task server_time(HttpContext ctx) + { + string resp = "{\"data\":{\"serverTime\":1748021408,\"isHoliday\":true},\"msg\":\"OK\",\"status\":0,\"type\":\"A\"}"; + ctx.Response.StatusCode = 200; diff --git a/Campofinale/Http/DispatchCN.cs b/Campofinale/Http/DispatchCN.cs index 33bd6da..dac444d 100644 --- a/Campofinale/Http/DispatchCN.cs +++ b/Campofinale/Http/DispatchCN.cs @@ -29,7 +29,7 @@ namespace Campofinale.Http [StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/default/network_config")] public static async Task network_config_cn(HttpContext ctx) { - string resp = "{\"asset\":\"https://beyond.hycdn.cn/asset/\",\"hgage\":\"\",\"sdkenv\":\"2\",\"u8root\":\"https://u8.gryphline.com/u8\",\"appcode\":4,\"channel\":\"prod\",\"netlogid\":\"GFz8RRMDN45w\",\"gameclose\":false,\"netlogurl\":\"http://native-log-collect.gryphline.com:32000/\",\"accounturl\":\"https://binding-api-account-prod.gryphline.com\",\"launcherurl\":\"https://launcher.gryphline.com\"}"; + string resp = "{ \"asset\": \"https://beyond.hycdn.cn/asset/\", \"hgage\": \"https://web.hycdn.cn/endfield/protocol/cadpa-age.txt\", \"sdkenv\": \"2\", \"u8root\": \"https://as.hypergryph.com/u8\", \"appcode\": 4, \"channel\": \"prod\", \"netlogid\": \"56RqF5G2gU9j\", \"gameclose\": false, \"netlogurl\": \"http://native-log-collect.hypergryph.com:32000\", \"accounturl\": \"https://binding-api-account-prod.hypergryph.com\", \"launcherurl\": \"https://launcher.hypergryph.com\"}"; ctx.Response.StatusCode = 200; ctx.Response.ContentLength = resp.Length; @@ -85,16 +85,6 @@ namespace Campofinale.Http await ctx.Response.SendAsync(resp); } - [StaticRoute(HttpServerLite.HttpMethod.GET, "/api/game/get_latest_game_info")] - public static async Task get_latest_game_info(HttpContext ctx) - { - string resp = "{\"version\":\"0.5.5\",\"action\":0,\"update_type\":0,\"update_info\":{\"package\":null,\"patch\":null,\"custom_info\":\"\",\"source_package\":null},\"client_version\":\"\"}"; - - ctx.Response.StatusCode = 200; - ctx.Response.ContentLength = resp.Length; - ctx.Response.ContentType = "application/json"; - - await ctx.Response.SendAsync(resp); - } + } } diff --git a/Campofinale/Http/SDK.cs b/Campofinale/Http/SDK.cs index 1a8b599..6543039 100644 --- a/Campofinale/Http/SDK.cs +++ b/Campofinale/Http/SDK.cs @@ -72,8 +72,12 @@ namespace Campofinale.Http await ctx.Response.SendAsync(resp); } - - + + [StaticRoute(HttpServerLite.HttpMethod.GET, "/batch_event")] + public static async Task batch_event(HttpContext ctx) + { + await ctx.Response.SendAsync("OK"); + } [StaticRoute(HttpServerLite.HttpMethod.GET, "/user/info/v1/basic")] public static async Task account_info_get(HttpContext ctx) { @@ -82,7 +86,10 @@ namespace Campofinale.Http string resp = "{\"data\":{\"hgId\":\"1799321925\",\"email\":\"dispatch@endfield.ps\",\"realEmail\":\"dispatch@endfield.ps\",\"isLatestUserAgreement\":true,\"nickName\":\"Campofinale\"},\"msg\":\"OK\",\"status\":0,\"type\":1}"; if (account != null) { - resp = "{\"data\":{\"idCardNum\": 110102200610048887,\"hgId\":\"" + account.id + "\",\"email\":\"" + account.username +Server.config.dispatchServer.emailFormat +"\",\"realEmail\":\"" + account.username + Server.config.dispatchServer.emailFormat + "\",\"isLatestUserAgreement\":true,\"nickName\":\"" + account.username + "\",\"name\":\"AAAA\"},\"msg\":\"OK\",\"status\":0,\"type\":1}"; + /* + * {"data":{"hgId":"1326618825955","phone":"153****5243","email":null,"identityNum":"5002**********1619","identityName":"金*","isMinor":false,"isLatestUserAgreement":true},"msg":"OK","status":0,"type":"A"} + */ + resp = "{\"data\":{\"phone\":\"153****5243\", \"identityNum\": \"5002**********1619\",\"identityName\":\"金*\",\"isMinor\":false,\"hgId\":\"" + account.id + "\",\"email\":\"" + account.username +Server.config.dispatchServer.emailFormat +"\",\"realEmail\":\"" + account.username + Server.config.dispatchServer.emailFormat + "\",\"isLatestUserAgreement\":true,\"nickName\":\"" + account.username + "\"},\"msg\":\"OK\",\"status\":0,\"type\":\"A\"}"; } else { @@ -132,6 +139,7 @@ namespace Campofinale.Http string resp = "{\"msg\": \"Error\", \"status\": 2, \"type\": \"A\"}"; if (account != null) { + resp = "{\"data\": { \"uid\": \"" + account.id + "\", \"code\": \"" + account.grantToken + "\" }, \"msg\": \"OK\", \"status\": 0, \"type\": \"A\"}"; } diff --git a/Campofinale/Server.cs b/Campofinale/Server.cs index f842f0b..9f80031 100644 --- a/Campofinale/Server.cs +++ b/Campofinale/Server.cs @@ -48,7 +48,7 @@ namespace Campofinale public delegate void HandlerDelegate(Player sender, string command, string[] args, Player target); } public static List clients = new List(); - public static string ServerVersion = "1.1.2-dev"; + public static string ServerVersion = "1.1.5-dev"; public static bool Initialized = false; public static bool showLogs = true; public static bool showWarningLogs = true; @@ -83,7 +83,7 @@ namespace Campofinale showLogs = config.logOptions.packets; showWarningLogs = config.logOptions.packetWarnings; showBodyLogs = config.logOptions.packetBodies; - Logger.Print($"Starting server version {ServerVersion} with supported client version {GameConstants.GAME_VERSION}"); + Logger.Print($"Starting server version {ServerVersion} with supported client version: WINDOWS-{GameConstants.GAME_VERSION} and MOBILE-{GameConstants.GAME_VERSION_ANDROID}"); Logger.Print($"Logs are {(showLogs ? "enabled" : "disabled")}"); Logger.Print($"Warning logs are {(showWarningLogs ? "enabled" : "disabled")}"); Logger.Print($"Packet body logs are {(showBodyLogs ? "enabled" : "disabled")}");