Skip to content

Commit

Permalink
remove v2ray_asset_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Jul 13, 2024
1 parent 7aa863b commit 375ffec
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 87 deletions.
11 changes: 3 additions & 8 deletions main/NekoGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion main/NekoGui_DataStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 1 addition & 7 deletions sys/ExternalProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
8 changes: 0 additions & 8 deletions translations/fa_IR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 0 additions & 8 deletions translations/ru_RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 0 additions & 8 deletions translations/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
14 changes: 1 addition & 13 deletions ui/dialog_basic_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "");
Expand All @@ -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"),
Expand Down Expand Up @@ -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
Expand All @@ -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");
}

Expand Down
43 changes: 9 additions & 34 deletions ui/dialog_basic_settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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"/>
Expand Down

0 comments on commit 375ffec

Please sign in to comment.