mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-06 21:42:08 +03:00
Remove global AllowInsecure and MuxEnabled (#9473)
* Remove global AllowInsecure * Remove global MuxEnabled * Fix core config * Centralize AllowInsecure handling * Warn insecure configuration --------- Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,12 @@ public class AddServerViewModel : MyReactiveObject
|
||||
[Reactive]
|
||||
public string? CoreType { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool AllowInsecure { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool MuxEnabled { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string Cert { get; set; }
|
||||
|
||||
@@ -273,8 +279,10 @@ public class AddServerViewModel : MyReactiveObject
|
||||
SelectedSource = JsonUtils.DeepCopy(profileItem);
|
||||
}
|
||||
CoreType = SelectedSource?.CoreType?.ToString();
|
||||
Cert = SelectedSource?.Cert?.ToString() ?? string.Empty;
|
||||
CertSha = SelectedSource?.CertSha?.ToString() ?? string.Empty;
|
||||
AllowInsecure = SelectedSource?.GetAllowInsecure() == true;
|
||||
MuxEnabled = SelectedSource?.MuxEnabled == true;
|
||||
Cert = SelectedSource?.Cert ?? string.Empty;
|
||||
CertSha = SelectedSource?.CertSha ?? string.Empty;
|
||||
|
||||
var protocolExtra = SelectedSource?.GetProtocolExtra() ?? new();
|
||||
var transport = SelectedSource?.GetTransportExtra() ?? new();
|
||||
@@ -352,7 +360,9 @@ public class AddServerViewModel : MyReactiveObject
|
||||
return;
|
||||
}
|
||||
}
|
||||
SelectedSource.CoreType = CoreType.IsNullOrEmpty() ? null : (ECoreType)Enum.Parse(typeof(ECoreType), CoreType);
|
||||
SelectedSource.CoreType = CoreType.IsNullOrEmpty() ? null : Enum.Parse<ECoreType>(CoreType);
|
||||
SelectedSource.AllowInsecure = AllowInsecure ? Global.StringTrue : Global.StringFalse;
|
||||
SelectedSource.MuxEnabled = MuxEnabled;
|
||||
SelectedSource.Cert = Cert.IsNullOrEmpty() ? string.Empty : Cert;
|
||||
SelectedSource.CertSha = CertSha.IsNullOrEmpty() ? string.Empty : CertSha;
|
||||
if (!Global.Networks.Contains(SelectedSource.Network))
|
||||
|
||||
@@ -14,10 +14,8 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
[Reactive] public bool NewPort4LAN { get; set; }
|
||||
[Reactive] public string User { get; set; }
|
||||
[Reactive] public string Pass { get; set; }
|
||||
[Reactive] public bool MuxEnabled { get; set; }
|
||||
[Reactive] public bool LogEnabled { get; set; }
|
||||
[Reactive] public string Loglevel { get; set; }
|
||||
[Reactive] public bool DefAllowInsecure { get; set; }
|
||||
[Reactive] public string DefFingerprint { get; set; }
|
||||
[Reactive] public string DefUserAgent { get; set; }
|
||||
[Reactive] public string SendThrough { get; set; }
|
||||
@@ -152,10 +150,8 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
NewPort4LAN = inbound.NewPort4LAN;
|
||||
User = inbound.User;
|
||||
Pass = inbound.Pass;
|
||||
MuxEnabled = _config.CoreBasicItem.MuxEnabled;
|
||||
LogEnabled = _config.CoreBasicItem.LogEnabled;
|
||||
Loglevel = _config.CoreBasicItem.Loglevel;
|
||||
DefAllowInsecure = _config.CoreBasicItem.DefAllowInsecure;
|
||||
DefFingerprint = _config.CoreBasicItem.DefFingerprint;
|
||||
DefUserAgent = _config.CoreBasicItem.DefUserAgent;
|
||||
SendThrough = _config.CoreBasicItem.SendThrough ?? string.Empty;
|
||||
@@ -346,8 +342,6 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
}
|
||||
_config.CoreBasicItem.LogEnabled = LogEnabled;
|
||||
_config.CoreBasicItem.Loglevel = Loglevel;
|
||||
_config.CoreBasicItem.MuxEnabled = MuxEnabled;
|
||||
_config.CoreBasicItem.DefAllowInsecure = DefAllowInsecure;
|
||||
_config.CoreBasicItem.DefFingerprint = DefFingerprint;
|
||||
_config.CoreBasicItem.DefUserAgent = DefUserAgent;
|
||||
_config.CoreBasicItem.SendThrough = SendThrough.TrimEx();
|
||||
|
||||
Reference in New Issue
Block a user