diff --git a/translations/fa_IR.ts b/translations/fa_IR.ts
index 75c7542..a90ab6a 100644
--- a/translations/fa_IR.ts
+++ b/translations/fa_IR.ts
@@ -611,6 +611,25 @@
Proxy Process Name
+
+ Troubleshooting
+
+
+
+ If you have trouble starting VPN, you can force reset nekobox_core process here.
+
+If still not working, see documentation for more information.
+https://matsuridayo.github.io/n-configuration/#vpn-tun
+
+
+
+ Reset
+ بازنشانی
+
+
+ Cancel
+ لغو کردن
+
EditChain
diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts
index fd5d8d6..24b92f1 100644
--- a/translations/zh_CN.ts
+++ b/translations/zh_CN.ts
@@ -617,6 +617,28 @@
Whether blacklisted or whitelisted, your traffic will be handled by nekobox_core (sing-tun). This is NOT equal to "process mode" of some software.
无论是黑名单还是白名单,您的流量都将由 nekobox_core (sing-tun) 处理。这不等于某些软件的「进程模式」。
+
+ Troubleshooting
+ 故障排除
+
+
+ If you have trouble starting VPN, you can force reset nekobox_core process here.
+
+If still not working, see documentation for more information.
+https://matsuridayo.github.io/n-configuration/#vpn-tun
+ 如果您在启动 VPN 时遇到问题,您可以在此处强制重置 nekobox_core 进程。
+
+如果仍然无法正常工作,请参阅文档以获取更多信息。
+https://matsuridayo.github.io/n-configuration/#vpn-tun
+
+
+ Reset
+ 重置
+
+
+ Cancel
+ 取消
+
EditChain
diff --git a/ui/dialog_vpn_settings.cpp b/ui/dialog_vpn_settings.cpp
index bfd0b6d..b3656e6 100644
--- a/ui/dialog_vpn_settings.cpp
+++ b/ui/dialog_vpn_settings.cpp
@@ -3,6 +3,9 @@
#include "main/GuiUtils.hpp"
#include "main/NekoRay.hpp"
+#include "ui/mainwindow_interface.h"
+
+#include
DialogVPNSettings::DialogVPNSettings(QWidget *parent) : QDialog(parent), ui(new Ui::DialogVPNSettings) {
ui->setupUi(this);
@@ -57,3 +60,15 @@ void DialogVPNSettings::accept() {
MW_dialog_message("", "UpdateDataStore,VPNChanged");
QDialog::accept();
}
+
+void DialogVPNSettings::on_troubleshooting_clicked() {
+ auto r = QMessageBox::information(this, tr("Troubleshooting"),
+ tr("If you have trouble starting VPN, you can force reset nekobox_core process here.\n\n"
+ "If still not working, see documentation for more information.\n"
+ "https://matsuridayo.github.io/n-configuration/#vpn-tun"),
+ tr("Reset"), tr("Cancel"), "",
+ 1, 1);
+ if (r == 0) {
+ GetMainWindow()->StopVPNProcess(true);
+ }
+}
diff --git a/ui/dialog_vpn_settings.h b/ui/dialog_vpn_settings.h
index 682220b..b497207 100644
--- a/ui/dialog_vpn_settings.h
+++ b/ui/dialog_vpn_settings.h
@@ -23,6 +23,9 @@ private:
public slots:
void accept() override;
+
+ void on_troubleshooting_clicked();
+
};
#endif // NEKORAY_DIALOG_VPN_SETTINGS_H
diff --git a/ui/dialog_vpn_settings.ui b/ui/dialog_vpn_settings.ui
index b6fa35c..9fa00d4 100644
--- a/ui/dialog_vpn_settings.ui
+++ b/ui/dialog_vpn_settings.ui
@@ -157,6 +157,26 @@
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Troubleshooting
+
+
+
-
diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp
index d5dda0e..be1234d 100644
--- a/ui/mainwindow.cpp
+++ b/ui/mainwindow.cpp
@@ -1684,8 +1684,8 @@ bool MainWindow::StartVPNProcess() {
return true;
}
-bool MainWindow::StopVPNProcess() {
- if (vpn_pid != 0) {
+bool MainWindow::StopVPNProcess(bool unconditional) {
+ if (unconditional || vpn_pid != 0) {
bool ok;
core_process->processId();
#ifdef Q_OS_WIN
@@ -1699,15 +1699,17 @@ bool MainWindow::StopVPNProcess() {
p.start("osascript", {"-e", QString("do shell script \"%1\" with administrator privileges")
.arg("pkill -2 -U 0 nekobox_core")});
#else
- p.start("pkexec", {"pkill", "-2", "-P", Int2String(vpn_pid)});
+ if (unconditional) {
+ p.start("pkexec", {"killall", "nekobox_core"});
+ } else {
+ p.start("pkexec", {"pkill", "-2", "-P", Int2String(vpn_pid)});
+ }
#endif
p.waitForFinished();
ok = p.exitCode() == 0;
#endif
- if (ok) {
- vpn_pid = 0;
- } else {
- MessageBoxWarning(tr("Error"), tr("Failed to stop VPN process"));
+ if (!unconditional) {
+ ok ? vpn_pid = 0 : MessageBoxWarning(tr("Error"), tr("Failed to stop VPN process"));
}
return ok;
}
diff --git a/ui/mainwindow.h b/ui/mainwindow.h
index 1f3def5..bd9f97f 100644
--- a/ui/mainwindow.h
+++ b/ui/mainwindow.h
@@ -61,6 +61,8 @@ public:
void RegisterHotkey(bool unregister);
+ bool StopVPNProcess(bool unconditional = false);
+
signals:
void profile_selected(int id);
@@ -173,8 +175,6 @@ private:
bool StartVPNProcess();
- bool StopVPNProcess();
-
// grpc and ...
void setup_grpc();