mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
feat: improve custom config
This commit is contained in:
@@ -17,11 +17,30 @@ namespace NekoRay::fmt {
|
||||
_add(new configItem("cs", &config_simple, itemType::string));
|
||||
};
|
||||
|
||||
QString DisplayType() override { return core; };
|
||||
QString DisplayType() override {
|
||||
if (core == "internal") {
|
||||
auto obj = QString2QJsonObject(config_simple);
|
||||
return obj[IS_NEKO_BOX ? "type" : "protocol"].toString();
|
||||
}
|
||||
return core;
|
||||
};
|
||||
|
||||
QString DisplayCoreType() override { return NeedExternal() ? core : software_core_name; };
|
||||
|
||||
QString DisplayAddress() override {
|
||||
if (core == "internal") {
|
||||
auto obj = QString2QJsonObject(config_simple);
|
||||
if (IS_NEKO_BOX) {
|
||||
return ::DisplayAddress(obj["server"].toString(), obj["server_port"].toInt());
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
return AbstractBean::DisplayAddress();
|
||||
};
|
||||
|
||||
bool NeedExternal() override {
|
||||
if (core == "internal") return false;
|
||||
if (IS_NEKO_BOX && core == "hysteria") return false;
|
||||
return true;
|
||||
};
|
||||
@@ -29,5 +48,7 @@ namespace NekoRay::fmt {
|
||||
ExternalBuildResult BuildExternal(int mapping_port, int socks_port) override;
|
||||
|
||||
CoreObjOutboundBuildResult BuildCoreObjSingBox() override;
|
||||
|
||||
CoreObjOutboundBuildResult BuildCoreObjV2Ray() override;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user