2026-04-30 14:53:03 +08:00
|
|
|
#ifndef APICONFIG_H
|
|
|
|
|
#define APICONFIG_H
|
|
|
|
|
|
|
|
|
|
#include <QJsonObject>
|
|
|
|
|
#include <QJsonArray>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QDateTime>
|
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
struct ApiConfig
|
|
|
|
|
{
|
|
|
|
|
QString serviceType;
|
|
|
|
|
QString serviceProtocol;
|
|
|
|
|
QString userCountryCode;
|
|
|
|
|
QString serverCountryCode;
|
|
|
|
|
QString serverCountryName;
|
|
|
|
|
QString vpnKey;
|
|
|
|
|
|
|
|
|
|
struct Subscription {
|
|
|
|
|
QString endDate;
|
|
|
|
|
|
|
|
|
|
QJsonObject toJson() const;
|
|
|
|
|
static Subscription fromJson(const QJsonObject& json);
|
|
|
|
|
};
|
|
|
|
|
Subscription subscription;
|
|
|
|
|
|
|
|
|
|
int activeDeviceCount;
|
|
|
|
|
int maxDeviceCount;
|
|
|
|
|
int issuedConfigs;
|
|
|
|
|
QJsonArray availableCountries;
|
|
|
|
|
QJsonArray supportedProtocols;
|
|
|
|
|
|
|
|
|
|
struct ServiceInfo {
|
|
|
|
|
bool isAdVisible = false;
|
|
|
|
|
bool isRenewalAvailable = false;
|
|
|
|
|
QString adHeader;
|
|
|
|
|
QString adDescription;
|
|
|
|
|
QString adEndpoint;
|
|
|
|
|
|
|
|
|
|
QJsonObject toJson() const;
|
|
|
|
|
static ServiceInfo fromJson(const QJsonObject& json);
|
|
|
|
|
};
|
|
|
|
|
ServiceInfo serviceInfo;
|
|
|
|
|
|
|
|
|
|
struct PublicKeyInfo {
|
|
|
|
|
QString expiresAt;
|
|
|
|
|
|
|
|
|
|
QJsonObject toJson() const;
|
|
|
|
|
static PublicKeyInfo fromJson(const QJsonObject& json);
|
|
|
|
|
};
|
|
|
|
|
PublicKeyInfo publicKey;
|
|
|
|
|
|
|
|
|
|
QString stackType;
|
|
|
|
|
QString cliVersion;
|
2026-05-01 20:50:24 +08:00
|
|
|
bool isTestPurchase = false;
|
2026-04-30 14:53:03 +08:00
|
|
|
bool isInAppPurchase = false;
|
|
|
|
|
bool subscriptionExpiredByServer = false;
|
|
|
|
|
|
|
|
|
|
bool isPremium() const;
|
|
|
|
|
bool isFree() const;
|
|
|
|
|
bool isExternalPremium() const;
|
|
|
|
|
bool isSubscriptionExpired() const;
|
|
|
|
|
|
|
|
|
|
QJsonObject toJson() const;
|
|
|
|
|
static ApiConfig fromJson(const QJsonObject& json);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace amnezia
|
|
|
|
|
|
|
|
|
|
#endif // APICONFIG_H
|
|
|
|
|
|