Browse Source

Add a warning about the use of insecure HTTP protocol subscription address

pull/5940/head
2dust 4 weeks ago
parent
commit
78d182fff3
  1. 4
      v2rayN/ServiceLib/Handler/ConfigHandler.cs
  2. 18
      v2rayN/ServiceLib/Resx/ResUI.Designer.cs
  3. 6
      v2rayN/ServiceLib/Resx/ResUI.resx
  4. 6
      v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
  5. 6
      v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
  6. 8
      v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
  7. 6
      v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs

4
v2rayN/ServiceLib/Handler/ConfigHandler.cs

@ -1340,7 +1340,9 @@ namespace ServiceLib.Handler
//Do not allow http protocol //Do not allow http protocol
if (url.StartsWith(Global.HttpProtocol) && !Utils.IsPrivateNetwork(uri.IdnHost)) if (url.StartsWith(Global.HttpProtocol) && !Utils.IsPrivateNetwork(uri.IdnHost))
{ {
return -1; //TODO Temporary reminder to be removed later
NoticeHandler.Instance.Enqueue(ResUI.InsecureUrlProtocol);
//return -1;
} }
var queryVars = Utils.ParseQueryString(uri.Query); var queryVars = Utils.ParseQueryString(uri.Query);

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

@ -294,6 +294,24 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Please do not use the insecure HTTP protocol subscription address 的本地化字符串。
/// </summary>
public static string InsecureUrlProtocol {
get {
return ResourceManager.GetString("InsecureUrlProtocol", resourceCulture);
}
}
/// <summary>
/// 查找类似 Invalid address (Url) 的本地化字符串。
/// </summary>
public static string InvalidUrlTip {
get {
return ResourceManager.GetString("InvalidUrlTip", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 {0} {1} already up to date. 的本地化字符串。 /// 查找类似 {0} {1} already up to date. 的本地化字符串。
/// </summary> /// </summary>

6
v2rayN/ServiceLib/Resx/ResUI.resx

@ -1354,4 +1354,10 @@
<data name="menuAddServerViaImage" xml:space="preserve"> <data name="menuAddServerViaImage" xml:space="preserve">
<value>Scan QR code in the image</value> <value>Scan QR code in the image</value>
</data> </data>
<data name="InvalidUrlTip" xml:space="preserve">
<value>Invalid address (Url)</value>
</data>
<data name="InsecureUrlProtocol" xml:space="preserve">
<value>Please do not use the insecure HTTP protocol subscription address</value>
</data>
</root> </root>

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

@ -1351,4 +1351,10 @@
<data name="menuAddServerViaImage" xml:space="preserve"> <data name="menuAddServerViaImage" xml:space="preserve">
<value>扫描图片中的二维码</value> <value>扫描图片中的二维码</value>
</data> </data>
<data name="InvalidUrlTip" xml:space="preserve">
<value>地址(Url)无效</value>
</data>
<data name="InsecureUrlProtocol" xml:space="preserve">
<value>请不要使用不安全的HTTP协议订阅地址</value>
</data>
</root> </root>

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

@ -1231,4 +1231,10 @@
<data name="menuAddServerViaImage" xml:space="preserve"> <data name="menuAddServerViaImage" xml:space="preserve">
<value>掃描圖片中的二維碼</value> <value>掃描圖片中的二維碼</value>
</data> </data>
<data name="InvalidUrlTip" xml:space="preserve">
<value>地址(Url)無效</value>
</data>
<data name="InsecureUrlProtocol" xml:space="preserve">
<value>請不要使用不安全的HTTP協定訂閱位址</value>
</data>
</root> </root>

8
v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs

@ -389,6 +389,10 @@ namespace ServiceLib.ViewModels
RefreshServers(); RefreshServers();
NoticeHandler.Instance.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret)); NoticeHandler.Instance.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
} }
else
{
NoticeHandler.Instance.Enqueue(ResUI.OperationFailed);
}
} }
public async Task AddServerViaScanAsync() public async Task AddServerViaScanAsync()
@ -433,6 +437,10 @@ namespace ServiceLib.ViewModels
RefreshServers(); RefreshServers();
NoticeHandler.Instance.Enqueue(ResUI.SuccessfullyImportedServerViaScan); NoticeHandler.Instance.Enqueue(ResUI.SuccessfullyImportedServerViaScan);
} }
else
{
NoticeHandler.Instance.Enqueue(ResUI.OperationFailed);
}
} }
} }

6
v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs

@ -39,14 +39,14 @@ namespace ServiceLib.ViewModels
var uri = Utils.TryUri(url); var uri = Utils.TryUri(url);
if (uri == null) if (uri == null)
{ {
NoticeHandler.Instance.Enqueue(ResUI.LvUrl); NoticeHandler.Instance.Enqueue(ResUI.InvalidUrlTip);
return; return;
} }
//Do not allow http protocol //Do not allow http protocol
if (url.StartsWith(Global.HttpProtocol) && !Utils.IsPrivateNetwork(uri.IdnHost)) if (url.StartsWith(Global.HttpProtocol) && !Utils.IsPrivateNetwork(uri.IdnHost))
{ {
NoticeHandler.Instance.Enqueue(ResUI.LvUrl); NoticeHandler.Instance.Enqueue(ResUI.InsecureUrlProtocol);
return; //return;
} }
} }

Loading…
Cancel
Save