Optimize Linux start tun mode

You can choose not to store the password and enter it manually each time
This commit is contained in:
2dust
2024-11-18 16:44:12 +08:00
parent 499a16feae
commit b5e1a297ae
4 changed files with 43 additions and 17 deletions

View File

@@ -416,16 +416,16 @@ namespace ServiceLib.ViewModels
// When running as a non-administrator, reboot to administrator mode
if (EnableTun && AllowEnableTun() == false)
{
_config.TunModeItem.EnableTun = false;
if (Utils.IsWindows())
{
_config.TunModeItem.EnableTun = false;
Locator.Current.GetService<MainWindowViewModel>()?.RebootAsAdmin();
return;
}
else if (Utils.IsLinux())
{
NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.TbSettingsLinuxSudoPasswordIsEmpty);
}
return;
//else if (Utils.IsLinux())
//{
// NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.TbSettingsLinuxSudoPasswordIsEmpty);
//}
}
await ConfigHandler.SaveConfig(_config);
Locator.Current.GetService<MainWindowViewModel>()?.Reload();