Automattic / wordpress-activitypub

ActivityPub for WordPress
https://wordpress.org/plugins/activitypub/
MIT License
496 stars 76 forks source link

Crosspost: URL of a federated WordPress post reopens the post in the app instead of a browser #563

Closed pfefferle closed 8 months ago

pfefferle commented 1 year ago

Quick summary

This issue was originally filed on the Mastodon repo: https://github.com/mastodon/mastodon-android/issues/739

I'm using the ActivityPub plugin to enable following posts from my WordPress blog. The posts federate as excerpts with a URL pointing to the full post on my site.

Tapping on that URL in the Android app only causes it to reload the post (excerpt) inside the app, instead of opening the URL in either webview or a browser as I'd expect it to.

The (official) IOS app does open the URL a browser, as does Firefox on the desktop, which is why I suspect the Android app being at fault here.

I think with the new feature in the official Mastodon Apps, that try to open links in the App directly (which I like, because it should bring more interaction to the site (comments, likes, boosts, ...)), we need a way to prohibit that for the links we add via the "Post content" settings, to not have an infinite loop (see video in the Mastodon issue).

Steps to reproduce

  1. Install official Mastodon Android App
  2. Click on the Permalink/Shortlink of a Mastodon Post

What you expected to happen

The App should load the URL in the default browser instead.

What actually happened

It results in an infinite loop.

Impact

Some (< 50%)

Available workarounds?

Yes, easy to implement

Logs or notes

No response

janboddez commented 1 year ago

I've seen this in Tusky on Mastodon, was assuming it tried to maybe fetch an activitypub+json representation of the URL first. When I again click the link, it opens a browser window (on my Android phone), no infinite loop. But I also typically configure apps to never open links in the "in-frame" browser or whatever it's called.

One "solution" to this might be ... not showing a permalink in the post itself? I mean, I know this isn't actually a solution, but Mastodon statuses are also web pages, and they don't display a URL as part of their post content (yet you can still click "open in browser" for them).

(I like the idea of explicitly showing a permalink, as it raises awareness that "regular" web sites can also be ActivityPub servers, etc.)

Meanwhile, I think it's up to apps to fix this themselves.

aslakr commented 1 year ago

In the furture, maybe related https://github.com/mastodon/mastodon/pull/26917 for implementation in Mastodon itself? See discussion https://hachyderm.io/@thisismissem/111076105053359483 https://mastodon.social/@aslakr/111092724148991855 etc.

janboddez commented 1 year ago

From that link:

Mobile apps like Tusky and Toot! take advantage of the search API to check all tapped links in posts for potentially being posts or profiles, and if so, opening them in-app.

This is exactly what I tried to describe :-)

Looks like this might not exactly solve this issue, though, and possibly even add to the problem? Unless I read it wrong. Still interesting to follow, however.

aslakr commented 1 year ago

Unless clients become better at recognising that the post contains links to itself, I suspect it will add to the problem.

I guess solutions might be:

mikewmerritt commented 1 year ago

One "solution" to this might be ... not showing a permalink in the post itself? I mean, I know this isn't actually a solution, but Mastodon statuses are also web pages, and they don't display a URL as part of their post content (yet you can still click "open in browser" for them).

Unfortunately, I don't think it is one since the link is required to backfeed comments to the blog via webmention.

pfefferle commented 1 year ago

I was thinking about adding a parameter to disable the return of the application/activity+json accept header, or maybe make Mastodon support link targets (<a href="" target="_blank" />).

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days.