From 86bc18b99cc539949934e22f92f430f040117b21 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Sun, 22 Mar 2026 11:21:35 +0100 Subject: Single auth service, and msyncd restart - Use the microblog service for all auth - Restart msyncd on install if it's running --- transferengine-plugins/mastodonshareservicestatus.cpp | 13 ++++++++++--- transferengine-plugins/mastodonshareservicestatus.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'transferengine-plugins') diff --git a/transferengine-plugins/mastodonshareservicestatus.cpp b/transferengine-plugins/mastodonshareservicestatus.cpp index 3ac05d5..c48be67 100644 --- a/transferengine-plugins/mastodonshareservicestatus.cpp +++ b/transferengine-plugins/mastodonshareservicestatus.cpp @@ -27,6 +27,11 @@ MastodonShareServiceStatus::MastodonShareServiceStatus(QObject *parent) { } +QString MastodonShareServiceStatus::authServiceName() const +{ + return QStringLiteral("mastodon-microblog"); +} + void MastodonShareServiceStatus::signIn(int accountId) { Accounts::Account *account = Accounts::Account::fromId(m_accountManager, accountId, this); @@ -36,9 +41,9 @@ void MastodonShareServiceStatus::signIn(int accountId) return; } - const Accounts::Service service(m_accountManager->service(m_serviceName)); + const Accounts::Service service(m_accountManager->service(authServiceName())); if (!service.isValid()) { - qWarning() << Q_FUNC_INFO << "Invalid auth service" << m_serviceName; + qWarning() << Q_FUNC_INFO << "Invalid auth service" << authServiceName(); account->deleteLater(); setAccountDetailsState(accountId, Error); return; @@ -123,7 +128,7 @@ void MastodonShareServiceStatus::signOnError(const SignOn::Error &error) << error.type() << error.message(); if (accountId > 0 && error.type() == SignOn::Error::UserInteraction) { - setCredentialsNeedUpdate(accountId, m_serviceName); + setCredentialsNeedUpdate(accountId, authServiceName()); } session->disconnect(this); @@ -229,7 +234,9 @@ void MastodonShareServiceStatus::queryStatus(QueryStatusMode mode) if (!m_accountIdToDetailsIdx.contains(id)) { AccountDetails details; details.accountId = id; + acc->selectService(Accounts::Service()); details.apiHost = MastodonAuthUtils::normalizeApiHost(acc->value(QStringLiteral("api/Host")).toString()); + acc->selectService(service); QUrl apiUrl(details.apiHost); details.providerName = apiUrl.host(); diff --git a/transferengine-plugins/mastodonshareservicestatus.h b/transferengine-plugins/mastodonshareservicestatus.h index cf2e1f8..42fe171 100644 --- a/transferengine-plugins/mastodonshareservicestatus.h +++ b/transferengine-plugins/mastodonshareservicestatus.h @@ -64,6 +64,7 @@ private: Error }; + QString authServiceName() const; void setAccountDetailsState(int accountId, AccountDetailsState state); void signIn(int accountId); -- cgit v1.2.3