From 6d7385788e1058280316c47e9ebc2189243eb727 Mon Sep 17 00:00:00 2001 From: John Edwerd Date: Sat, 13 Jan 2024 21:54:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BF=AE=E6=94=B9=E9=9D=9E?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=A8=A1=E5=BC=8F=E4=B8=8Btun?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=90=AF=E5=8A=A8=E9=80=BB=E8=BE=91;?= =?UTF-8?q?=E7=BC=A9=E7=9F=AD=E8=87=AA=E5=8A=A8=E9=9A=90=E8=97=8F=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v2rayN/v2rayN/Sample/tun_singbox_rules | 11 ----------- v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs | 12 +++++++++--- v2rayN/v2rayN/Views/MainWindow.xaml.cs | 2 -- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/v2rayN/v2rayN/Sample/tun_singbox_rules b/v2rayN/v2rayN/Sample/tun_singbox_rules index 528adb76..df1dc4ec 100644 --- a/v2rayN/v2rayN/Sample/tun_singbox_rules +++ b/v2rayN/v2rayN/Sample/tun_singbox_rules @@ -1,8 +1,4 @@ [ - { - "protocol": [ "dns" ], - "outbound": "dns_out" - }, { "network": "udp", "port": [ @@ -20,12 +16,5 @@ "ff00::/8" ], "outbound": "block" - }, - { - "source_ip_cidr": [ - "224.0.0.0/3", - "ff00::/8" - ], - "outbound": "block" } ] \ No newline at end of file diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index eb622188..e1052645 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -1390,8 +1390,7 @@ namespace v2rayN.ViewModels { Process.Start(startInfo); MyAppExit(false); - } - catch { } + } catch { } } private void ImportOldGuiConfig() @@ -1621,6 +1620,13 @@ namespace v2rayN.ViewModels if (_config.tunModeItem.enableTun != EnableTun) { _config.tunModeItem.enableTun = EnableTun; + // 非管理员运行时tun模式开启逻辑修改 + if (EnableTun && !Utils.IsAdministrator()) + { + RebootAsAdmin(); + _config.tunModeItem.enableTun = EnableTun = false; + return; + } Reload(); } } @@ -1839,7 +1845,7 @@ namespace v2rayN.ViewModels if (_config.uiItem.autoHideStartup) { Observable.Range(1, 1) - .Delay(TimeSpan.FromSeconds(2)) + .Delay(TimeSpan.FromSeconds(0.5)) .Subscribe(x => { Application.Current.Dispatcher.Invoke(() => diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index e4f30d56..6edd6a18 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -212,8 +212,6 @@ namespace v2rayN.Views var IsAdministrator = Utils.IsAdministrator(); this.Title = $"{Utils.GetVersion()} - {(IsAdministrator ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}"; - spEnableTun.Visibility = IsAdministrator ? Visibility.Visible : Visibility.Collapsed; - //if (_config.uiItem.autoHideStartup) //{ // WindowState = WindowState.Minimized;