Open bekopharm opened 3 years ago
@aaronpk I think I thought of a workaround for this. I know it is an extra piece for your code, but how about this?
WordPress sites, even when delivering @pfefferle 's activitypub code, return two standard link headers.
rel="https://api.w.org/" - Which is a link to the WordPress Rest API endpoint rel="alternate"; type="application/json" - Which is a link to the JSON representation of the URL in the Rest API endpoint.
Could you, if you detect this, indicating a WordPress site, refetch the HTML and parse?
Ok I've given this some thought and I have a different plan for how to handle it on the XRay side.
XRay is used for a lot of things, one of which being fetching a page to verify a webmention. Given that is it extremely unlikely to receive a webmention from an ActivityPub JSON URL, I'll add an option to XRay so that the caller can say "I'm trying to fetch this page for webmention verification" and that will disable adding the ActivityPub Accept header, since it will never expect to receive ActivityPub JSON when verifying a webmention. That seems to be the cleanest option that should avoid special casing sites.
Done in 438430ffc20e02790f67c19b5d080401fc5bc697
Deploying to webmention.io now...
Should be live now. Please test and let me know how it goes.
The issue is described here: https://github.com/pfefferle/wordpress-activitypub/issues/78 and according to @pfefferle can probably only be solved in XRay: https://github.com/pfefferle/wordpress-activitypub/issues/78#issuecomment-570731802