mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-24 10:33:15 +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 {
|
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;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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")
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user