mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 11:59:13 +00:00
Rename ActionPrecheckService
This commit is contained in:
parent
fce4a7b74c
commit
7a750a127e
9 changed files with 15 additions and 17 deletions
|
@ -1,14 +1,12 @@
|
||||||
using DynamicData;
|
namespace ServiceLib.Manager;
|
||||||
|
|
||||||
namespace ServiceLib.Services;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Centralized pre-checks before sensitive actions (set active profile, generate config, etc.).
|
/// Centralized pre-checks before sensitive actions (set active profile, generate config, etc.).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ActionPrecheckService(Config config)
|
public class ActionPrecheckManager(Config config)
|
||||||
{
|
{
|
||||||
private static readonly Lazy<ActionPrecheckService> _instance = new(() => new ActionPrecheckService(AppManager.Instance.Config));
|
private static readonly Lazy<ActionPrecheckManager> _instance = new(() => new ActionPrecheckManager(AppManager.Instance.Config));
|
||||||
public static ActionPrecheckService Instance => _instance.Value;
|
public static ActionPrecheckManager Instance => _instance.Value;
|
||||||
|
|
||||||
private readonly Config _config = config;
|
private readonly Config _config = config;
|
||||||
|
|
||||||
|
@ -88,7 +86,7 @@ public class ActionPrecheckService(Config config)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.VLESS:
|
case EConfigType.VLESS:
|
||||||
if (item.Id.IsNullOrEmpty() || (!Utils.IsGuidByParse(item.Id) && item.Id.Length > 30))
|
if (item.Id.IsNullOrEmpty() || !Utils.IsGuidByParse(item.Id) && item.Id.Length > 30)
|
||||||
errors.Add(string.Format(ResUI.InvalidProperty, "Id"));
|
errors.Add(string.Format(ResUI.InvalidProperty, "Id"));
|
||||||
if (!Global.Flows.Contains(item.Flow))
|
if (!Global.Flows.Contains(item.Flow))
|
||||||
errors.Add(string.Format(ResUI.InvalidProperty, "Flow"));
|
errors.Add(string.Format(ResUI.InvalidProperty, "Flow"));
|
||||||
|
@ -102,7 +100,7 @@ public class ActionPrecheckService(Config config)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((item.ConfigType is EConfigType.VLESS or EConfigType.Trojan)
|
if (item.ConfigType is EConfigType.VLESS or EConfigType.Trojan
|
||||||
&& item.StreamSecurity == Global.StreamSecurityReality
|
&& item.StreamSecurity == Global.StreamSecurityReality
|
||||||
&& item.PublicKey.IsNullOrEmpty())
|
&& item.PublicKey.IsNullOrEmpty())
|
||||||
{
|
{
|
2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
@ -304,7 +304,7 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 The group "{0}" cannot reference itself. 的本地化字符串。
|
/// 查找类似 {0} Group cannot reference itself or have a circular reference 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GroupSelfReference {
|
public static string GroupSelfReference {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -1588,7 +1588,7 @@
|
||||||
<value>The {0} property is invalid, please check.</value>
|
<value>The {0} property is invalid, please check.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GroupSelfReference" xml:space="preserve">
|
<data name="GroupSelfReference" xml:space="preserve">
|
||||||
<value>The group "{0}" cannot reference itself.</value>
|
<value>{0} Group cannot reference itself or have a circular reference</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NotSupportProtocol" xml:space="preserve">
|
<data name="NotSupportProtocol" xml:space="preserve">
|
||||||
<value>Not support protocol '{0}'.</value>
|
<value>Not support protocol '{0}'.</value>
|
||||||
|
|
|
@ -1588,7 +1588,7 @@
|
||||||
<value>The {0} property is invalid, please check.</value>
|
<value>The {0} property is invalid, please check.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GroupSelfReference" xml:space="preserve">
|
<data name="GroupSelfReference" xml:space="preserve">
|
||||||
<value>The group "{0}" cannot reference itself.</value>
|
<value>{0} Group cannot reference itself or have a circular reference</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NotSupportProtocol" xml:space="preserve">
|
<data name="NotSupportProtocol" xml:space="preserve">
|
||||||
<value>Not support protocol '{0}'.</value>
|
<value>Not support protocol '{0}'.</value>
|
||||||
|
|
|
@ -1588,7 +1588,7 @@
|
||||||
<value>The {0} property is invalid, please check.</value>
|
<value>The {0} property is invalid, please check.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GroupSelfReference" xml:space="preserve">
|
<data name="GroupSelfReference" xml:space="preserve">
|
||||||
<value>The group "{0}" cannot reference itself.</value>
|
<value>{0} Group cannot reference itself or have a circular reference</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NotSupportProtocol" xml:space="preserve">
|
<data name="NotSupportProtocol" xml:space="preserve">
|
||||||
<value>Not support protocol '{0}'.</value>
|
<value>Not support protocol '{0}'.</value>
|
||||||
|
|
|
@ -1588,7 +1588,7 @@
|
||||||
<value>The {0} property is invalid, please check.</value>
|
<value>The {0} property is invalid, please check.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GroupSelfReference" xml:space="preserve">
|
<data name="GroupSelfReference" xml:space="preserve">
|
||||||
<value>The group "{0}" cannot reference itself.</value>
|
<value>{0} Group cannot reference itself or have a circular reference</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NotSupportProtocol" xml:space="preserve">
|
<data name="NotSupportProtocol" xml:space="preserve">
|
||||||
<value>Not support protocol '{0}'.</value>
|
<value>Not support protocol '{0}'.</value>
|
||||||
|
|
|
@ -1585,7 +1585,7 @@
|
||||||
<value>{0}属性无效,请检查</value>
|
<value>{0}属性无效,请检查</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GroupSelfReference" xml:space="preserve">
|
<data name="GroupSelfReference" xml:space="preserve">
|
||||||
<value>{0} 分组不能引用自身</value>
|
<value>{0} 分组不能引用自身或循环引用</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NotSupportProtocol" xml:space="preserve">
|
<data name="NotSupportProtocol" xml:space="preserve">
|
||||||
<value>不支持协议 '{0}'。</value>
|
<value>不支持协议 '{0}'。</value>
|
||||||
|
|
|
@ -1585,7 +1585,7 @@
|
||||||
<value>The {0} property is invalid, please check.</value>
|
<value>The {0} property is invalid, please check.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GroupSelfReference" xml:space="preserve">
|
<data name="GroupSelfReference" xml:space="preserve">
|
||||||
<value>The group "{0}" cannot reference itself.</value>
|
<value>{0} 分組不能引用自身或循環引用</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="NotSupportProtocol" xml:space="preserve">
|
<data name="NotSupportProtocol" xml:space="preserve">
|
||||||
<value>Not support protocol '{0}'.</value>
|
<value>Not support protocol '{0}'.</value>
|
||||||
|
|
|
@ -605,7 +605,7 @@ public class ProfilesViewModel : MyReactiveObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var msgs = await ActionPrecheckService.Instance.CheckBeforeSetActive(indexId);
|
var msgs = await ActionPrecheckManager.Instance.CheckBeforeSetActive(indexId);
|
||||||
foreach (var msg in msgs)
|
foreach (var msg in msgs)
|
||||||
{
|
{
|
||||||
NoticeManager.Instance.SendMessage(msg);
|
NoticeManager.Instance.SendMessage(msg);
|
||||||
|
@ -779,7 +779,7 @@ public class ProfilesViewModel : MyReactiveObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var msgs = await ActionPrecheckService.Instance.CheckBeforeGenerateConfig(item);
|
var msgs = await ActionPrecheckManager.Instance.CheckBeforeGenerateConfig(item);
|
||||||
foreach (var msg in msgs)
|
foreach (var msg in msgs)
|
||||||
{
|
{
|
||||||
NoticeManager.Instance.SendMessage(msg);
|
NoticeManager.Instance.SendMessage(msg);
|
||||||
|
|
Loading…
Reference in a new issue