bugfix: renamed public_key->end_date to public_key->expires_at according to the changes on the backend
This commit is contained in:
parent
b196be127b
commit
a4ab57508f
2 changed files with 7 additions and 7 deletions
|
|
@ -55,7 +55,7 @@ void ConnectionController::openConnection()
|
||||||
&& !m_serversModel->data(serverIndex, ServersModel::Roles::HasInstalledContainers).toBool()) {
|
&& !m_serversModel->data(serverIndex, ServersModel::Roles::HasInstalledContainers).toBool()) {
|
||||||
emit updateApiConfigFromGateway();
|
emit updateApiConfigFromGateway();
|
||||||
} else if (configVersion && m_serversModel->isApiKeyExpired(serverIndex)) {
|
} else if (configVersion && m_serversModel->isApiKeyExpired(serverIndex)) {
|
||||||
qDebug() << "attempt to update api config by end_date event";
|
qDebug() << "attempt to update api config by expires_at event";
|
||||||
if (configVersion == ApiConfigSources::Telegram) {
|
if (configVersion == ApiConfigSources::Telegram) {
|
||||||
emit updateApiConfigFromTelegram();
|
emit updateApiConfigFromTelegram();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace
|
||||||
constexpr char serviceProtocol[] = "service_protocol";
|
constexpr char serviceProtocol[] = "service_protocol";
|
||||||
|
|
||||||
constexpr char publicKeyInfo[] = "public_key";
|
constexpr char publicKeyInfo[] = "public_key";
|
||||||
constexpr char endDate[] = "end_date";
|
constexpr char expiresAt[] = "expires_at";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -739,9 +739,9 @@ bool ServersModel::isApiKeyExpired(const int serverIndex)
|
||||||
auto apiConfig = serverConfig.value(configKey::apiConfig).toObject();
|
auto apiConfig = serverConfig.value(configKey::apiConfig).toObject();
|
||||||
|
|
||||||
auto publicKeyInfo = apiConfig.value(configKey::publicKeyInfo).toObject();
|
auto publicKeyInfo = apiConfig.value(configKey::publicKeyInfo).toObject();
|
||||||
const QString endDate = publicKeyInfo.value(configKey::endDate).toString();
|
const QString expiresAt = publicKeyInfo.value(configKey::expiresAt).toString();
|
||||||
if (endDate.isEmpty()) {
|
if (expiresAt.isEmpty()) {
|
||||||
publicKeyInfo.insert(configKey::endDate, QDateTime::currentDateTimeUtc().addDays(1).toString(Qt::ISODate));
|
publicKeyInfo.insert(configKey::expiresAt, QDateTime::currentDateTimeUtc().addDays(1).toString(Qt::ISODate));
|
||||||
apiConfig.insert(configKey::publicKeyInfo, publicKeyInfo);
|
apiConfig.insert(configKey::publicKeyInfo, publicKeyInfo);
|
||||||
serverConfig.insert(configKey::apiConfig, apiConfig);
|
serverConfig.insert(configKey::apiConfig, apiConfig);
|
||||||
editServer(serverConfig, serverIndex);
|
editServer(serverConfig, serverIndex);
|
||||||
|
|
@ -749,8 +749,8 @@ bool ServersModel::isApiKeyExpired(const int serverIndex)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto endDateDateTime = QDateTime::fromString(endDate, Qt::ISODate).toUTC();
|
auto expiresAtDateTime = QDateTime::fromString(expiresAt, Qt::ISODate).toUTC();
|
||||||
if (endDateDateTime < QDateTime::currentDateTimeUtc()) {
|
if (expiresAtDateTime < QDateTime::currentDateTimeUtc()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue