Fix static-fe Twitter metadata / URL previews #700
No reviewers
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#700
Loading…
Reference in a new issue
No description provided.
Delete branch "Oneric/akkoma:staticfe-metadata"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
help, diff and commit message length are inversely proportional again
This partly reverts
1d884fd914
while fixing both the issue it addressed and the issue it caused.The above commit successfully fixed OpenGraph metadata tags which until then always showed the user bio instead of post content by handing the activities AP ID as url to the Metadata builder instead of passing the internal ID as activity_id.
However, in doing so the commit instead inflicted this very problem onto Twitter metadata tags which ironically are used by akkoma-fe.
This is because while the OpenGraph builder wants an URL as url, the Twitter builder needs the internal ID to build the URL to the embedded player for videos and has no URL property.
Thanks to twpol for tracking down this root cause in #644.
Now, once identified the problem is simple, but this simplicity invites multiple possible solutions to bikeshed about.
Just pass both properties to the builder and let them pick
Drop the url parameter from the OpenGraph builder and instead
a) build static-fe URL of the post from the ID (like Twitter)
b) use the passed-in object’s AP ID as an URL
Approach 2a has the disadvantage of hardcoding the expected URL outside
the router, which will be problematic should it ever change.
Approach 2b is conceptually similar to how the builder works atm.
However, the og:url is supposed to be a permanent ID, by changing from the ID of the Create activity to the ID of the object we, afaiu, technically violate OpenGraph specs. (Though its real-world consequence may very well be near non-existent.)
This leaves just approach 1, which this commit implements. Albeit it too is not without nits to pick, as it leaves the metadata builders with an inconsistent interface.
Additionally, this will resolve the subotpimal Discord previews for content-less image posts reported in #664.
Discord already prefers OpenGraph metadata, so it’s mostly unaffected. However, it appears when encountering an explicitly empty OpenGraph description and a non-empty Twitter description, it replaces just the empty field with its Twitter counterpart, resulting in the user’s bio slipping into the preview.
Secondly, regardless of any OpenGraph tags, Discord uses twitter:card to decide how prominently images should be, but due to the bug the card type was stuck as "summary", forcing images to always remain small.
Root cause identified by: twpol
Fixes: #644
Fixes: #664
Fix Twitter metadata / URL previewsto Fix static-fe Twitter metadata / URL previews2459dc5b4f
to37e2a35b86
any chance you could add a quick test to this to show what we expect to be generated?
8da54ae206
toea2dbd9ef5
tests added
ea2dbd9ef5
toc08f49d88e
coolio, thanks~