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("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);

View File

@@ -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;

View File

@@ -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());
}

View File

@@ -63,14 +63,6 @@
<source>Custom Inbound</source>
<translation>ورودی سفارشی</translation>
</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>
<source>Concurrent</source>
<translation>هم زمان</translation>

View File

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

View File

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

View File

@@ -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");
}

View File

@@ -566,39 +566,7 @@
<item>
<widget class="QWidget" name="assest_group" native="true">
<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">
<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">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -608,14 +576,21 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Multiplex (mux)</string>
</property>
</widget>
</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">
<item>
<widget class="QComboBox" name="mux_protocol"/>