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
if (IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn) {
if (IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
QJsonObject inboundObj;
inboundObj["tag"] = "tun-in";
inboundObj["type"] = "tun";
@@ -937,7 +937,7 @@ namespace NekoGui {
};
// 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";
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) {
if (IS_NEKO_BOX_INTERNAL_TUN) {
bool requestPermission = false;
#ifdef Q_OS_WIN
if (!Windows_IsInAdmin()) {
requestPermission = true;
bool requestPermission = !NekoGui::isAdmin();
#ifdef Q_OS_LINUX
if (requestPermission && QProcess::execute("pkexec", {"--help"}) != 0) {
MessageBoxWarning(software_name, "Please install \"pkexec\" first.");
neko_set_spmode_FAILED
}
#else
requestPermission = !NekoGui::isAdmin();
#endif
if (requestPermission) {
auto n = QMessageBox::warning(GetMessageBoxParent(), software_name, tr("Please run NekoBox as admin"), QMessageBox::Yes | QMessageBox::No);