snarfed / bridgy

📣 Connects your web site to social media. Likes, retweets, mentions, cross-posting, and more...
https://brid.gy
Creative Commons Zero v1.0 Universal
702 stars 51 forks source link

Mastodon: expire and re-fetch server config #1698

Open snarfed opened 3 months ago

snarfed commented 3 months ago

From https://github.com/snarfed/bridgy/issues/1533#issuecomment-2020203993 : right now, Mastodon Publish always uses server config (including length limit) from the stored MastodonApp entity in the datastore, regardless of how old it is, so we never see changes. We should probably refresh it during publishes if it's more than a day or so old. cc @JoelOtter

snarfed commented 3 months ago

I thought logging in might refresh this for the instance you log into, but nope. We may not have a workaround for this right now.

The fix would be here:

https://github.com/snarfed/bridgy/blob/640048f6dff47a816aef72f00fc00e9250d35a45/models.py#L249

...we'd need to re-trigger an /api/v1/instance API call and store the updated contents in MastodonApp.instance_info, like we do in _register_app:

https://github.com/snarfed/oauth-dropins/blob/4f4c710c3a89881a9332106a66318f0d8536d313/oauth_dropins/mastodon.py#L243-L250

We'd probably also need to add a new updated_at property:

https://github.com/snarfed/oauth-dropins/blob/4f4c710c3a89881a9332106a66318f0d8536d313/oauth_dropins/mastodon.py#L80-L87