diff --git a/db/ConfigBuilder.cpp b/db/ConfigBuilder.cpp index 400bb45..3037594 100644 --- a/db/ConfigBuilder.cpp +++ b/db/ConfigBuilder.cpp @@ -20,10 +20,15 @@ namespace NekoRay { status->forTest = forTest; status->forExport = forExport; - if (IS_NEKO_BOX) { - BuildConfigSingBox(status); + auto customBean = dynamic_cast(ent->bean.get()); + if (customBean != nullptr && customBean->core == "internal-full") { + result->coreConfig = QString2QJsonObject(customBean->config_simple); } else { - BuildConfigV2Ray(status); + if (IS_NEKO_BOX) { + BuildConfigSingBox(status); + } else { + BuildConfigV2Ray(status); + } } // hook.js diff --git a/fmt/Bean2External.cpp b/fmt/Bean2External.cpp index 3b72f2d..d8a52ae 100644 --- a/fmt/Bean2External.cpp +++ b/fmt/Bean2External.cpp @@ -32,7 +32,7 @@ namespace NekoRay::fmt { } int CustomBean::NeedExternal(bool isFirstProfile, bool isVPN) { - if (core == "internal") return 0; + if (core == "internal" || core == "internal-full") return 0; if (core == "hysteria") { if (isFirstProfile && !isVPN) { return 2; diff --git a/fmt/CustomBean.hpp b/fmt/CustomBean.hpp index 7c0a610..4466eee 100644 --- a/fmt/CustomBean.hpp +++ b/fmt/CustomBean.hpp @@ -25,6 +25,8 @@ namespace NekoRay::fmt { if (core == "internal") { auto obj = QString2QJsonObject(config_simple); return obj[IS_NEKO_BOX ? "type" : "protocol"].toString(); + } else if (core == "internal-full") { + return software_core_name + " config"; } return core; }; @@ -39,6 +41,8 @@ namespace NekoRay::fmt { } else { return {}; } + } else if (core == "internal-full") { + return {}; } return AbstractBean::DisplayAddress(); }; diff --git a/translations/fa_IR.ts b/translations/fa_IR.ts index c474cac..c23f112 100644 --- a/translations/fa_IR.ts +++ b/translations/fa_IR.ts @@ -379,10 +379,6 @@ Application layer protocol negotiation, clear text. Please separate them with commas. - - Custom (%1) - - Custom (Extra Core) سفارشی ( هسته اضافه) @@ -407,6 +403,14 @@ Reality public key. If not empty, turn TLS into REALITY. + + Custom (%1 outbound) + + + + Custom (%1 config) + + DialogHotkey @@ -712,6 +716,10 @@ https://matsuridayo.github.io/n-configuration/#vpn-tun Preview config + + Please fill the complete config. + + EditNaive diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 15f793a..3c4702a 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -381,10 +381,6 @@ Custom (Extra Core) 自定义 (其他核心) - - Custom (%1) - 自定义 (%1) - TLS Security Settings TLS 安全设置 @@ -397,6 +393,14 @@ Reality public key. If not empty, turn TLS into REALITY. Reality public key. 如果不为空,则将 TLS 变为 REALITY。 + + Custom (%1 outbound) + 自定义 (%1 出站) + + + Custom (%1 config) + 自定义 (%1 完整配置) + DialogHotkey @@ -705,6 +709,10 @@ https://matsuridayo.github.io/n-configuration/#vpn-tun Preview config 预览配置 + + Please fill the complete config. + 请填写完整配置。 + EditNaive diff --git a/ui/edit/dialog_edit_profile.cpp b/ui/edit/dialog_edit_profile.cpp index 7809599..fc8a675 100644 --- a/ui/edit/dialog_edit_profile.cpp +++ b/ui/edit/dialog_edit_profile.cpp @@ -124,7 +124,8 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId, LOAD_TYPE("vless"); LOAD_TYPE("naive"); ui->type->addItem("Hysteria", "hysteria"); - ui->type->addItem(tr("Custom (%1)").arg(software_core_name), "internal"); + ui->type->addItem(tr("Custom (%1 outbound)").arg(software_core_name), "internal"); + ui->type->addItem(tr("Custom (%1 config)").arg(software_core_name), "internal-full"); ui->type->addItem(tr("Custom (Extra Core)"), "custom"); LOAD_TYPE("chain"); @@ -176,7 +177,7 @@ void DialogEditProfile::typeSelected(const QString &newType) { auto _innerWidget = new EditNaive(this); innerWidget = _innerWidget; innerEditor = _innerWidget; - } else if (type == "custom" || type == "internal" || type == "hysteria") { + } else if (type == "custom" || type == "internal" || type == "internal-full" || type == "hysteria") { auto _innerWidget = new EditCustom(this); innerWidget = _innerWidget; innerEditor = _innerWidget; @@ -198,7 +199,7 @@ void DialogEditProfile::typeSelected(const QString &newType) { } // hide some widget - auto showAddressPort = type != "chain" && customType != "internal"; + auto showAddressPort = type != "chain" && customType != "internal" && customType != "internal-full"; ui->address->setVisible(showAddressPort); ui->address_l->setVisible(showAddressPort); ui->port->setVisible(showAddressPort); diff --git a/ui/edit/edit_custom.cpp b/ui/edit/edit_custom.cpp index fbd1b19..6ecc2e0 100644 --- a/ui/edit/edit_custom.cpp +++ b/ui/edit/edit_custom.cpp @@ -56,6 +56,13 @@ void EditCustom::onStart(QSharedPointer _ent) { " \"type\": \"socks\",\n" " // ...\n" "}"); + } else if (preset_core == "internal-full") { + preset_command = preset_config = ""; + ui->config_simple->setPlaceholderText( + "{\n" + " \"inbounds\": [],\n" + " \"outbounds\": []\n" + "}"); } // load core ui @@ -78,9 +85,13 @@ void EditCustom::onStart(QSharedPointer _ent) { } // custom internal - if (preset_core == "internal") { + if (preset_core == "internal" || preset_core == "internal-full") { ui->core->hide(); - ui->core_l->setText(tr("Outbound JSON, please read the documentation.")); + if (preset_core == "internal") { + ui->core_l->setText(tr("Outbound JSON, please read the documentation.")); + } else { + ui->core_l->setText(tr("Please fill the complete config.")); + } ui->w_ext1->hide(); ui->w_ext2->hide(); }