mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 13:50:12 +08:00
fix custom outbound/config
This commit is contained in:
parent
64eafa28a6
commit
ec6407a9d3
@ -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;
|
||||
};
|
||||
|
||||
@ -56,6 +56,11 @@ namespace NekoGui {
|
||||
|
||||
auto customBean = dynamic_cast<NekoGui_fmt::CustomBean *>(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);
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -68,6 +68,7 @@ bool EditCustom::onEnd() {
|
||||
auto bean = this->ent->CustomBean();
|
||||
|
||||
P_SAVE_STRING_PLAIN(config_simple)
|
||||
bean->core = preset_core;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user