Compare commits

...

4 commits

Author SHA1 Message Date
2dust
1c6323315b up 7.2.3
Some checks are pending
release macos / build (Release) (push) Waiting to run
release / build (Release) (push) Waiting to run
2024-11-29 11:43:53 +08:00
2dust
1ff4839be1 Bug fix
https://github.com/2dust/v2rayN/issues/6160
2024-11-29 11:31:22 +08:00
2dust
558e5bb340 Improve tun for linux 2024-11-29 10:31:57 +08:00
2dust
48a9d208e6 Label text optimization 2024-11-28 14:44:24 +08:00
10 changed files with 38 additions and 17 deletions

View file

@ -334,7 +334,7 @@ namespace ServiceLib.Handler
}
try
{
proc?.Kill();
proc?.Kill(true);
}
catch (Exception)
{
@ -375,7 +375,7 @@ namespace ServiceLib.Handler
private async Task KillProcessAsLinuxSudo()
{
var cmdLine = $"kill -9 {_linuxSudoPid}";
var cmdLine = $"kill {_linuxSudoPid}";
var shFilePath = await CreateLinuxShellFile(cmdLine, "kill_as_sudo.sh");
Process proc = new()
{
@ -392,11 +392,18 @@ namespace ServiceLib.Handler
if (_config.TunModeItem.LinuxSudoPwd.IsNotEmpty())
{
var pwd = DesUtils.Decrypt(_config.TunModeItem.LinuxSudoPwd);
await Task.Delay(10);
await proc.StandardInput.WriteLineAsync(pwd);
await Task.Delay(10);
await proc.StandardInput.WriteLineAsync(pwd);
try
{
var pwd = DesUtils.Decrypt(_config.TunModeItem.LinuxSudoPwd);
await Task.Delay(10);
await proc.StandardInput.WriteLineAsync(pwd);
await Task.Delay(10);
await proc.StandardInput.WriteLineAsync(pwd);
}
catch (Exception)
{
// ignored
}
}
var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(10));
@ -411,7 +418,11 @@ namespace ServiceLib.Handler
File.Delete(shFilePath);
var sb = new StringBuilder();
sb.AppendLine("#!/bin/sh");
if (_config.TunModeItem.LinuxSudoPwd.IsNullOrEmpty())
if (AppHandler.Instance.IsAdministrator)
{
sb.AppendLine($"{cmdLine}");
}
else if (_config.TunModeItem.LinuxSudoPwd.IsNullOrEmpty())
{
sb.AppendLine($"pkexec {cmdLine}");
}

View file

@ -3140,7 +3140,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Linux system sudo password 的本地化字符串。
/// 查找类似 System sudo password 的本地化字符串。
/// </summary>
public static string TbSettingsLinuxSudoPassword {
get {

View file

@ -1364,7 +1364,7 @@
<value>(Domain or IP or ProcName) and Port and Protocol and InboundTag =&gt; OutboundTag</value>
</data>
<data name="TbSettingsLinuxSudoPassword" xml:space="preserve">
<value>Linux system sudo password</value>
<value>System sudo password</value>
</data>
<data name="TbSettingsLinuxSudoPasswordTip" xml:space="preserve">
<value>The password is encrypted and stored only in local files.</value>

View file

@ -1364,7 +1364,7 @@
<value>Remarks Memo</value>
</data>
<data name="TbSettingsLinuxSudoPassword" xml:space="preserve">
<value>Linux system sudo password</value>
<value>System sudo password</value>
</data>
<data name="TbSettingsLinuxSudoPasswordTip" xml:space="preserve">
<value>The password is encrypted and stored only in local files.</value>

View file

@ -1364,7 +1364,7 @@
<value>Remote (WebDAV)</value>
</data>
<data name="TbSettingsLinuxSudoPassword" xml:space="preserve">
<value>Linux system sudo password</value>
<value>System sudo password</value>
</data>
<data name="TbSettingsLinuxSudoPasswordTip" xml:space="preserve">
<value>The password is encrypted and stored only in local files.</value>

View file

@ -1361,7 +1361,7 @@
<value>备注备忘</value>
</data>
<data name="TbSettingsLinuxSudoPassword" xml:space="preserve">
<value>Linux系统的sudo密码</value>
<value>系统的sudo密码</value>
</data>
<data name="TbSettingsLinuxSudoPasswordTip" xml:space="preserve">
<value>密码已加密且只存储在本地文件中,无密码则每次都要输入</value>

View file

@ -1361,7 +1361,7 @@
<value>混淆密碼(obfs password)</value>
</data>
<data name="TbSettingsLinuxSudoPassword" xml:space="preserve">
<value>Linux系統的sudo密碼</value>
<value>系統的sudo密碼</value>
</data>
<data name="TbSettingsLinuxSudoPasswordTip" xml:space="preserve">
<value>密碼已加密且只儲存在本機檔案中,無密碼則每次都要輸入</value>

View file

@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>7.2.2</Version>
<Version>7.2.3</Version>
</PropertyGroup>
<ItemGroup>

View file

@ -283,7 +283,6 @@ namespace ServiceLib.ViewModels
try
{
Logging.SaveLog("MyAppExit Begin");
//if (blWindowsShutDown)
await SysProxyHandler.UpdateSysProxy(_config, true);
await ConfigHandler.SaveConfig(_config);
@ -297,7 +296,10 @@ namespace ServiceLib.ViewModels
catch { }
finally
{
_updateView?.Invoke(EViewAction.Shutdown, null);
if (!blWindowsShutDown)
{
_updateView?.Invoke(EViewAction.Shutdown, null);
}
}
}

View file

@ -21,6 +21,7 @@ namespace v2rayN.Desktop.Views
private WindowNotificationManager? _manager;
private CheckUpdateView? _checkUpdateView;
private BackupAndRestoreView? _backupAndRestoreView;
private bool _blCloseByUser = false;
public MainWindow()
{
@ -279,6 +280,11 @@ namespace v2rayN.Desktop.Views
protected override async void OnClosing(WindowClosingEventArgs e)
{
if (_blCloseByUser)
{
return;
}
Logging.SaveLog("OnClosing -> " + e.CloseReason.ToString());
switch (e.CloseReason)
@ -374,6 +380,8 @@ namespace v2rayN.Desktop.Views
{
return;
}
_blCloseByUser = true;
StorageUI();
await ViewModel?.MyAppExitAsync(false);