mirror of https://github.com/2dust/v2rayN
Add a warning about the use of insecure HTTP protocol subscription address
parent
0efb0b5e3e
commit
78d182fff3
|
@ -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);
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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…
Reference in New Issue