Browse Source

Added real IP location display

https://ipapi.co/api/?shell#introduction
pull/6126/head
2dust 3 days ago
parent
commit
bee66d06dd
  1. 1
      v2rayN/ServiceLib/Global.cs
  2. 13
      v2rayN/ServiceLib/Models/IPAPIInfo.cs
  3. 2
      v2rayN/ServiceLib/Resx/ResUI.Designer.cs
  4. 2
      v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
  5. 2
      v2rayN/ServiceLib/Resx/ResUI.resx
  6. 2
      v2rayN/ServiceLib/Resx/ResUI.ru.resx
  7. 2
      v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
  8. 2
      v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
  9. 13
      v2rayN/ServiceLib/Services/UpdateService.cs

1
v2rayN/ServiceLib/Global.cs

@ -20,6 +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 PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw=";
public const string ConfigFileName = "guiNConfig.json";

13
v2rayN/ServiceLib/Models/IPAPIInfo.cs

@ -0,0 +1,13 @@
namespace ServiceLib.Models
{
internal class IPAPIInfo
{
public string? ip { get; set; }
public string? city { get; set; }
public string? region { get; set; }
public string? region_code { get; set; }
public string? country { get; set; }
public string? country_name { get; set; }
public string? country_code { get; set; }
}
}

2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs generated

@ -3644,7 +3644,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 The ping of current service: {0} ms 的本地化字符串。
/// 查找类似 The delay : {0} ms, {1} 的本地化字符串。
/// </summary>
public static string TestMeOutput {
get {

2
v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx

@ -302,7 +302,7 @@
<value>اسکن URL وارد کردن با موفقیت</value>
</data>
<data name="TestMeOutput" xml:space="preserve">
<value>پینگ سرویس فعلی: {0} ms</value>
<value>پینگ سرویس فعلی: {0} ms, {1}</value>
</data>
<data name="OperationSuccess" xml:space="preserve">
<value>موفقیت عملیات</value>

2
v2rayN/ServiceLib/Resx/ResUI.resx

@ -302,7 +302,7 @@
<value>Scan import the shared link successfully</value>
</data>
<data name="TestMeOutput" xml:space="preserve">
<value>The ping of current service: {0} ms</value>
<value>The delay : {0} ms, {1}</value>
</data>
<data name="OperationSuccess" xml:space="preserve">
<value>Operation success</value>

2
v2rayN/ServiceLib/Resx/ResUI.ru.resx

@ -302,7 +302,7 @@
<value>Сканирование URL-адреса импорта успешна.</value>
</data>
<data name="TestMeOutput" xml:space="preserve">
<value>Задержка текущего сервера: {0} мс</value>
<value>Задержка текущего сервера: {0} мс, {1}</value>
</data>
<data name="OperationSuccess" xml:space="preserve">
<value>Операция успешна</value>

2
v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx

@ -302,7 +302,7 @@
<value>扫描导入分享链接成功</value>
</data>
<data name="TestMeOutput" xml:space="preserve">
<value>当前服务的真连接延迟: {0} ms</value>
<value>当前延迟: {0} ms,{1}</value>
</data>
<data name="OperationSuccess" xml:space="preserve">
<value>操作成功</value>

2
v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx

@ -301,7 +301,7 @@
<value>掃描匯入分享链接成功</value>
</data>
<data name="TestMeOutput" xml:space="preserve">
<value>目前服務的真連線延遲: {0} ms</value>
<value>目前延遲: {0} ms,{1}</value>
</data>
<data name="OperationSuccess" xml:space="preserve">
<value>操作成功</value>

13
v2rayN/ServiceLib/Services/UpdateService.cs

@ -244,8 +244,17 @@ namespace ServiceLib.Services
public async Task RunAvailabilityCheck(Action<bool, string> updateFunc)
{
var time = await new DownloadService().RunAvailabilityCheck(null);
updateFunc?.Invoke(false, string.Format(ResUI.TestMeOutput, time));
var downloadHandle = new DownloadService();
var time = await downloadHandle.RunAvailabilityCheck(null);
var ip = Global.None;
if (time > 0)
{
var result = await downloadHandle.TryDownloadString(Global.IPAPIUrl, true, "ipapi");
var ipInfo = JsonUtils.Deserialize<IPAPIInfo>(result);
ip = $"({ipInfo?.country}) {ipInfo?.ip}";
}
updateFunc?.Invoke(false, string.Format(ResUI.TestMeOutput, time, ip));
}
#region CheckUpdate private

Loading…
Cancel
Save