-
Notifications
You must be signed in to change notification settings - Fork 425
oembed: ignore oembed results from mastodon #19286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
This adds a check in the oembed preview for cases where the oembed is going to contain less information than the OpenGraph; in these cases, the oembed is ignored and the OpenGraph data is retained. At the moment, the only case in here is Mastodon posts, but it could be expanded in the future. Mastodon's oembed is JavaScript based and only contains stub HTML that's intended to be filled in by client-side JavaScript that synapse doesn't execute. It doesn't contain the actual post text. The og:description, on the other hand, does contain the post text. When synapse unilaterally prefers the oembed over OpenGraph, it ends up accidentally filling in a generic and non-useful preview in place of the actual post content.
085f270 to
c57765e
Compare
|
I also considered using the provider, but unfortunately Mastodon fills in the provider with the site name and so it's different for every Mastodon instance. The only two places where we can reliably tell this is Mastodon is a) the "View on Mastodon" text, and b) the |
Tumblr provides a generic oembed result that consists just of the post URL. The og:description, on the other hand, contains an actual abbreviated copy of the post, which is more useful. This also adds a method to ignore other oembed results based on the provider string. That wasn't possible for Mastodon, but it is for Tumblr.
|
I've added a second commit to also skip oembed text for Tumblr. Like Mastodon, Tumblr's oembed contains stub content and JavaScript to render a rich post view; in this case, the stub content is just the URL to the post, with no content. Here's what those previews look like right now:
And here's the oembed for this post: https://www.tumblr.com/oembed/1.0?url=https://www.suppermariobroth.com/post/802233242234339328/main-blog-patreon-twitter-bluesky-small Also like Mastodon, however, the |
|
I missed that there's also a PR with a different implementation in #19231. |

This adds a check in the oembed preview for cases where the oembed is going to contain less information than the OpenGraph; in these cases, the oembed is ignored and the OpenGraph data is retained. At the moment, the only case in here is Mastodon posts, but it could be expanded in the future.
Mastodon's oembed is JavaScript based and only contains stub HTML that's intended to be filled in by client-side JavaScript that synapse doesn't execute. It doesn't contain the actual post text. The og:description, on the other hand, does contain the post text. When synapse unilaterally prefers the oembed over OpenGraph, it ends up accidentally filling in a generic and non-useful preview in place of the actual post content.
See mastodon/mastodon#34710 for context.
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.