From 78d182fff3f762a2b0166256dc9b46afb8292c0b Mon Sep 17 00:00:00 2001
From: 2dust <31833384+2dust@users.noreply.github.com>
Date: Fri, 25 Oct 2024 11:06:04 +0800
Subject: [PATCH] Add a warning about the use of insecure HTTP protocol
subscription address
---
v2rayN/ServiceLib/Handler/ConfigHandler.cs | 4 +++-
v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 18 ++++++++++++++++++
v2rayN/ServiceLib/Resx/ResUI.resx | 6 ++++++
v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 6 ++++++
v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 6 ++++++
.../ViewModels/MainWindowViewModel.cs | 8 ++++++++
.../ServiceLib/ViewModels/SubEditViewModel.cs | 6 +++---
7 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
index 62c51ceb..ef0cdfae 100644
--- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
@@ -1340,7 +1340,9 @@ namespace ServiceLib.Handler
//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);
diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
index b5508c71..fdbef241 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
+++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
@@ -294,6 +294,24 @@ namespace ServiceLib.Resx {
}
}
+ ///
+ /// 查找类似 Please do not use the insecure HTTP protocol subscription address 的本地化字符串。
+ ///
+ public static string InsecureUrlProtocol {
+ get {
+ return ResourceManager.GetString("InsecureUrlProtocol", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Invalid address (Url) 的本地化字符串。
+ ///
+ public static string InvalidUrlTip {
+ get {
+ return ResourceManager.GetString("InvalidUrlTip", resourceCulture);
+ }
+ }
+
///
/// 查找类似 {0} {1} already up to date. 的本地化字符串。
///
diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx
index 636ad527..9eeaac0c 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.resx
@@ -1354,4 +1354,10 @@
Scan QR code in the image
+
+ Invalid address (Url)
+
+
+ Please do not use the insecure HTTP protocol subscription address
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
index f6ba0dc5..a4f565e9 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
@@ -1351,4 +1351,10 @@
扫描图片中的二维码
+
+ 地址(Url)无效
+
+
+ 请不要使用不安全的HTTP协议订阅地址
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
index 08c31baa..ebc9be17 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
@@ -1231,4 +1231,10 @@
掃描圖片中的二維碼
+
+ 地址(Url)無效
+
+
+ 請不要使用不安全的HTTP協定訂閱位址
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
index e1961b2a..1352b987 100644
--- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
@@ -389,6 +389,10 @@ namespace ServiceLib.ViewModels
RefreshServers();
NoticeHandler.Instance.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
}
+ else
+ {
+ NoticeHandler.Instance.Enqueue(ResUI.OperationFailed);
+ }
}
public async Task AddServerViaScanAsync()
@@ -433,6 +437,10 @@ namespace ServiceLib.ViewModels
RefreshServers();
NoticeHandler.Instance.Enqueue(ResUI.SuccessfullyImportedServerViaScan);
}
+ else
+ {
+ NoticeHandler.Instance.Enqueue(ResUI.OperationFailed);
+ }
}
}
diff --git a/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs b/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs
index 5ef396cb..03588adc 100644
--- a/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs
@@ -39,14 +39,14 @@ namespace ServiceLib.ViewModels
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;
}
}