From 375ffec58d1f32a67fd74c30924895fcd07117b7 Mon Sep 17 00:00:00 2001
From: armv9 <48624112+arm64v8a@users.noreply.github.com>
Date: Sat, 13 Jul 2024 15:37:07 +0900
Subject: [PATCH] remove v2ray_asset_dir
---
main/NekoGui.cpp | 11 +++------
main/NekoGui_DataStore.hpp | 1 -
sys/ExternalProcess.cpp | 8 +------
translations/fa_IR.ts | 8 -------
translations/ru_RU.ts | 8 -------
translations/zh_CN.ts | 8 -------
ui/dialog_basic_settings.cpp | 14 +-----------
ui/dialog_basic_settings.ui | 43 ++++++++----------------------------
8 files changed, 14 insertions(+), 87 deletions(-)
diff --git a/main/NekoGui.cpp b/main/NekoGui.cpp
index 67b5a5214..520275a90 100644
--- a/main/NekoGui.cpp
+++ b/main/NekoGui.cpp
@@ -247,7 +247,6 @@ namespace NekoGui {
_add(new configItem("theme", &theme, itemType::string));
_add(new configItem("custom_inbound", &custom_inbound, itemType::string));
_add(new configItem("custom_route", &custom_route_global, itemType::string));
- _add(new configItem("v2ray_asset_dir", &v2ray_asset_dir, itemType::string));
_add(new configItem("sub_use_proxy", &sub_use_proxy, itemType::boolean));
_add(new configItem("remember_id", &remember_id, itemType::integer));
_add(new configItem("remember_enable", &remember_enable, itemType::boolean));
@@ -416,16 +415,12 @@ namespace NekoGui {
// System Utils
QString FindCoreAsset(const QString &name) {
- QStringList search{NekoGui::dataStore->v2ray_asset_dir};
+ QStringList search{};
search << QApplication::applicationDirPath();
search << "/usr/share/sing-geoip";
search << "/usr/share/sing-geosite";
- search << "/usr/share/xray";
- search << "/usr/local/share/xray";
- search << "/opt/xray";
- search << "/usr/share/v2ray";
- search << "/usr/local/share/v2ray";
- search << "/opt/v2ray";
+ search << "/usr/lib/nekobox";
+ search << "/usr/share/nekobox";
for (const auto &dir: search) {
if (dir.isEmpty()) continue;
QFileInfo asset(dir + "/" + name);
diff --git a/main/NekoGui_DataStore.hpp b/main/NekoGui_DataStore.hpp
index 66f0af528..ec0ff247c 100644
--- a/main/NekoGui_DataStore.hpp
+++ b/main/NekoGui_DataStore.hpp
@@ -107,7 +107,6 @@ namespace NekoGui {
int mux_concurrency = 8;
bool mux_default_on = false;
QString theme = "0";
- QString v2ray_asset_dir = "";
int language = 0;
QString mw_size = "";
bool check_include_pre = false;
diff --git a/sys/ExternalProcess.cpp b/sys/ExternalProcess.cpp
index bb0f1481e..02770ec29 100644
--- a/sys/ExternalProcess.cpp
+++ b/sys/ExternalProcess.cpp
@@ -141,13 +141,7 @@ 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;
- }
- //
+ // cwd: same as GUI, at ./config
ExternalProcess::Start();
write((NekoGui::dataStore->core_token + "\n").toUtf8());
}
diff --git a/translations/fa_IR.ts b/translations/fa_IR.ts
index 8790d9c94..d6562f575 100644
--- a/translations/fa_IR.ts
+++ b/translations/fa_IR.ts
@@ -63,14 +63,6 @@
ورودی سفارشی
-
-
- مکان دارایی
-
-
-
- مسیر پیش فرض "nekoray"
-
هم زمان
diff --git a/translations/ru_RU.ts b/translations/ru_RU.ts
index c65759f1a..880f57a5d 100644
--- a/translations/ru_RU.ts
+++ b/translations/ru_RU.ts
@@ -107,14 +107,6 @@
Ядро
-
-
- Расположение файлов
-
-
-
- По умолчанию: текущая папка nekoray
-
Выбрать
diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts
index 491d360f8..213c6df69 100644
--- a/translations/zh_CN.ts
+++ b/translations/zh_CN.ts
@@ -63,14 +63,6 @@
自定义入站
-
-
- 资源文件路径
-
-
-
- 默认值:和 nekoray 同路径
-
并发
diff --git a/ui/dialog_basic_settings.cpp b/ui/dialog_basic_settings.cpp
index e468e3405..1ecf85c1c 100644
--- a/ui/dialog_basic_settings.cpp
+++ b/ui/dialog_basic_settings.cpp
@@ -155,7 +155,6 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
// Core
ui->groupBox_core->setTitle(software_core_name);
- ui->core_v2ray_asset->setText(NekoGui::dataStore->v2ray_asset_dir);
//
CACHE.extraCore = QString2QJsonObject(NekoGui::dataStore->extraCore->core_map);
if (!CACHE.extraCore.contains("naive")) CACHE.extraCore.insert("naive", "");
@@ -167,16 +166,6 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
extra_core_layout->addWidget(new ExtraCoreWidget(&CACHE.extraCore, s));
}
//
- connect(ui->core_v2ray_asset, &QLineEdit::textChanged, this, [=] {
- CACHE.needRestart = true;
- });
- connect(ui->core_v2ray_asset_pick, &QPushButton::clicked, this, [=] {
- auto fn = QFileDialog::getExistingDirectory(this, tr("Select"), QDir::currentPath(),
- QFileDialog::Option::ShowDirsOnly | QFileDialog::Option::ReadOnly);
- if (!fn.isEmpty()) {
- ui->core_v2ray_asset->setText(fn);
- }
- });
connect(ui->extra_core_add, &QPushButton::clicked, this, [=] {
bool ok;
auto s = QInputDialog::getText(nullptr, tr("Add"),
@@ -278,7 +267,6 @@ void DialogBasicSettings::accept() {
// Core
- NekoGui::dataStore->v2ray_asset_dir = ui->core_v2ray_asset->text();
NekoGui::dataStore->extraCore->core_map = QJsonObject2QString(CACHE.extraCore, true);
// Mux
@@ -293,7 +281,7 @@ void DialogBasicSettings::accept() {
NekoGui::dataStore->utlsFingerprint = ui->utlsFingerprint->currentText();
// 关闭连接统计,停止刷新前清空记录。
- if (NekoGui::dataStore->traffic_loop_interval == 0 || NekoGui::dataStore->connection_statistics == false) {
+ if (NekoGui::dataStore->traffic_loop_interval == 0 || !NekoGui::dataStore->connection_statistics) {
MW_dialog_message("", "ClearConnectionList");
}
diff --git a/ui/dialog_basic_settings.ui b/ui/dialog_basic_settings.ui
index a4e1291a1..c17b62eb8 100644
--- a/ui/dialog_basic_settings.ui
+++ b/ui/dialog_basic_settings.ui
@@ -566,39 +566,7 @@
-
-
-
-
-
- Asset Location
-
-
-
-
-
-
-
-
-
- Default: dir of "nekoray"
-
-
-
- -
-
-
- Select
-
-
-
-
-
- -
-
-
- Loglevel
-
-
-
- -
@@ -608,14 +576,21 @@
- -
+
-
Multiplex (mux)
- -
+
-
+
+
+ Loglevel
+
+
+
+ -
-