Feat: Allow manually restarting the core when Tun is misbehaving

This commit is contained in:
unknown 2024-06-26 07:14:34 +03:30
parent f7fc4d16da
commit 811764d6eb
No known key found for this signature in database
GPG Key ID: C2CA486E4F771093
2 changed files with 14 additions and 12 deletions

View File

@ -141,15 +141,6 @@ namespace NekoGui_sys {
void CoreProcess::Start() {
show_stderr = false;
// set extra env
auto v2ray_asset_dir = NekoGui::FindCoreAsset("geoip.dat");
if (!v2ray_asset_dir.isEmpty()) {
v2ray_asset_dir = QFileInfo(v2ray_asset_dir).absolutePath();
env << "XRAY_LOCATION_ASSET=" + v2ray_asset_dir;
}
if (NekoGui::dataStore->core_ray_direct_dns) env << "NKR_CORE_RAY_DIRECT_DNS=1";
if (NekoGui::dataStore->core_ray_windows_disable_auto_interface) env << "NKR_CORE_RAY_WINDOWS_DISABLE_AUTO_INTERFACE=1";
//
ExternalProcess::Start();
write((NekoGui::dataStore->core_token + "\n").toUtf8());
}

View File

@ -304,10 +304,21 @@ void MainWindow::neko_start(int _id) {
//
bool rpcOK;
QString error = defaultClient->Start(&rpcOK, req);
if (rpcOK && !error.isEmpty()) {
runOnUiThread([=] { MessageBoxWarning("LoadConfig return error", error); });
if (!rpcOK) {
return false;
} else if (!rpcOK) {
}
if (!error.isEmpty()) {
if (error.contains("configure tun interface")) {
auto r = QMessageBox::information(this, tr("Tun device misbehaving"),
tr("If you have trouble starting VPN, you can force reset nekobox_core process here and then try starting the profile again."),
tr("Reset"), tr("Cancel"), "",
1, 1);
if (r == 0) {
GetMainWindow()->StopVPNProcess(true);
}
return false;
}
runOnUiThread([=] { MessageBoxWarning("LoadConfig return error", error); });
return false;
}
//