remove v2ray_asset_dir

This commit is contained in:
armv9
2024-07-13 15:37:07 +09:00
parent 7aa863b881
commit 375ffec58d
8 changed files with 14 additions and 87 deletions

View File

@@ -247,7 +247,6 @@ namespace NekoGui {
_add(new configItem("theme", &theme, itemType::string)); _add(new configItem("theme", &theme, itemType::string));
_add(new configItem("custom_inbound", &custom_inbound, itemType::string)); _add(new configItem("custom_inbound", &custom_inbound, itemType::string));
_add(new configItem("custom_route", &custom_route_global, 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("sub_use_proxy", &sub_use_proxy, itemType::boolean));
_add(new configItem("remember_id", &remember_id, itemType::integer)); _add(new configItem("remember_id", &remember_id, itemType::integer));
_add(new configItem("remember_enable", &remember_enable, itemType::boolean)); _add(new configItem("remember_enable", &remember_enable, itemType::boolean));
@@ -416,16 +415,12 @@ namespace NekoGui {
// System Utils // System Utils
QString FindCoreAsset(const QString &name) { QString FindCoreAsset(const QString &name) {
QStringList search{NekoGui::dataStore->v2ray_asset_dir}; QStringList search{};
search << QApplication::applicationDirPath(); search << QApplication::applicationDirPath();
search << "/usr/share/sing-geoip"; search << "/usr/share/sing-geoip";
search << "/usr/share/sing-geosite"; search << "/usr/share/sing-geosite";
search << "/usr/share/xray"; search << "/usr/lib/nekobox";
search << "/usr/local/share/xray"; search << "/usr/share/nekobox";
search << "/opt/xray";
search << "/usr/share/v2ray";
search << "/usr/local/share/v2ray";
search << "/opt/v2ray";
for (const auto &dir: search) { for (const auto &dir: search) {
if (dir.isEmpty()) continue; if (dir.isEmpty()) continue;
QFileInfo asset(dir + "/" + name); QFileInfo asset(dir + "/" + name);

View File

@@ -107,7 +107,6 @@ namespace NekoGui {
int mux_concurrency = 8; int mux_concurrency = 8;
bool mux_default_on = false; bool mux_default_on = false;
QString theme = "0"; QString theme = "0";
QString v2ray_asset_dir = "";
int language = 0; int language = 0;
QString mw_size = ""; QString mw_size = "";
bool check_include_pre = false; bool check_include_pre = false;

View File

@@ -141,13 +141,7 @@ namespace NekoGui_sys {
void CoreProcess::Start() { void CoreProcess::Start() {
show_stderr = false; show_stderr = false;
// set extra env // cwd: same as GUI, at ./config
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;
}
//
ExternalProcess::Start(); ExternalProcess::Start();
write((NekoGui::dataStore->core_token + "\n").toUtf8()); write((NekoGui::dataStore->core_token + "\n").toUtf8());
} }

View File

@@ -63,14 +63,6 @@
<source>Custom Inbound</source> <source>Custom Inbound</source>
<translation>ورودی سفارشی</translation> <translation>ورودی سفارشی</translation>
</message> </message>
<message>
<source>Asset Location</source>
<translation>مکان دارایی</translation>
</message>
<message>
<source>Default: dir of &quot;nekoray&quot;</source>
<translation type="unfinished">مسیر پیش فرض &quot;nekoray&quot;</translation>
</message>
<message> <message>
<source>Concurrent</source> <source>Concurrent</source>
<translation>هم زمان</translation> <translation>هم زمان</translation>

View File

@@ -107,14 +107,6 @@
<source>Core</source> <source>Core</source>
<translation>Ядро</translation> <translation>Ядро</translation>
</message> </message>
<message>
<source>Asset Location</source>
<translation>Расположение файлов</translation>
</message>
<message>
<source>Default: dir of &quot;nekoray&quot;</source>
<translation>По умолчанию: текущая папка nekoray</translation>
</message>
<message> <message>
<source>Select</source> <source>Select</source>
<translation>Выбрать</translation> <translation>Выбрать</translation>

View File

@@ -63,14 +63,6 @@
<source>Custom Inbound</source> <source>Custom Inbound</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Asset Location</source>
<translation></translation>
</message>
<message>
<source>Default: dir of &quot;nekoray&quot;</source>
<translation> nekoray </translation>
</message>
<message> <message>
<source>Concurrent</source> <source>Concurrent</source>
<translation></translation> <translation></translation>

View File

@@ -155,7 +155,6 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
// Core // Core
ui->groupBox_core->setTitle(software_core_name); 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); CACHE.extraCore = QString2QJsonObject(NekoGui::dataStore->extraCore->core_map);
if (!CACHE.extraCore.contains("naive")) CACHE.extraCore.insert("naive", ""); 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)); 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, [=] { connect(ui->extra_core_add, &QPushButton::clicked, this, [=] {
bool ok; bool ok;
auto s = QInputDialog::getText(nullptr, tr("Add"), auto s = QInputDialog::getText(nullptr, tr("Add"),
@@ -278,7 +267,6 @@ void DialogBasicSettings::accept() {
// Core // Core
NekoGui::dataStore->v2ray_asset_dir = ui->core_v2ray_asset->text();
NekoGui::dataStore->extraCore->core_map = QJsonObject2QString(CACHE.extraCore, true); NekoGui::dataStore->extraCore->core_map = QJsonObject2QString(CACHE.extraCore, true);
// Mux // Mux
@@ -293,7 +281,7 @@ void DialogBasicSettings::accept() {
NekoGui::dataStore->utlsFingerprint = ui->utlsFingerprint->currentText(); 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"); MW_dialog_message("", "ClearConnectionList");
} }

View File

@@ -566,39 +566,7 @@
<item> <item>
<widget class="QWidget" name="assest_group" native="true"> <widget class="QWidget" name="assest_group" native="true">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Asset Location</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="MyLineEdit" name="core_v2ray_asset">
<property name="placeholderText">
<string>Default: dir of &quot;nekoray&quot;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="core_v2ray_asset_pick">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string notr="true">Loglevel</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="log_level"> <widget class="QComboBox" name="log_level">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -608,14 +576,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Multiplex (mux)</string> <string>Multiplex (mux)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string notr="true">Loglevel</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QComboBox" name="mux_protocol"/> <widget class="QComboBox" name="mux_protocol"/>