2026-04-30 14:53:03 +08:00
|
|
|
#ifndef APIV2SERVERCONFIG_H
|
|
|
|
|
#define APIV2SERVERCONFIG_H
|
|
|
|
|
|
|
|
|
|
#include <QJsonObject>
|
|
|
|
|
#include <QMap>
|
|
|
|
|
|
|
|
|
|
#include "core/utils/containerEnum.h"
|
|
|
|
|
#include "core/utils/containers/containerUtils.h"
|
|
|
|
|
#include "core/utils/protocolEnum.h"
|
|
|
|
|
#include "core/models/containerConfig.h"
|
|
|
|
|
#include "core/models/api/apiConfig.h"
|
|
|
|
|
#include "core/models/api/authData.h"
|
2026-05-15 12:33:36 +08:00
|
|
|
#include "core/utils/serverConfigUtils.h"
|
2026-04-30 14:53:03 +08:00
|
|
|
#include "core/utils/constants/apiKeys.h"
|
|
|
|
|
#include "core/utils/constants/apiConstants.h"
|
|
|
|
|
|
|
|
|
|
namespace amnezia
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
using namespace ContainerEnumNS;
|
|
|
|
|
|
|
|
|
|
struct ApiV2ServerConfig {
|
|
|
|
|
QString description;
|
2026-05-15 12:33:36 +08:00
|
|
|
QString displayName;
|
2026-04-30 14:53:03 +08:00
|
|
|
QString hostName;
|
|
|
|
|
QMap<DockerContainer, ContainerConfig> containers;
|
|
|
|
|
DockerContainer defaultContainer;
|
|
|
|
|
QString dns1;
|
|
|
|
|
QString dns2;
|
|
|
|
|
|
|
|
|
|
QString name;
|
|
|
|
|
bool nameOverriddenByUser = false;
|
|
|
|
|
int crc;
|
|
|
|
|
int configVersion;
|
|
|
|
|
ApiConfig apiConfig;
|
|
|
|
|
AuthData authData;
|
|
|
|
|
|
|
|
|
|
QString vpnKey() const;
|
|
|
|
|
QString serviceType() const;
|
|
|
|
|
QString serviceProtocol() const;
|
|
|
|
|
bool isPremium() const;
|
|
|
|
|
bool isFree() const;
|
|
|
|
|
bool isExternalPremium() const;
|
|
|
|
|
bool hasContainers() const;
|
|
|
|
|
ContainerConfig containerConfig(DockerContainer container) const;
|
|
|
|
|
QJsonObject toJson() const;
|
|
|
|
|
static ApiV2ServerConfig fromJson(const QJsonObject& json);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace amnezia
|
|
|
|
|
|
|
|
|
|
#endif // APIV2SERVERCONFIG_H
|
|
|
|
|
|