This commit is contained in:
arm64v8a
2023-06-01 21:57:24 +09:00
parent cfbcc0ebe5
commit 1b63771f04
2 changed files with 7 additions and 8 deletions

View File

@@ -732,7 +732,7 @@ namespace NekoGui {
} }
// tun-in // tun-in
if (IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn) { if (IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
QJsonObject inboundObj; QJsonObject inboundObj;
inboundObj["tag"] = "tun-in"; inboundObj["tag"] = "tun-in";
inboundObj["type"] = "tun"; inboundObj["type"] = "tun";
@@ -937,7 +937,7 @@ namespace NekoGui {
}; };
// tun user rule // tun user rule
if (IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn) { if (IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
auto match_out = dataStore->vpn_rule_white ? "proxy" : "bypass"; auto match_out = dataStore->vpn_rule_white ? "proxy" : "bypass";
QString process_name_rule = dataStore->vpn_rule_process.trimmed(); QString process_name_rule = dataStore->vpn_rule_process.trimmed();

View File

@@ -749,13 +749,12 @@ void MainWindow::neko_set_spmode_vpn(bool enable, bool save) {
if (enable != NekoGui::dataStore->spmode_vpn) { if (enable != NekoGui::dataStore->spmode_vpn) {
if (enable) { if (enable) {
if (IS_NEKO_BOX_INTERNAL_TUN) { if (IS_NEKO_BOX_INTERNAL_TUN) {
bool requestPermission = false; bool requestPermission = !NekoGui::isAdmin();
#ifdef Q_OS_WIN #ifdef Q_OS_LINUX
if (!Windows_IsInAdmin()) { if (requestPermission && QProcess::execute("pkexec", {"--help"}) != 0) {
requestPermission = true; MessageBoxWarning(software_name, "Please install \"pkexec\" first.");
neko_set_spmode_FAILED
} }
#else
requestPermission = !NekoGui::isAdmin();
#endif #endif
if (requestPermission) { if (requestPermission) {
auto n = QMessageBox::warning(GetMessageBoxParent(), software_name, tr("Please run NekoBox as admin"), QMessageBox::Yes | QMessageBox::No); auto n = QMessageBox::warning(GetMessageBoxParent(), software_name, tr("Please run NekoBox as admin"), QMessageBox::Yes | QMessageBox::No);