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 --- .../mastodondatatypesyncadaptor.cpp | 10 ++++++++-- .../mastodondatatypesyncadaptor.h | 1 + .../mastodonnotificationssyncadaptor.cpp | 5 +++++ .../mastodonnotificationssyncadaptor.h | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) (limited to 'buteo-plugins') diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.cpp b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.cpp index 14b3511..ddf6686 100644 --- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.cpp +++ b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.cpp @@ -81,6 +81,11 @@ QString MastodonNotificationsDataTypeSyncAdaptor::apiHost(int accountId) const return m_apiHosts.value(accountId, QStringLiteral("https://mastodon.social")); } +QString MastodonNotificationsDataTypeSyncAdaptor::authServiceName() const +{ + return syncServiceName(); +} + void MastodonNotificationsDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err) { QNetworkReply *reply = qobject_cast(sender()); @@ -125,7 +130,7 @@ void MastodonNotificationsDataTypeSyncAdaptor::sslErrorsHandler(const QListid(); - Accounts::Service srv(m_accountManager->service(syncServiceName())); + Accounts::Service srv(m_accountManager->service(authServiceName())); account->selectService(srv); account->setValue(QStringLiteral("CredentialsNeedUpdate"), QVariant::fromValue(true)); account->setValue(QStringLiteral("CredentialsNeedUpdateFrom"), QVariant::fromValue(QString::fromLatin1("sociald-mastodon"))); @@ -141,8 +146,9 @@ void MastodonNotificationsDataTypeSyncAdaptor::signIn(Accounts::Account *account return; } - Accounts::Service srv(m_accountManager->service(syncServiceName())); + Accounts::Service srv(m_accountManager->service(authServiceName())); account->selectService(srv); + SignOn::Identity *identity = account->credentialsId() > 0 ? SignOn::Identity::existingIdentity(account->credentialsId()) : 0; diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.h b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.h index 3bb6e23..3c61ade 100644 --- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.h +++ b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.h @@ -48,6 +48,7 @@ public: protected: QString apiHost(int accountId) const; virtual void updateDataForAccount(int accountId); + virtual QString authServiceName() const; virtual void beginSync(int accountId, const QString &accessToken) = 0; protected Q_SLOTS: diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.cpp b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.cpp index 8a2c610..8d21782 100644 --- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.cpp +++ b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.cpp @@ -303,6 +303,11 @@ QString MastodonNotificationsSyncAdaptor::syncServiceName() const return QStringLiteral("mastodon-notifications"); } +QString MastodonNotificationsSyncAdaptor::authServiceName() const +{ + return QStringLiteral("mastodon-microblog"); +} + void MastodonNotificationsSyncAdaptor::purgeDataForOldAccount(int oldId, SocialNetworkSyncAdaptor::PurgeMode) { closeAccountNotifications(oldId); diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h index 9711549..4c667fa 100644 --- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h +++ b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h @@ -41,6 +41,7 @@ public: QString syncServiceName() const override; protected: + QString authServiceName() const override; void purgeDataForOldAccount(int oldId, SocialNetworkSyncAdaptor::PurgeMode mode) override; void beginSync(int accountId, const QString &accessToken) override; void finalize(int accountId) override; -- cgit v1.2.3