mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-11 23:15:01 +03:00
Custom geo file source from settings (#5829)
Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
@@ -114,6 +114,11 @@
|
||||
@"http://www.msftconnecttest.com/connecttest.txt",
|
||||
};
|
||||
|
||||
public static readonly List<string> GeoFilesSources = new() {
|
||||
GeoUrl,
|
||||
@"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/{0}.dat",
|
||||
};
|
||||
|
||||
public static readonly Dictionary<string, string> UserAgentTexts = new()
|
||||
{
|
||||
{"chrome","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" },
|
||||
|
||||
@@ -103,6 +103,8 @@
|
||||
public int trayMenuServersLimit { get; set; } = 20;
|
||||
|
||||
public bool enableHWA { get; set; } = false;
|
||||
|
||||
public string geoSourceUrl { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
Generated
+12
-1
@@ -3003,7 +3003,18 @@ namespace ServiceLib.Resx {
|
||||
return ResourceManager.GetString("TbSettingsFontSize", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get Geo files source.
|
||||
/// </summary>
|
||||
public static string TbSettingsGeoFilesSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("TbSettingsGeoFilesSource", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 HTTP Port 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -1322,9 +1322,12 @@
|
||||
<value>Host filter</value>
|
||||
</data>
|
||||
<data name="TipActiveServer" xml:space="preserve">
|
||||
<value>Active</value>
|
||||
<value>Active</value>
|
||||
</data>
|
||||
<data name="menuStorageUI" xml:space="preserve">
|
||||
<value>Save Interface Layout</value>
|
||||
</data>
|
||||
<data name="TbSettingsGeoFilesSource" xml:space="preserve">
|
||||
<value>Geo files source</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -255,8 +255,8 @@ namespace ServiceLib.Services
|
||||
|
||||
public async Task UpdateGeoFileAll(Config config, Action<bool, string> updateFunc)
|
||||
{
|
||||
await UpdateGeoFile("geosite", _config, updateFunc);
|
||||
await UpdateGeoFile("geoip", _config, updateFunc);
|
||||
await UpdateGeoFile("geosite", config, updateFunc);
|
||||
await UpdateGeoFile("geoip", config, updateFunc);
|
||||
_updateFunc?.Invoke(true, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, "geo"));
|
||||
}
|
||||
|
||||
@@ -450,6 +450,8 @@ namespace ServiceLib.Services
|
||||
{
|
||||
_config = config;
|
||||
_updateFunc = updateFunc;
|
||||
|
||||
var geoUrl = !String.IsNullOrEmpty(config?.guiItem.geoSourceUrl) ? config.guiItem.geoSourceUrl : Global.GeoUrl;
|
||||
var url = string.Format(Global.GeoUrl, geoName);
|
||||
var fileName = Utils.GetTempPath(Utils.GetGuid());
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace ServiceLib.ViewModels
|
||||
[Reactive] public bool EnableHWA { get; set; }
|
||||
[Reactive] public string SubConvertUrl { get; set; }
|
||||
[Reactive] public int MainGirdOrientation { get; set; }
|
||||
[Reactive] public string GeoFileSourceUrl { get; set; }
|
||||
|
||||
#endregion UI
|
||||
|
||||
@@ -164,6 +165,7 @@ namespace ServiceLib.ViewModels
|
||||
EnableHWA = _config.guiItem.enableHWA;
|
||||
SubConvertUrl = _config.constItem.subConvertUrl;
|
||||
MainGirdOrientation = (int)_config.uiItem.mainGirdOrientation;
|
||||
GeoFileSourceUrl = _config.guiItem.geoSourceUrl;
|
||||
|
||||
#endregion UI
|
||||
|
||||
@@ -316,6 +318,7 @@ namespace ServiceLib.ViewModels
|
||||
_config.guiItem.enableHWA = EnableHWA;
|
||||
_config.constItem.subConvertUrl = SubConvertUrl;
|
||||
_config.uiItem.mainGirdOrientation = (EGirdOrientation)MainGirdOrientation;
|
||||
_config.guiItem.geoSourceUrl = GeoFileSourceUrl;
|
||||
|
||||
//systemProxy
|
||||
_config.systemProxyItem.systemProxyExceptions = systemProxyExceptions;
|
||||
|
||||
Reference in New Issue
Block a user