diff --git a/db/ConfigBuilder.cpp b/db/ConfigBuilder.cpp index 71e3e14..400bb45 100644 --- a/db/ConfigBuilder.cpp +++ b/db/ConfigBuilder.cpp @@ -823,7 +823,7 @@ namespace NekoRay { QJSONARRAY_ADD(routingRules, status->routingRules) auto routeObj = QJsonObject{ {"rules", routingRules}, - {"auto_detect_interface", true}, + {"auto_detect_interface", NekoRay::dataStore->core_box_auto_detect_interface}, { "geoip", QJsonObject{ diff --git a/main/NekoRay.cpp b/main/NekoRay.cpp index 8342297..267b200 100644 --- a/main/NekoRay.cpp +++ b/main/NekoRay.cpp @@ -75,6 +75,7 @@ namespace NekoRay { _add(new configItem("max_log_line", &max_log_line, itemType::integer)); _add(new configItem("splitter_state", &splitter_state, itemType::string)); _add(new configItem("utlsFingerprint", &utlsFingerprint, itemType::string)); + _add(new configItem("core_box_auto_detect_interface", &core_box_auto_detect_interface, itemType::boolean)); #ifndef Q_OS_WIN _add(new configItem("vpn_already_admin", &vpn_already_admin, itemType::boolean)); #endif diff --git a/main/NekoRay_DataStore.hpp b/main/NekoRay_DataStore.hpp index b36b8c0..5d7ed11 100644 --- a/main/NekoRay_DataStore.hpp +++ b/main/NekoRay_DataStore.hpp @@ -149,6 +149,9 @@ namespace NekoRay { QString hotkey_route = ""; QString hotkey_system_proxy_menu = ""; + // Core + bool core_box_auto_detect_interface = true; + // Other Core ExtraCore *extraCore = new ExtraCore; diff --git a/translations/fa_IR.ts b/translations/fa_IR.ts index 45b9906..35894e9 100644 --- a/translations/fa_IR.ts +++ b/translations/fa_IR.ts @@ -233,6 +233,10 @@ Default uTLS Fingerprint + + Settings + تنظیمات + DialogEditGroup diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 44a765c..cdba678 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -227,6 +227,10 @@ Default uTLS Fingerprint 默认 uTLS 指纹 + + Settings + 设置 + DialogEditGroup diff --git a/ui/dialog_basic_settings.cpp b/ui/dialog_basic_settings.cpp index bc7ebd1..125e660 100644 --- a/ui/dialog_basic_settings.cpp +++ b/ui/dialog_basic_settings.cpp @@ -167,6 +167,8 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent) // Core + if (!IS_NEKO_BOX) ui->core_settings->hide(); + ui->groupBox_core->setTitle(software_core_name); ui->core_v2ray_asset->setText(NekoRay::dataStore->v2ray_asset_dir); // @@ -386,3 +388,37 @@ void DialogBasicSettings::on_inbound_auth_clicked() { w->deleteLater(); refresh_auth(); } + +void DialogBasicSettings::on_core_settings_clicked() { + auto w = new QDialog(this); + w->setWindowTitle(software_core_name + " settings"); + auto layout = new QGridLayout; + w->setLayout(layout); + // + auto line = -1; + QCheckBox *core_box_auto_detect_interface; + if (IS_NEKO_BOX) { + auto core_box_auto_detect_interface_l = new QLabel("auto_detect_interface"); + core_box_auto_detect_interface = new QCheckBox; + core_box_auto_detect_interface->setChecked(NekoRay::dataStore->core_box_auto_detect_interface); + layout->addWidget(core_box_auto_detect_interface_l, ++line, 0); + layout->addWidget(core_box_auto_detect_interface, line, 1); + } + // + auto box = new QDialogButtonBox; + box->setOrientation(Qt::Horizontal); + box->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); + connect(box, &QDialogButtonBox::accepted, w, [=] { + if (IS_NEKO_BOX) { + NekoRay::dataStore->core_box_auto_detect_interface = core_box_auto_detect_interface->isChecked(); + } + NekoRay::dataStore->Save(); + w->accept(); + }); + connect(box, &QDialogButtonBox::rejected, w, &QDialog::reject); + layout->addWidget(box, ++line, 1); + // + w->exec(); + w->deleteLater(); + refresh_auth(); +} diff --git a/ui/dialog_basic_settings.h b/ui/dialog_basic_settings.h index 8af3f84..3a7ff19 100644 --- a/ui/dialog_basic_settings.h +++ b/ui/dialog_basic_settings.h @@ -36,6 +36,8 @@ private slots: void on_set_custom_icon_clicked(); void on_inbound_auth_clicked(); + + void on_core_settings_clicked(); }; #endif // DIALOG_BASIC_SETTINGS_H diff --git a/ui/dialog_basic_settings.ui b/ui/dialog_basic_settings.ui index 8937dfe..11e4b50 100644 --- a/ui/dialog_basic_settings.ui +++ b/ui/dialog_basic_settings.ui @@ -590,6 +590,13 @@ + + + + Settings + + +