This commit is contained in:
DHR60 2025-11-02 12:07:59 +08:00
parent ebb47ee516
commit c14a0e33b7
9 changed files with 51 additions and 3 deletions

View file

@ -19,7 +19,7 @@ namespace ServiceLib.Resx {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。 // (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class ResUI { public class ResUI {
@ -2301,6 +2301,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Please set a valid domain 的本地化字符串。
/// </summary>
public static string ServerNameMustBeValidDomain {
get {
return ResourceManager.GetString("ServerNameMustBeValidDomain", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 {0} : {1}/s↑ | {2}/s↓ 的本地化字符串。 /// 查找类似 {0} : {1}/s↑ | {2}/s↓ 的本地化字符串。
/// </summary> /// </summary>

View file

@ -1615,4 +1615,7 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
<data name="TbFetchCertChain" xml:space="preserve"> <data name="TbFetchCertChain" xml:space="preserve">
<value>Fetch Certificate Chain</value> <value>Fetch Certificate Chain</value>
</data> </data>
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
<value>Please set a valid domain</value>
</data>
</root> </root>

View file

@ -1612,4 +1612,7 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
<data name="TbFetchCertChain" xml:space="preserve"> <data name="TbFetchCertChain" xml:space="preserve">
<value>Fetch Certificate Chain</value> <value>Fetch Certificate Chain</value>
</data> </data>
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
<value>Please set a valid domain</value>
</data>
</root> </root>

View file

@ -1615,4 +1615,7 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
<data name="TbFetchCertChain" xml:space="preserve"> <data name="TbFetchCertChain" xml:space="preserve">
<value>Fetch Certificate Chain</value> <value>Fetch Certificate Chain</value>
</data> </data>
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
<value>Please set a valid domain</value>
</data>
</root> </root>

View file

@ -1615,4 +1615,7 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
<data name="TbFetchCertChain" xml:space="preserve"> <data name="TbFetchCertChain" xml:space="preserve">
<value>Fetch Certificate Chain</value> <value>Fetch Certificate Chain</value>
</data> </data>
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
<value>Please set a valid domain</value>
</data>
</root> </root>

View file

@ -1615,4 +1615,7 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
<data name="TbFetchCertChain" xml:space="preserve"> <data name="TbFetchCertChain" xml:space="preserve">
<value>Fetch Certificate Chain</value> <value>Fetch Certificate Chain</value>
</data> </data>
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
<value>Please set a valid domain</value>
</data>
</root> </root>

View file

@ -1612,4 +1612,7 @@
<data name="TbFetchCertChain" xml:space="preserve"> <data name="TbFetchCertChain" xml:space="preserve">
<value>获取证书链</value> <value>获取证书链</value>
</data> </data>
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
<value>请设置有效的域名</value>
</data>
</root> </root>

View file

@ -1612,4 +1612,7 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
<data name="TbFetchCertChain" xml:space="preserve"> <data name="TbFetchCertChain" xml:space="preserve">
<value>Fetch Certificate Chain</value> <value>Fetch Certificate Chain</value>
</data> </data>
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
<value>Please set a valid domain</value>
</data>
</root> </root>

View file

@ -111,9 +111,18 @@ public class AddServerViewModel : MyReactiveObject
return; return;
} }
var domain = SelectedSource.Address; var domain = SelectedSource.Address;
var serverName = SelectedSource.Sni.IsNullOrEmpty() ? SelectedSource.Address : SelectedSource.Sni; var serverName = SelectedSource.Sni;
if (serverName.IsNullOrEmpty())
{
serverName = SelectedSource.RequestHost;
}
if (serverName.IsNullOrEmpty())
{
serverName = SelectedSource.Address;
}
if (!Utils.IsDomain(serverName)) if (!Utils.IsDomain(serverName))
{ {
NoticeManager.Instance.Enqueue(ResUI.ServerNameMustBeValidDomain);
return; return;
} }
if (SelectedSource.Port > 0) if (SelectedSource.Port > 0)
@ -130,9 +139,18 @@ public class AddServerViewModel : MyReactiveObject
return; return;
} }
var domain = SelectedSource.Address; var domain = SelectedSource.Address;
var serverName = SelectedSource.Sni.IsNullOrEmpty() ? SelectedSource.Address : SelectedSource.Sni; var serverName = SelectedSource.Sni;
if (serverName.IsNullOrEmpty())
{
serverName = SelectedSource.RequestHost;
}
if (serverName.IsNullOrEmpty())
{
serverName = SelectedSource.Address;
}
if (!Utils.IsDomain(serverName)) if (!Utils.IsDomain(serverName))
{ {
NoticeManager.Instance.Enqueue(ResUI.ServerNameMustBeValidDomain);
return; return;
} }
if (SelectedSource.Port > 0) if (SelectedSource.Port > 0)