mirror of
https://github.com/2dust/v2rayN.git
synced 2025-11-29 03:02:53 +00:00
Compare commits
3 commits
753e7b81b6
...
32583ea8b3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32583ea8b3 | ||
|
|
69797c10f2 | ||
|
|
ddc8c9b1cd |
20 changed files with 219 additions and 28 deletions
|
|
@ -97,7 +97,7 @@ public static class ConfigHandler
|
||||||
|
|
||||||
config.UiItem ??= new UIItem()
|
config.UiItem ??= new UIItem()
|
||||||
{
|
{
|
||||||
EnableAutoAdjustMainLvColWidth = true
|
EnableUpdateSubOnlyRemarksExist = true
|
||||||
};
|
};
|
||||||
config.UiItem.MainColumnItem ??= new();
|
config.UiItem.MainColumnItem ??= new();
|
||||||
config.UiItem.WindowSizeItem ??= new();
|
config.UiItem.WindowSizeItem ??= new();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,13 @@ public static class ProxySettingLinux
|
||||||
|
|
||||||
private static async Task ExecCmd(List<string> args)
|
private static async Task ExecCmd(List<string> args)
|
||||||
{
|
{
|
||||||
var fileName = await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetLinuxShellFileName), false);
|
var customSystemProxyScriptPath = AppManager.Instance.Config.SystemProxyItem?.CustomSystemProxyScriptPath;
|
||||||
|
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,7 +23,13 @@ public static class ProxySettingOSX
|
||||||
|
|
||||||
private static async Task ExecCmd(List<string> args)
|
private static async Task ExecCmd(List<string> args)
|
||||||
{
|
{
|
||||||
var fileName = await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetOSXShellFileName), false);
|
var customSystemProxyScriptPath = AppManager.Instance.Config.SystemProxyItem?.CustomSystemProxyScriptPath;
|
||||||
|
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(Utils.GetConfigPath(), port, portPac);
|
await PacManager.Instance.StartAsync(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,7 +5,6 @@ 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;
|
||||||
|
|
@ -13,11 +12,10 @@ public class PacManager
|
||||||
private bool _isRunning;
|
private bool _isRunning;
|
||||||
private bool _needRestart = true;
|
private bool _needRestart = true;
|
||||||
|
|
||||||
public async Task StartAsync(string configPath, int httpPort, int pacPort)
|
public async Task StartAsync(int httpPort, int pacPort)
|
||||||
{
|
{
|
||||||
_needRestart = configPath != _configPath || httpPort != _httpPort || pacPort != _pacPort || !_isRunning;
|
_needRestart = httpPort != _httpPort || pacPort != _pacPort || !_isRunning;
|
||||||
|
|
||||||
_configPath = configPath;
|
|
||||||
_httpPort = httpPort;
|
_httpPort = httpPort;
|
||||||
_pacPort = pacPort;
|
_pacPort = pacPort;
|
||||||
|
|
||||||
|
|
@ -32,22 +30,22 @@ public class PacManager
|
||||||
|
|
||||||
private async Task InitText()
|
private async Task InitText()
|
||||||
{
|
{
|
||||||
var path = Path.Combine(_configPath, "pac.txt");
|
var customSystemProxyPacPath = AppManager.Instance.Config.SystemProxyItem?.CustomSystemProxyPacPath;
|
||||||
|
var fileName = (customSystemProxyPacPath.IsNotEmpty() && File.Exists(customSystemProxyPacPath))
|
||||||
|
? customSystemProxyPacPath
|
||||||
|
: Path.Combine(Utils.GetConfigPath(), "pac.txt");
|
||||||
|
|
||||||
// Delete the old pac file
|
// TODO: temporarily notify which script is being used
|
||||||
if (File.Exists(path) && Utils.GetFileHash(path).Equals("b590c07280f058ef05d5394aa2f927fe"))
|
NoticeManager.Instance.SendMessage(fileName);
|
||||||
{
|
|
||||||
File.Delete(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(fileName))
|
||||||
{
|
{
|
||||||
var pac = EmbedUtils.GetEmbedText(Global.PacFileName);
|
var pac = EmbedUtils.GetEmbedText(Global.PacFileName);
|
||||||
await File.AppendAllTextAsync(path, pac);
|
await File.AppendAllTextAsync(fileName, pac);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pacText =
|
var pacText = await File.ReadAllTextAsync(fileName);
|
||||||
(await File.ReadAllTextAsync(path)).Replace("__PROXY__", $"PROXY 127.0.0.1:{_httpPort};DIRECT;");
|
pacText = pacText.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,6 +219,8 @@ 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,6 +3508,24 @@ 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,4 +1624,10 @@ 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,4 +1621,10 @@ 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,4 +1624,10 @@ 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,4 +1624,10 @@ 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,4 +1624,10 @@ 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,4 +1621,10 @@
|
||||||
<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,4 +1621,10 @@ 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();
|
||||||
|
|
||||||
BlReloadEnabled = true;
|
SetReloadEnabled(true);
|
||||||
await Reload();
|
await Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -534,7 +534,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlReloadEnabled = false;
|
SetReloadEnabled(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));
|
||||||
BlReloadEnabled = true;
|
SetReloadEnabled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -562,9 +562,8 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
AppEvents.ProxiesReloadRequested.Publish();
|
AppEvents.ProxiesReloadRequested.Publish();
|
||||||
}
|
}
|
||||||
|
|
||||||
RxApp.MainThreadScheduler.Schedule(() => ReloadResult(showClashUI));
|
ReloadResult(showClashUI);
|
||||||
|
SetReloadEnabled(true);
|
||||||
BlReloadEnabled = true;
|
|
||||||
if (_hasNextReloadJob)
|
if (_hasNextReloadJob)
|
||||||
{
|
{
|
||||||
_hasNextReloadJob = false;
|
_hasNextReloadJob = false;
|
||||||
|
|
@ -574,9 +573,16 @@ public class MainWindowViewModel : MyReactiveObject
|
||||||
|
|
||||||
private void ReloadResult(bool showClashUI)
|
private void ReloadResult(bool showClashUI)
|
||||||
{
|
{
|
||||||
// BlReloadEnabled = true;
|
RxApp.MainThreadScheduler.Schedule(() =>
|
||||||
ShowClashUI = showClashUI;
|
{
|
||||||
TabMainSelectedIndex = showClashUI ? TabMainSelectedIndex : 0;
|
ShowClashUI = showClashUI;
|
||||||
|
TabMainSelectedIndex = showClashUI ? TabMainSelectedIndex : 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetReloadEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
RxApp.MainThreadScheduler.Schedule(() => BlReloadEnabled = enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadCore()
|
private async Task LoadCore()
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ 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
|
||||||
|
|
||||||
|
|
@ -191,6 +193,8 @@ 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
|
||||||
|
|
||||||
|
|
@ -347,6 +351,8 @@ 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,6 +674,29 @@
|
||||||
|
|
||||||
<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"
|
||||||
|
|
@ -699,6 +722,25 @@
|
||||||
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,4 +1,5 @@
|
||||||
using v2rayN.Desktop.Base;
|
using v2rayN.Desktop.Base;
|
||||||
|
using v2rayN.Desktop.Common;
|
||||||
|
|
||||||
namespace v2rayN.Desktop.Views;
|
namespace v2rayN.Desktop.Views;
|
||||||
|
|
||||||
|
|
@ -17,6 +18,9 @@ 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 =>
|
||||||
{
|
{
|
||||||
|
|
@ -101,6 +105,8 @@ 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);
|
||||||
|
|
@ -127,6 +133,7 @@ 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())
|
||||||
{
|
{
|
||||||
|
|
@ -212,6 +219,28 @@ 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,6 +976,28 @@
|
||||||
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,6 +16,8 @@ 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 =>
|
||||||
{
|
{
|
||||||
|
|
@ -110,6 +112,7 @@ 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);
|
||||||
|
|
@ -210,4 +213,15 @@ 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