mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
optimize ui
This commit is contained in:
@@ -856,6 +856,20 @@ namespace NekoRay {
|
||||
routeObj.remove("auto_detect_interface");
|
||||
}
|
||||
status->result->coreConfig.insert("route", routeObj);
|
||||
|
||||
// experimental
|
||||
QJsonObject experimentalObj;
|
||||
|
||||
if (NekoRay::dataStore->core_box_clash_api > 0) {
|
||||
QJsonObject clash_api = {
|
||||
{"external_controller", "127.0.0.1:" + Int2String(NekoRay::dataStore->core_box_clash_api)},
|
||||
{"secret", NekoRay::dataStore->core_box_clash_api_secret},
|
||||
{"external_ui", "dashboard"},
|
||||
};
|
||||
experimentalObj["clash_api"] = clash_api;
|
||||
}
|
||||
|
||||
if (!experimentalObj.isEmpty()) status->result->coreConfig.insert("experimental", experimentalObj);
|
||||
}
|
||||
|
||||
QString WriteVPNSingBoxConfig() {
|
||||
|
||||
@@ -76,6 +76,8 @@ namespace NekoRay {
|
||||
_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));
|
||||
_add(new configItem("core_box_clash_api", &core_box_clash_api, itemType::integer));
|
||||
_add(new configItem("core_box_clash_api_secret", &core_box_clash_api_secret, itemType::string));
|
||||
#ifndef Q_OS_WIN
|
||||
_add(new configItem("vpn_already_admin", &vpn_already_admin, itemType::boolean));
|
||||
#endif
|
||||
|
||||
@@ -151,6 +151,8 @@ namespace NekoRay {
|
||||
|
||||
// Core
|
||||
bool core_box_auto_detect_interface = true;
|
||||
int core_box_clash_api = -9090;
|
||||
QString core_box_clash_api_secret = "";
|
||||
|
||||
// Other Core
|
||||
ExtraCore *extraCore = new ExtraCore;
|
||||
|
||||
13
res/dashboard-notice.html
Normal file
13
res/dashboard-notice.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<html>
|
||||
|
||||
<head></head>
|
||||
|
||||
<body>
|
||||
<h3>
|
||||
<p>Please put your clash dashboard files to "nekoray/config/dashboard" dir.</p>
|
||||
<p>For example, you can download from the following URL.</p>
|
||||
<a href="https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip">Yacd-meta</a>
|
||||
</h3>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -20,5 +20,6 @@
|
||||
<file>neko.css</file>
|
||||
<file>vpn/vpn-run-root.sh</file>
|
||||
<file>vpn/sing-box-vpn.json</file>
|
||||
<file>dashboard-notice.html</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -406,6 +406,8 @@ namespace NekoRay::sub {
|
||||
|
||||
content = resp.data;
|
||||
sub_user_info = NetworkRequestHelper::GetHeader(resp.header, "Subscription-UserInfo");
|
||||
|
||||
MW_show_log("<<<<<<<< " + QObject::tr("Subscription request fininshed: %1").arg(groupName));
|
||||
}
|
||||
|
||||
QList<QSharedPointer<ProxyEntity>> in; // 更新前
|
||||
@@ -461,11 +463,11 @@ namespace NekoRay::sub {
|
||||
|
||||
QString notice_added;
|
||||
for (const auto &ent: only_out) {
|
||||
notice_added += ent->bean->DisplayTypeAndName() + "\n";
|
||||
notice_added += "[+] " + ent->bean->DisplayTypeAndName() + "\n";
|
||||
}
|
||||
QString notice_deleted;
|
||||
for (const auto &ent: only_in) {
|
||||
notice_deleted += ent->bean->DisplayTypeAndName() + "\n";
|
||||
notice_deleted += "[-] " + ent->bean->DisplayTypeAndName() + "\n";
|
||||
}
|
||||
|
||||
auto change = "\n" + QObject::tr("Added %1 profiles:\n%2\nDeleted %3 Profiles:\n%4")
|
||||
|
||||
@@ -1471,6 +1471,10 @@ Direct: %2</source>
|
||||
<source>Enable System Proxy</source>
|
||||
<translation type="obsolete">پروکسی سیستم را فعال کنید</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Subscription request fininshed: %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Qv2ray::ui::widgets::AutoCompleteTextEdit</name>
|
||||
|
||||
@@ -1461,12 +1461,8 @@ As of January 1, 2022, compatibility with MD5 authentication information will be
|
||||
<translation>正在清理服务器...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable VPN</source>
|
||||
<translation type="obsolete">启用 VPN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable System Proxy</source>
|
||||
<translation type="obsolete">启用系统代理</translation>
|
||||
<source>Subscription request fininshed: %1</source>
|
||||
<translation>订阅请求完成: %1</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
||||
@@ -378,7 +378,7 @@ void DialogBasicSettings::on_inbound_auth_clicked() {
|
||||
connect(box, &QDialogButtonBox::accepted, w, [=] {
|
||||
NekoRay::dataStore->inbound_auth->username = user->text();
|
||||
NekoRay::dataStore->inbound_auth->password = pass->text();
|
||||
NekoRay::dataStore->Save();
|
||||
MW_dialog_message(Dialog_DialogBasicSettings, "UpdateDataStore");
|
||||
w->accept();
|
||||
});
|
||||
connect(box, &QDialogButtonBox::rejected, w, &QDialog::reject);
|
||||
@@ -397,12 +397,33 @@ void DialogBasicSettings::on_core_settings_clicked() {
|
||||
//
|
||||
auto line = -1;
|
||||
QCheckBox *core_box_auto_detect_interface;
|
||||
QCheckBox *core_box_enable_clash_api;
|
||||
QLineEdit *core_box_clash_api;
|
||||
QLineEdit *core_box_clash_api_secret;
|
||||
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 core_box_enable_clash_api_l = new QLabel("Enable Clash API");
|
||||
core_box_enable_clash_api = new QCheckBox;
|
||||
core_box_enable_clash_api->setChecked(NekoRay::dataStore->core_box_clash_api > 0);
|
||||
layout->addWidget(core_box_enable_clash_api_l, ++line, 0);
|
||||
layout->addWidget(core_box_enable_clash_api, line, 1);
|
||||
//
|
||||
auto core_box_clash_api_l = new QLabel("Clash API Listen Port");
|
||||
core_box_clash_api = new MyLineEdit;
|
||||
core_box_clash_api->setText(Int2String(std::abs(NekoRay::dataStore->core_box_clash_api)));
|
||||
layout->addWidget(core_box_clash_api_l, ++line, 0);
|
||||
layout->addWidget(core_box_clash_api, line, 1);
|
||||
//
|
||||
auto core_box_clash_api_secret_l = new QLabel("Clash API Secret");
|
||||
core_box_clash_api_secret = new MyLineEdit;
|
||||
core_box_clash_api_secret->setText(NekoRay::dataStore->core_box_clash_api_secret);
|
||||
layout->addWidget(core_box_clash_api_secret_l, ++line, 0);
|
||||
layout->addWidget(core_box_clash_api_secret, line, 1);
|
||||
}
|
||||
//
|
||||
auto box = new QDialogButtonBox;
|
||||
@@ -411,8 +432,10 @@ void DialogBasicSettings::on_core_settings_clicked() {
|
||||
connect(box, &QDialogButtonBox::accepted, w, [=] {
|
||||
if (IS_NEKO_BOX) {
|
||||
NekoRay::dataStore->core_box_auto_detect_interface = core_box_auto_detect_interface->isChecked();
|
||||
NekoRay::dataStore->core_box_clash_api = core_box_clash_api->text().toInt() * (core_box_enable_clash_api->isChecked() ? 1 : -1);
|
||||
NekoRay::dataStore->core_box_clash_api_secret = core_box_clash_api_secret->text();
|
||||
}
|
||||
NekoRay::dataStore->Save();
|
||||
MW_dialog_message(Dialog_DialogBasicSettings, "UpdateDataStore");
|
||||
w->accept();
|
||||
});
|
||||
connect(box, &QDialogButtonBox::rejected, w, &QDialog::reject);
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
<item>
|
||||
<widget class="QLineEdit" name="max_log_line">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
||||
@@ -31,13 +31,38 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="core">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="as_json">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Json Editor</string>
|
||||
</property>
|
||||
|
||||
@@ -100,6 +100,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
if (!Preset::SingBox::DomainStrategy.contains(NekoRay::dataStore->outbound_domain_strategy)) {
|
||||
NekoRay::dataStore->outbound_domain_strategy = "";
|
||||
}
|
||||
//
|
||||
if (QDir("dashboard").isEmpty()) {
|
||||
QDir().mkdir("dashboard");
|
||||
QFile::copy(":/neko/dashboard-notice.html", "dashboard/index.html");
|
||||
}
|
||||
}
|
||||
|
||||
// top bar
|
||||
|
||||
Reference in New Issue
Block a user