mirror of
https://github.com/2dust/v2rayN.git
synced 2025-11-29 03:02:53 +00:00
Compare commits
No commits in common. "32583ea8b377677b4da30781adb7b703a5f45dce" and "753e7b81b6cca16c374f1ca1499ff87208b11825" have entirely different histories.
32583ea8b3
...
753e7b81b6
20 changed files with 30 additions and 221 deletions
|
|
@ -97,7 +97,7 @@ public static class ConfigHandler
|
||||||
|
|
||||||
config.UiItem ??= new UIItem()
|
config.UiItem ??= new UIItem()
|
||||||
{
|
{
|
||||||
EnableUpdateSubOnlyRemarksExist = true
|
EnableAutoAdjustMainLvColWidth = true
|
||||||
};
|
};
|
||||||
config.UiItem.MainColumnItem ??= new();
|
config.UiItem.MainColumnItem ??= new();
|
||||||
config.UiItem.WindowSizeItem ??= new();
|
config.UiItem.WindowSizeItem ??= new();
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,7 @@ public static class ProxySettingLinux
|
||||||
|
|
||||||
private static async Task ExecCmd(List<string> args)
|
private static async Task ExecCmd(List<string> args)
|
||||||
{
|
{
|
||||||
var customSystemProxyScriptPath = AppManager.Instance.Config.SystemProxyItem?.CustomSystemProxyScriptPath;
|
var fileName = await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetLinuxShellFileName), false);
|
||||||
var fileName = (customSystemProxyScriptPath.IsNotEmpty() && File.Exists(customSystemProxyScriptPath))
|
|
||||||
? customSystemProxyScriptPath
|
|
||||||
: await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetLinuxShellFileName), false);
|
|
||||||
|
|
||||||
// TODO: temporarily notify which script is being used
|
|
||||||
NoticeManager.Instance.SendMessage(fileName);
|
|
||||||
|
|
||||||
await Utils.GetCliWrapOutput(fileName, args);
|
await Utils.GetCliWrapOutput(fileName, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,7 @@ public static class ProxySettingOSX
|
||||||
|
|
||||||
private static async Task ExecCmd(List<string> args)
|
private static async Task ExecCmd(List<string> args)
|
||||||
{
|
{
|
||||||
var customSystemProxyScriptPath = AppManager.Instance.Config.SystemProxyItem?.CustomSystemProxyScriptPath;
|
var fileName = await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetOSXShellFileName), false);
|
||||||
var fileName = (customSystemProxyScriptPath.IsNotEmpty() && File.Exists(customSystemProxyScriptPath))
|
|
||||||
? customSystemProxyScriptPath
|
|
||||||
: await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetOSXShellFileName), false);
|
|
||||||
|
|
||||||
// TODO: temporarily notify which script is being used
|
|
||||||
NoticeManager.Instance.SendMessage(fileName);
|
|
||||||
|
|
||||||
await Utils.GetCliWrapOutput(fileName, args);
|
await Utils.GetCliWrapOutput(fileName, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ public static class SysProxyHandler
|
||||||
private static async Task SetWindowsProxyPac(int port)
|
private static async Task SetWindowsProxyPac(int port)
|
||||||
{
|
{
|
||||||
var portPac = AppManager.Instance.GetLocalPort(EInboundProtocol.pac);
|
var portPac = AppManager.Instance.GetLocalPort(EInboundProtocol.pac);
|
||||||
await PacManager.Instance.StartAsync(port, portPac);
|
await PacManager.Instance.StartAsync(Utils.GetConfigPath(), port, portPac);
|
||||||
var strProxy = $"{Global.HttpProtocol}{Global.Loopback}:{portPac}/pac?t={DateTime.Now.Ticks}";
|
var strProxy = $"{Global.HttpProtocol}{Global.Loopback}:{portPac}/pac?t={DateTime.Now.Ticks}";
|
||||||
ProxySettingWindows.SetProxy(strProxy, "", 4);
|
ProxySettingWindows.SetProxy(strProxy, "", 4);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ public class PacManager
|
||||||
private static readonly Lazy<PacManager> _instance = new(() => new PacManager());
|
private static readonly Lazy<PacManager> _instance = new(() => new PacManager());
|
||||||
public static PacManager Instance => _instance.Value;
|
public static PacManager Instance => _instance.Value;
|
||||||
|
|
||||||
|
private string _configPath;
|
||||||
private int _httpPort;
|
private int _httpPort;
|
||||||
private int _pacPort;
|
private int _pacPort;
|
||||||
private TcpListener? _tcpListener;
|
private TcpListener? _tcpListener;
|
||||||
|
|
@ -12,10 +13,11 @@ public class PacManager
|
||||||
private bool _isRunning;
|
private bool _isRunning;
|
||||||
private bool _needRestart = true;
|
private bool _needRestart = true;
|
||||||
|
|
||||||
public async Task StartAsync(int httpPort, int pacPort)
|
public async Task StartAsync(string configPath, int httpPort, int pacPort)
|
||||||
{
|
{
|
||||||
_needRestart = httpPort != _httpPort || pacPort != _pacPort || !_isRunning;
|
_needRestart = configPath != _configPath || httpPort != _httpPort || pacPort != _pacPort || !_isRunning;
|
||||||
|
|
||||||
|
_configPath = configPath;
|
||||||
_httpPort = httpPort;
|
_httpPort = httpPort;
|
||||||
_pacPort = pacPort;
|
_pacPort = pacPort;
|
||||||
|
|
||||||
|
|
@ -30,22 +32,22 @@ public class PacManager
|
||||||
|
|
||||||
private async Task InitText()
|
private async Task InitText()
|
||||||
{
|
{
|
||||||
var customSystemProxyPacPath = AppManager.Instance.Config.SystemProxyItem?.CustomSystemProxyPacPath;
|
var path = Path.Combine(_configPath, "pac.txt");
|
||||||
var fileName = (customSystemProxyPacPath.IsNotEmpty() && File.Exists(customSystemProxyPacPath))
|
|
||||||
? customSystemProxyPacPath
|
|
||||||
: Path.Combine(Utils.GetConfigPath(), "pac.txt");
|
|
||||||
|
|
||||||
// TODO: temporarily notify which script is being used
|
// Delete the old pac file
|
||||||
NoticeManager.Instance.SendMessage(fileName);
|
if (File.Exists(path) && Utils.GetFileHash(path).Equals("b590c07280f058ef05d5394aa2f927fe"))
|
||||||
|
|
||||||
if (!File.Exists(fileName))
|
|
||||||
{
|
{
|
||||||
var pac = EmbedUtils.GetEmbedText(Global.PacFileName);
|
File.Delete(path);
|
||||||
await File.AppendAllTextAsync(fileName, pac);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var pacText = await File.ReadAllTextAsync(fileName);
|
if (!File.Exists(path))
|
||||||
pacText = pacText.Replace("__PROXY__", $"PROXY 127.0.0.1:{_httpPort};DIRECT;");
|
{
|
||||||
|
var pac = EmbedUtils.GetEmbedText(Global.PacFileName);
|
||||||
|
await File.AppendAllTextAsync(path, pac);
|
||||||
|
}
|
||||||
|
|
||||||
|
var pacText =
|
||||||
|
(await File.ReadAllTextAsync(path)).Replace("__PROXY__", $"PROXY 127.0.0.1:{_httpPort};DIRECT;");
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine("HTTP/1.0 200 OK");
|
sb.AppendLine("HTTP/1.0 200 OK");
|
||||||
|
|
|
||||||
|
|
@ -219,8 +219,6 @@ public class SystemProxyItem
|
||||||
public string SystemProxyExceptions { get; set; }
|
public string SystemProxyExceptions { get; set; }
|
||||||
public bool NotProxyLocalAddress { get; set; } = true;
|
public bool NotProxyLocalAddress { get; set; } = true;
|
||||||
public string SystemProxyAdvancedProtocol { get; set; }
|
public string SystemProxyAdvancedProtocol { get; set; }
|
||||||
public string? CustomSystemProxyPacPath { get; set; }
|
|
||||||
public string? CustomSystemProxyScriptPath { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
|
||||||
18
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
18
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
|
@ -3508,24 +3508,6 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找类似 Custom PAC file path 的本地化字符串。
|
|
||||||
/// </summary>
|
|
||||||
public static string TbSettingsCustomSystemProxyPacPath {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("TbSettingsCustomSystemProxyPacPath", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找类似 Custom system proxy script file path 的本地化字符串。
|
|
||||||
/// </summary>
|
|
||||||
public static string TbSettingsCustomSystemProxyScriptPath {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("TbSettingsCustomSystemProxyScriptPath", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Allow Insecure 的本地化字符串。
|
/// 查找类似 Allow Insecure 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1624,10 +1624,4 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="CertSet" xml:space="preserve">
|
<data name="CertSet" xml:space="preserve">
|
||||||
<value>Certificate set</value>
|
<value>Certificate set</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCustomSystemProxyPacPath" xml:space="preserve">
|
|
||||||
<value>Custom PAC file path</value>
|
|
||||||
</data>
|
|
||||||
<data name="TbSettingsCustomSystemProxyScriptPath" xml:space="preserve">
|
|
||||||
<value>Custom system proxy script file path</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1621,10 +1621,4 @@ Ne pas utiliser « Obtenir le certificat » si « Autoriser non sécurisé » es
|
||||||
<data name="CertSet" xml:space="preserve">
|
<data name="CertSet" xml:space="preserve">
|
||||||
<value>Certificat configuré </value>
|
<value>Certificat configuré </value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCustomSystemProxyPacPath" xml:space="preserve">
|
|
||||||
<value>Custom PAC file path</value>
|
|
||||||
</data>
|
|
||||||
<data name="TbSettingsCustomSystemProxyScriptPath" xml:space="preserve">
|
|
||||||
<value>Custom system proxy script file path</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1624,10 +1624,4 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="CertSet" xml:space="preserve">
|
<data name="CertSet" xml:space="preserve">
|
||||||
<value>Certificate set</value>
|
<value>Certificate set</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCustomSystemProxyPacPath" xml:space="preserve">
|
|
||||||
<value>Custom PAC file path</value>
|
|
||||||
</data>
|
|
||||||
<data name="TbSettingsCustomSystemProxyScriptPath" xml:space="preserve">
|
|
||||||
<value>Custom system proxy script file path</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1624,10 +1624,4 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="CertSet" xml:space="preserve">
|
<data name="CertSet" xml:space="preserve">
|
||||||
<value>Certificate set</value>
|
<value>Certificate set</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCustomSystemProxyPacPath" xml:space="preserve">
|
|
||||||
<value>Custom PAC file path</value>
|
|
||||||
</data>
|
|
||||||
<data name="TbSettingsCustomSystemProxyScriptPath" xml:space="preserve">
|
|
||||||
<value>Custom system proxy script file path</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1624,10 +1624,4 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="CertSet" xml:space="preserve">
|
<data name="CertSet" xml:space="preserve">
|
||||||
<value>Certificate set</value>
|
<value>Certificate set</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCustomSystemProxyPacPath" xml:space="preserve">
|
|
||||||
<value>Custom PAC file path</value>
|
|
||||||
</data>
|
|
||||||
<data name="TbSettingsCustomSystemProxyScriptPath" xml:space="preserve">
|
|
||||||
<value>Custom system proxy script file path</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1621,10 +1621,4 @@
|
||||||
<data name="CertSet" xml:space="preserve">
|
<data name="CertSet" xml:space="preserve">
|
||||||
<value>证书已设置</value>
|
<value>证书已设置</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCustomSystemProxyPacPath" xml:space="preserve">
|
|
||||||
<value>自定义 PAC 文件路径</value>
|
|
||||||
</data>
|
|
||||||
<data name="TbSettingsCustomSystemProxyScriptPath" xml:space="preserve">
|
|
||||||
<value>自定义系统代理脚本文件路径</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1621,10 +1621,4 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="CertSet" xml:space="preserve">
|
<data name="CertSet" xml:space="preserve">
|
||||||
<value>Certificate set</value>
|
<value>Certificate set</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCustomSystemProxyPacPath" xml:space="preserve">
|
|
||||||
<value>自訂 PAC 檔案路徑</value>
|
|
||||||
</data>
|
|
||||||
<data name="TbSettingsCustomSystemProxyScriptPath" xml:space="preserve">
|
|
||||||
<value>自訂系統代理程式腳本檔案路徑</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -268,7 +268,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
await RefreshServers();
|
await RefreshServers();
|
||||||
|
|
||||||
SetReloadEnabled(true);
|
BlReloadEnabled = true;
|
||||||
await Reload();
|
await Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -534,7 +534,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetReloadEnabled(false);
|
BlReloadEnabled = false;
|
||||||
|
|
||||||
var msgs = await ActionPrecheckManager.Instance.Check(_config.IndexId);
|
var msgs = await ActionPrecheckManager.Instance.Check(_config.IndexId);
|
||||||
if (msgs.Count > 0)
|
if (msgs.Count > 0)
|
||||||
|
|
@ -544,7 +544,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
NoticeManager.Instance.SendMessage(msg);
|
NoticeManager.Instance.SendMessage(msg);
|
||||||
}
|
}
|
||||||
NoticeManager.Instance.Enqueue(Utils.List2String(msgs.Take(10).ToList(), true));
|
NoticeManager.Instance.Enqueue(Utils.List2String(msgs.Take(10).ToList(), true));
|
||||||
SetReloadEnabled(true);
|
BlReloadEnabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -562,8 +562,9 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
AppEvents.ProxiesReloadRequested.Publish();
|
AppEvents.ProxiesReloadRequested.Publish();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReloadResult(showClashUI);
|
RxApp.MainThreadScheduler.Schedule(() => ReloadResult(showClashUI));
|
||||||
SetReloadEnabled(true);
|
|
||||||
|
BlReloadEnabled = true;
|
||||||
if (_hasNextReloadJob)
|
if (_hasNextReloadJob)
|
||||||
{
|
{
|
||||||
_hasNextReloadJob = false;
|
_hasNextReloadJob = false;
|
||||||
|
|
@ -573,16 +574,9 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
|
|
||||||
private void ReloadResult(bool showClashUI)
|
private void ReloadResult(bool showClashUI)
|
||||||
{
|
{
|
||||||
RxApp.MainThreadScheduler.Schedule(() =>
|
// BlReloadEnabled = true;
|
||||||
{
|
|
||||||
ShowClashUI = showClashUI;
|
ShowClashUI = showClashUI;
|
||||||
TabMainSelectedIndex = showClashUI ? TabMainSelectedIndex : 0;
|
TabMainSelectedIndex = showClashUI ? TabMainSelectedIndex : 0;
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetReloadEnabled(bool enabled)
|
|
||||||
{
|
|
||||||
RxApp.MainThreadScheduler.Schedule(() => BlReloadEnabled = enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadCore()
|
private async Task LoadCore()
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,6 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||||
[Reactive] public bool notProxyLocalAddress { get; set; }
|
[Reactive] public bool notProxyLocalAddress { get; set; }
|
||||||
[Reactive] public string systemProxyAdvancedProtocol { get; set; }
|
[Reactive] public string systemProxyAdvancedProtocol { get; set; }
|
||||||
[Reactive] public string systemProxyExceptions { get; set; }
|
[Reactive] public string systemProxyExceptions { get; set; }
|
||||||
[Reactive] public string CustomSystemProxyPacPath { get; set; }
|
|
||||||
[Reactive] public string CustomSystemProxyScriptPath { get; set; }
|
|
||||||
|
|
||||||
#endregion System proxy
|
#endregion System proxy
|
||||||
|
|
||||||
|
|
@ -193,8 +191,6 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||||
notProxyLocalAddress = _config.SystemProxyItem.NotProxyLocalAddress;
|
notProxyLocalAddress = _config.SystemProxyItem.NotProxyLocalAddress;
|
||||||
systemProxyAdvancedProtocol = _config.SystemProxyItem.SystemProxyAdvancedProtocol;
|
systemProxyAdvancedProtocol = _config.SystemProxyItem.SystemProxyAdvancedProtocol;
|
||||||
systemProxyExceptions = _config.SystemProxyItem.SystemProxyExceptions;
|
systemProxyExceptions = _config.SystemProxyItem.SystemProxyExceptions;
|
||||||
CustomSystemProxyPacPath = _config.SystemProxyItem.CustomSystemProxyPacPath;
|
|
||||||
CustomSystemProxyScriptPath = _config.SystemProxyItem.CustomSystemProxyScriptPath;
|
|
||||||
|
|
||||||
#endregion System proxy
|
#endregion System proxy
|
||||||
|
|
||||||
|
|
@ -351,8 +347,6 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||||
_config.SystemProxyItem.SystemProxyExceptions = systemProxyExceptions;
|
_config.SystemProxyItem.SystemProxyExceptions = systemProxyExceptions;
|
||||||
_config.SystemProxyItem.NotProxyLocalAddress = notProxyLocalAddress;
|
_config.SystemProxyItem.NotProxyLocalAddress = notProxyLocalAddress;
|
||||||
_config.SystemProxyItem.SystemProxyAdvancedProtocol = systemProxyAdvancedProtocol;
|
_config.SystemProxyItem.SystemProxyAdvancedProtocol = systemProxyAdvancedProtocol;
|
||||||
_config.SystemProxyItem.CustomSystemProxyPacPath = CustomSystemProxyPacPath;
|
|
||||||
_config.SystemProxyItem.CustomSystemProxyScriptPath = CustomSystemProxyScriptPath;
|
|
||||||
|
|
||||||
//tun mode
|
//tun mode
|
||||||
_config.TunModeItem.AutoRoute = TunAutoRoute;
|
_config.TunModeItem.AutoRoute = TunAutoRoute;
|
||||||
|
|
|
||||||
|
|
@ -674,29 +674,6 @@
|
||||||
|
|
||||||
<TabItem Name="tabSystemproxy" Header="{x:Static resx:ResUI.TbSettingsSystemproxy}">
|
<TabItem Name="tabSystemproxy" Header="{x:Static resx:ResUI.TbSettingsSystemproxy}">
|
||||||
<DockPanel Margin="{StaticResource Margin8}">
|
<DockPanel Margin="{StaticResource Margin8}">
|
||||||
<StackPanel
|
|
||||||
Name="panSystemProxyUnix"
|
|
||||||
DockPanel.Dock="Bottom"
|
|
||||||
Orientation="Vertical">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock
|
|
||||||
Margin="{StaticResource Margin4}"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Text="{x:Static resx:ResUI.TbSettingsCustomSystemProxyScriptPath}" />
|
|
||||||
<TextBox
|
|
||||||
x:Name="txtCustomSystemProxyScriptPath"
|
|
||||||
Width="600"
|
|
||||||
Margin="{StaticResource Margin4}"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
Watermark="proxy_set.sh"/>
|
|
||||||
<Button
|
|
||||||
x:Name="btnBrowseCustomSystemProxyScriptPath"
|
|
||||||
Margin="{StaticResource Margin4}"
|
|
||||||
Content="{x:Static resx:ResUI.TbBrowse}" />
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Name="panSystemProxyAdvanced"
|
Name="panSystemProxyAdvanced"
|
||||||
DockPanel.Dock="Bottom"
|
DockPanel.Dock="Bottom"
|
||||||
|
|
@ -722,25 +699,6 @@
|
||||||
MinWidth="400"
|
MinWidth="400"
|
||||||
Margin="{StaticResource Margin4}" />
|
Margin="{StaticResource Margin4}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock
|
|
||||||
Margin="{StaticResource Margin4}"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Text="{x:Static resx:ResUI.TbSettingsCustomSystemProxyPacPath}" />
|
|
||||||
<TextBox
|
|
||||||
x:Name="txtCustomSystemProxyPacPath"
|
|
||||||
Width="600"
|
|
||||||
Margin="{StaticResource Margin4}"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
Watermark="pac.txt"/>
|
|
||||||
<Button
|
|
||||||
x:Name="btnBrowseCustomSystemProxyPacPath"
|
|
||||||
Margin="{StaticResource Margin4}"
|
|
||||||
Content="{x:Static resx:ResUI.TbBrowse}" />
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using v2rayN.Desktop.Base;
|
using v2rayN.Desktop.Base;
|
||||||
using v2rayN.Desktop.Common;
|
|
||||||
|
|
||||||
namespace v2rayN.Desktop.Views;
|
namespace v2rayN.Desktop.Views;
|
||||||
|
|
||||||
|
|
@ -18,9 +17,6 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||||
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
|
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
btnBrowseCustomSystemProxyPacPath.Click += BtnBrowseCustomSystemProxyPacPath_Click;
|
|
||||||
btnBrowseCustomSystemProxyScriptPath.Click += BtnBrowseCustomSystemProxyScriptPath_Click;
|
|
||||||
|
|
||||||
clbdestOverride.ItemsSource = Global.destOverrideProtocols;
|
clbdestOverride.ItemsSource = Global.destOverrideProtocols;
|
||||||
_config.Inbound.First().DestOverride?.ForEach(it =>
|
_config.Inbound.First().DestOverride?.ForEach(it =>
|
||||||
{
|
{
|
||||||
|
|
@ -105,8 +101,6 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||||
this.Bind(ViewModel, vm => vm.notProxyLocalAddress, v => v.tognotProxyLocalAddress.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.notProxyLocalAddress, v => v.tognotProxyLocalAddress.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.SelectedValue).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.CustomSystemProxyPacPath, v => v.txtCustomSystemProxyPacPath.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.CustomSystemProxyScriptPath, v => v.txtCustomSystemProxyScriptPath.Text).DisposeWith(disposables);
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.TunAutoRoute, v => v.togAutoRoute.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunAutoRoute, v => v.togAutoRoute.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
||||||
|
|
@ -133,7 +127,6 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||||
labHide2TrayWhenClose.IsVisible = false;
|
labHide2TrayWhenClose.IsVisible = false;
|
||||||
togHide2TrayWhenClose.IsVisible = false;
|
togHide2TrayWhenClose.IsVisible = false;
|
||||||
labHide2TrayWhenCloseTip.IsVisible = false;
|
labHide2TrayWhenCloseTip.IsVisible = false;
|
||||||
panSystemProxyUnix.IsVisible = false;
|
|
||||||
}
|
}
|
||||||
else if (Utils.IsLinux())
|
else if (Utils.IsLinux())
|
||||||
{
|
{
|
||||||
|
|
@ -219,28 +212,6 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void BtnBrowseCustomSystemProxyPacPath_Click(object? sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var fileName = await UI.OpenFileDialog(this, null);
|
|
||||||
if (fileName.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
txtCustomSystemProxyPacPath.Text = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void BtnBrowseCustomSystemProxyScriptPath_Click(object? sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var fileName = await UI.OpenFileDialog(this, null);
|
|
||||||
if (fileName.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
txtCustomSystemProxyScriptPath.Text = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Window_Loaded(object? sender, RoutedEventArgs e)
|
private void Window_Loaded(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
btnCancel.Focus();
|
btnCancel.Focus();
|
||||||
|
|
|
||||||
|
|
@ -976,28 +976,6 @@
|
||||||
materialDesign:HintAssist.Hint="Protocol"
|
materialDesign:HintAssist.Hint="Protocol"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock
|
|
||||||
Margin="{StaticResource Margin8}"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
|
||||||
Text="{x:Static resx:ResUI.TbSettingsCustomSystemProxyPacPath}" />
|
|
||||||
|
|
||||||
<TextBox
|
|
||||||
x:Name="txtCustomSystemProxyPacPath"
|
|
||||||
Width="600"
|
|
||||||
Margin="{StaticResource Margin4}"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
Style="{StaticResource DefTextBox}"
|
|
||||||
TextWrapping="Wrap" />
|
|
||||||
<Button
|
|
||||||
x:Name="btnBrowseCustomSystemProxyPacPath"
|
|
||||||
Margin="{StaticResource MarginLeftRight4}"
|
|
||||||
Content="{x:Static resx:ResUI.TbBrowse}"
|
|
||||||
Style="{StaticResource DefButton}" />
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ public partial class OptionSettingWindow
|
||||||
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
|
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
btnBrowseCustomSystemProxyPacPath.Click += BtnBrowseCustomSystemProxyPacPath_Click;
|
|
||||||
|
|
||||||
clbdestOverride.ItemsSource = Global.destOverrideProtocols;
|
clbdestOverride.ItemsSource = Global.destOverrideProtocols;
|
||||||
_config.Inbound.First().DestOverride?.ForEach(it =>
|
_config.Inbound.First().DestOverride?.ForEach(it =>
|
||||||
{
|
{
|
||||||
|
|
@ -112,7 +110,6 @@ public partial class OptionSettingWindow
|
||||||
this.Bind(ViewModel, vm => vm.notProxyLocalAddress, v => v.tognotProxyLocalAddress.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.notProxyLocalAddress, v => v.tognotProxyLocalAddress.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.CustomSystemProxyPacPath, v => v.txtCustomSystemProxyPacPath.Text).DisposeWith(disposables);
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.TunAutoRoute, v => v.togAutoRoute.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunAutoRoute, v => v.togAutoRoute.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
||||||
|
|
@ -213,15 +210,4 @@ public partial class OptionSettingWindow
|
||||||
ViewModel.destOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
|
ViewModel.destOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnBrowseCustomSystemProxyPacPath_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (UI.OpenFileDialog(out var fileName,
|
|
||||||
"Txt|*.txt|All|*.*") != true)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
txtCustomSystemProxyPacPath.Text = fileName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue