fix custom outbound/config

This commit is contained in:
Nova 2025-07-07 00:53:31 +03:30
parent 64eafa28a6
commit ec6407a9d3
4 changed files with 12 additions and 5 deletions

View File

@ -23,10 +23,11 @@ namespace NekoGui_fmt {
QString DisplayType() override { QString DisplayType() override {
if (core == "internal") { if (core == "internal") {
auto obj = QString2QJsonObject(config_simple); auto type = QString2QJsonObject(config_simple)["type"].toString();
return obj["type"].toString(); if (!type.isEmpty()) type[0] = type[0].toUpper();
return type.isEmpty() ? "Custom Outbound" : "Custom " + type + " Outbound";
} else if (core == "internal-full") { } else if (core == "internal-full") {
return software_core_name + " config"; return "Custom Config";
} }
return core; return core;
}; };

View File

@ -56,6 +56,11 @@ namespace NekoGui {
auto customBean = dynamic_cast<NekoGui_fmt::CustomBean *>(ent->bean.get()); auto customBean = dynamic_cast<NekoGui_fmt::CustomBean *>(ent->bean.get());
if (customBean != nullptr && customBean->core == "internal-full") { 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); result->coreConfig = QString2QJsonObject(customBean->config_simple);
} else { } else {
BuildConfigSingBox(status); BuildConfigSingBox(status);

View File

@ -235,12 +235,12 @@ void DialogEditProfile::typeSelected(const QString &newType) {
auto _innerWidget = new EditSSH(this); auto _innerWidget = new EditSSH(this);
innerWidget = _innerWidget; innerWidget = _innerWidget;
innerEditor = _innerWidget; innerEditor = _innerWidget;
} else if (type == "internal" || type == "internal-full") { } else if (type == "internal" || type == "internal-full" || type == "custom") {
auto _innerWidget = new EditCustom(this); auto _innerWidget = new EditCustom(this);
innerWidget = _innerWidget; innerWidget = _innerWidget;
innerEditor = _innerWidget; innerEditor = _innerWidget;
customType = newEnt ? type : ent->CustomBean()->core; customType = newEnt ? type : ent->CustomBean()->core;
if (customType != "custom") _innerWidget->preset_core = customType; _innerWidget->preset_core = customType;
type = "custom"; type = "custom";
ui->apply_to_group->hide(); ui->apply_to_group->hide();
} else if (type == "extracore") } else if (type == "extracore")

View File

@ -68,6 +68,7 @@ bool EditCustom::onEnd() {
auto bean = this->ent->CustomBean(); auto bean = this->ent->CustomBean();
P_SAVE_STRING_PLAIN(config_simple) P_SAVE_STRING_PLAIN(config_simple)
bean->core = preset_core;
return true; return true;
} }