From 298fdb11911b50f06eb25c2d6643ea2c47774184 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:03:16 +0800 Subject: [PATCH] Change IPAPI https://github.com/2dust/v2rayN/issues/6172 --- v2rayN/ServiceLib/Global.cs | 2 +- v2rayN/ServiceLib/Services/UpdateService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index 4a4e89d9..c0518b42 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -20,7 +20,7 @@ public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases"; public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/"; public const string SingboxRulesetUrl = @"https://raw.githubusercontent.com/2dust/sing-box-rules/rule-set-{0}/{1}.srs"; - public const string IPAPIUrl = "https://ipapi.co/json"; + public const string IPAPIUrl = "https://api.ip.sb/geoip"; public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw="; public const string ConfigFileName = "guiNConfig.json"; diff --git a/v2rayN/ServiceLib/Services/UpdateService.cs b/v2rayN/ServiceLib/Services/UpdateService.cs index 7ce7975f..bd0f6a2b 100644 --- a/v2rayN/ServiceLib/Services/UpdateService.cs +++ b/v2rayN/ServiceLib/Services/UpdateService.cs @@ -249,9 +249,9 @@ namespace ServiceLib.Services var ip = Global.None; if (time > 0) { - var result = await downloadHandle.TryDownloadString(Global.IPAPIUrl, true, "ipapi"); + var result = await downloadHandle.TryDownloadString(Global.IPAPIUrl, true, Global.IPAPIUrl); var ipInfo = JsonUtils.Deserialize(result); - ip = $"({ipInfo?.country}) {ipInfo?.ip}"; + ip = $"({ipInfo?.country_code}) {ipInfo?.ip}"; } updateFunc?.Invoke(false, string.Format(ResUI.TestMeOutput, time, ip));