refactoring: moved IsProtocolSelectionSupported to apiAccountInfoModel
This commit is contained in:
parent
98c4389445
commit
7e3aa443a2
6 changed files with 19 additions and 18 deletions
|
|
@ -35,7 +35,6 @@ namespace
|
|||
constexpr char serviceType[] = "service_type";
|
||||
constexpr char serviceInfo[] = "service_info";
|
||||
constexpr char serviceProtocol[] = "service_protocol";
|
||||
constexpr char supportedProtocols[] = "supported_protocols";
|
||||
|
||||
constexpr char apiPayload[] = "api_payload";
|
||||
constexpr char keyPayload[] = "key_payload";
|
||||
|
|
@ -198,8 +197,8 @@ namespace
|
|||
auto apiConfig = QJsonObject::fromVariantMap(map);
|
||||
|
||||
if (newServerConfig.value(config_key::configVersion).toInt() == apiDefs::ConfigSource::AmneziaGateway) {
|
||||
apiConfig.insert(configKey::supportedProtocols,
|
||||
QJsonDocument::fromJson(apiResponseBody).object().value(configKey::supportedProtocols).toArray());
|
||||
apiConfig.insert(apiDefs::key::supportedProtocols,
|
||||
QJsonDocument::fromJson(apiResponseBody).object().value(apiDefs::key::supportedProtocols).toArray());
|
||||
}
|
||||
|
||||
serverConfig[configKey::apiConfig] = apiConfig;
|
||||
|
|
@ -593,18 +592,6 @@ bool ApiConfigsController::isVlessProtocol()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ApiConfigsController::isProtocolSelectionSupported()
|
||||
{
|
||||
auto serverIndex = m_serversModel->getProcessedServerIndex();
|
||||
auto serverConfigObject = m_serversModel->getServerConfig(serverIndex);
|
||||
auto apiConfigObject = serverConfigObject.value(configKey::apiConfig).toObject();
|
||||
|
||||
if (apiConfigObject[configKey::supportedProtocols].toArray().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QString> ApiConfigsController::getQrCodes()
|
||||
{
|
||||
return m_qrCodes;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ public slots:
|
|||
|
||||
void setCurrentProtocol(const QString &protocolName);
|
||||
bool isVlessProtocol();
|
||||
bool isProtocolSelectionSupported();
|
||||
|
||||
signals:
|
||||
void errorOccurred(ErrorCode errorCode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue