diff --git a/include/configs/proxy/CustomBean.hpp b/include/configs/proxy/CustomBean.hpp index 1670ae1..726f627 100644 --- a/include/configs/proxy/CustomBean.hpp +++ b/include/configs/proxy/CustomBean.hpp @@ -23,10 +23,11 @@ namespace NekoGui_fmt { QString DisplayType() override { if (core == "internal") { - auto obj = QString2QJsonObject(config_simple); - return obj["type"].toString(); + auto type = QString2QJsonObject(config_simple)["type"].toString(); + if (!type.isEmpty()) type[0] = type[0].toUpper(); + return type.isEmpty() ? "Custom Outbound" : "Custom " + type + " Outbound"; } else if (core == "internal-full") { - return software_core_name + " config"; + return "Custom Config"; } return core; }; diff --git a/src/configs/ConfigBuilder.cpp b/src/configs/ConfigBuilder.cpp index 31e5619..feb3315 100644 --- a/src/configs/ConfigBuilder.cpp +++ b/src/configs/ConfigBuilder.cpp @@ -56,6 +56,11 @@ namespace NekoGui { auto customBean = dynamic_cast(ent->bean.get()); if (customBean != nullptr && customBean->core == "internal-full") { + if (dataStore->spmode_vpn) + { + status->result->error = QObject::tr("Tun mode cannot be used with Custom configs"); + return result; + } result->coreConfig = QString2QJsonObject(customBean->config_simple); } else { BuildConfigSingBox(status); diff --git a/src/ui/profile/dialog_edit_profile.cpp b/src/ui/profile/dialog_edit_profile.cpp index 501232b..99a1e70 100644 --- a/src/ui/profile/dialog_edit_profile.cpp +++ b/src/ui/profile/dialog_edit_profile.cpp @@ -235,12 +235,12 @@ void DialogEditProfile::typeSelected(const QString &newType) { auto _innerWidget = new EditSSH(this); innerWidget = _innerWidget; innerEditor = _innerWidget; - } else if (type == "internal" || type == "internal-full") { + } else if (type == "internal" || type == "internal-full" || type == "custom") { auto _innerWidget = new EditCustom(this); innerWidget = _innerWidget; innerEditor = _innerWidget; customType = newEnt ? type : ent->CustomBean()->core; - if (customType != "custom") _innerWidget->preset_core = customType; + _innerWidget->preset_core = customType; type = "custom"; ui->apply_to_group->hide(); } else if (type == "extracore") diff --git a/src/ui/profile/edit_custom.cpp b/src/ui/profile/edit_custom.cpp index 438669e..9c1e335 100644 --- a/src/ui/profile/edit_custom.cpp +++ b/src/ui/profile/edit_custom.cpp @@ -68,6 +68,7 @@ bool EditCustom::onEnd() { auto bean = this->ent->CustomBean(); P_SAVE_STRING_PLAIN(config_simple) + bean->core = preset_core; return true; }