Skip to content

Commit

Permalink
Add a warning about the use of insecure HTTP protocol subscription a…
Browse files Browse the repository at this point in the history
…ddress
  • Loading branch information
2dust committed Oct 25, 2024
1 parent 0efb0b5 commit 78d182f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 4 deletions.
4 changes: 3 additions & 1 deletion v2rayN/ServiceLib/Handler/ConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,9 @@ public static async Task<int> AddSubItem(Config config, string url)
//Do not allow http protocol
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);
Expand Down
18 changes: 18 additions & 0 deletions v2rayN/ServiceLib/Resx/ResUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions v2rayN/ServiceLib/Resx/ResUI.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1354,4 +1354,10 @@
<data name="menuAddServerViaImage" xml:space="preserve">
<value>Scan QR code in the image</value>
</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>
6 changes: 6 additions & 0 deletions v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1351,4 +1351,10 @@
<data name="menuAddServerViaImage" xml:space="preserve">
<value>扫描图片中的二维码</value>
</data>
<data name="InvalidUrlTip" xml:space="preserve">
<value>地址(Url)无效</value>
</data>
<data name="InsecureUrlProtocol" xml:space="preserve">
<value>请不要使用不安全的HTTP协议订阅地址</value>
</data>
</root>
6 changes: 6 additions & 0 deletions v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1231,4 +1231,10 @@
<data name="menuAddServerViaImage" xml:space="preserve">
<value>掃描圖片中的二維碼</value>
</data>
<data name="InvalidUrlTip" xml:space="preserve">
<value>地址(Url)無效</value>
</data>
<data name="InsecureUrlProtocol" xml:space="preserve">
<value>請不要使用不安全的HTTP協定訂閱位址</value>
</data>
</root>
8 changes: 8 additions & 0 deletions v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ public async Task AddServerViaClipboardAsync(string? clipboardData)
RefreshServers();
NoticeHandler.Instance.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
}
else
{
NoticeHandler.Instance.Enqueue(ResUI.OperationFailed);
}
}

public async Task AddServerViaScanAsync()
Expand Down Expand Up @@ -433,6 +437,10 @@ private async Task AddScanResultAsync(string? result)
RefreshServers();
NoticeHandler.Instance.Enqueue(ResUI.SuccessfullyImportedServerViaScan);
}
else
{
NoticeHandler.Instance.Enqueue(ResUI.OperationFailed);
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ private async Task SaveSubAsync()
var uri = Utils.TryUri(url);
if (uri == null)
{
NoticeHandler.Instance.Enqueue(ResUI.LvUrl);
NoticeHandler.Instance.Enqueue(ResUI.InvalidUrlTip);
return;
}
//Do not allow http protocol
if (url.StartsWith(Global.HttpProtocol) && !Utils.IsPrivateNetwork(uri.IdnHost))
{
NoticeHandler.Instance.Enqueue(ResUI.LvUrl);
return;
NoticeHandler.Instance.Enqueue(ResUI.InsecureUrlProtocol);
//return;
}
}

Expand Down

0 comments on commit 78d182f

Please sign in to comment.