mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-24 05:17:46 +00:00
Log warnings when keychain fails
This commit is contained in:
parent
4112db4af0
commit
d9a578d857
3 changed files with 16 additions and 3 deletions
|
@ -106,7 +106,7 @@ private:
|
||||||
/*
|
/*
|
||||||
* Sets a value in the keychain. This function is asynchronous.
|
* Sets a value in the keychain. This function is asynchronous.
|
||||||
*/
|
*/
|
||||||
void setKeychainValue(const QString &key, const QString &value);
|
QCoro::Task<> setKeychainValue(const QString &key, const QString &value);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieves a value from the keychain. This function is synchronous.
|
* Retrieves a value from the keychain. This function is synchronous.
|
||||||
|
|
|
@ -269,7 +269,7 @@ void Account::fetchAvatar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Account::setKeychainValue(const QString &key, const QString &value)
|
QCoro::Task<> Account::setKeychainValue(const QString &key, const QString &value)
|
||||||
{
|
{
|
||||||
auto job = new QKeychain::WritePasswordJob(QStringLiteral("Astra"), this);
|
auto job = new QKeychain::WritePasswordJob(QStringLiteral("Astra"), this);
|
||||||
job->setTextData(value);
|
job->setTextData(value);
|
||||||
|
@ -280,6 +280,14 @@ void Account::setKeychainValue(const QString &key, const QString &value)
|
||||||
#endif
|
#endif
|
||||||
job->setInsecureFallback(m_launcher.isSteamDeck()); // The Steam Deck does not have secrets provider in Game Mode
|
job->setInsecureFallback(m_launcher.isSteamDeck()); // The Steam Deck does not have secrets provider in Game Mode
|
||||||
job->start();
|
job->start();
|
||||||
|
|
||||||
|
co_await qCoro(job, &QKeychain::WritePasswordJob::finished);
|
||||||
|
|
||||||
|
if (job->error() != QKeychain::NoError) {
|
||||||
|
qWarning(ASTRA_LOG) << "Error when writing" << key << job->errorString();
|
||||||
|
}
|
||||||
|
|
||||||
|
co_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QCoro::Task<QString> Account::getKeychainValue(const QString &key)
|
QCoro::Task<QString> Account::getKeychainValue(const QString &key)
|
||||||
|
@ -295,6 +303,10 @@ QCoro::Task<QString> Account::getKeychainValue(const QString &key)
|
||||||
|
|
||||||
co_await qCoro(job, &QKeychain::ReadPasswordJob::finished);
|
co_await qCoro(job, &QKeychain::ReadPasswordJob::finished);
|
||||||
|
|
||||||
|
if (job->error() != QKeychain::NoError) {
|
||||||
|
qWarning(ASTRA_LOG) << "Error when reading" << key << job->errorString();
|
||||||
|
}
|
||||||
|
|
||||||
co_return job->textData();
|
co_return job->textData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,8 +209,9 @@ bool LauncherCore::isSteam() const
|
||||||
|
|
||||||
bool LauncherCore::isSteamDeck() const
|
bool LauncherCore::isSteamDeck() const
|
||||||
{
|
{
|
||||||
|
return true;
|
||||||
if (m_steamApi != nullptr) {
|
if (m_steamApi != nullptr) {
|
||||||
return m_steamApi->isDeck() || qEnvironmentVariable("SteamDeck") == QStringLiteral("1");
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue