Declare intent filter to open a post #792
Labels
No Label
bug
contribution welcome
discussion
duplicate
enhancement
FireFish
FRIENDICA
from fedi
good first issue
help wanted
invalid
PIXELFED
Pleroma
question
UI/UX
upstream
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: tom79/Fedilab#792
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
There's a new idea for podcasts: cross-app comments based on ActivityPub (https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#social-interact). TL:DR – each episode (of podcasts taking part) has a 'root' post. Replies can be posted to it as usual. Example: https://podcast.thelinuxexp.com/@tlenewspodcast/posts/3be3bb49-690d-4deb-84e7-66da3c4567df
In AntennaPod, the open source podcast player for Android, we would like to make it easy to access & join listener conversations. But rather than including a full interface to view and post comments, the idea is to let dedicated apps handle this. Concretely: from AntennaPod you hit a button to open an episode's root post in your favourite ActivityPub/Mastodon app. You then have all the great features you're used to. And if you don't have such app installed, we'll display a short explanation and guide you to some options.
We could just link to the root post URL, but that's not guaranteed to open the right app if installed. And we wouldn't be able to give the user an explanation if such app is not installed.
So, we need an alternative. As I understand, declaring an intent filter is the best alternative. AntennaPod can then send an implicit intent in order to open a post. For example: web+activitypub://post/${encoded post uri}
See also:
https://fosstodon.org/@AntennaPod/109844984567859264
https://github.com/tuskyapp/Tusky/issues/3321
https://github.com/activitypub-schema/proposal/blob/main/PROPOSAL.md
https://github.com/fedi-to/fedi-to.github.io/blob/main/webap.md
Long story short - it would be great if Fedilab could implement an intent filter to open posts, so that AntennaPod can call such intent. Curious to hear your thoughts. (Other apps should do the same for this to work well, of course. But Fedilab as a start would be a great start, but great for me to test as I us it actively.)
[x] - I read the contributing page
So, you want that we add that on our code to deal with custom scheme to open dedicated messages?
web+activitypub://post/${encoded post uri}
I'm not a developer myself so I can't say much about the details or the code/intent that you prepared. But yes, in general the idea would be to ask all ActivityPub-driven apps (incl. Tusky, Mastodon, Subway Tooter, Tooot, etc) to register such intent, so that other apps (like AntennaPod) can open an ActivityPub post/object.
The purpose is not to make it AntennaPod-specific; the idea is that it would work for any other app that wants to open a post :-) (So maybe the intent name should be changed to 'OpenPost' or something?)
Does AntennaPod suggest a guidelines for that? What should we follow to be aware of that?
Guidelines for what exactly?
In general I can say that, as this is a new area of work, I guess we need to agree between us (and, ideally, the wider ActivityPub app space). If you have specific ideas for how the intent should work (in order to open a post/object), AntennaPod can follow suit.
I think the content of the proposal is appropriate.
web+**
allows registering protocol handlers from the web site or PWA web app. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/protocol_handlersHowever, we need to test this works on real device.
I'm following this issue at https://github.com/tateisu/SubwayTooter/issues/231
Following up from the same issue posted over at https://github.com/tuskyapp/Tusky/issues/3321 because I think it's helpful to try and have the discussion and feedback in one place so we don't repeat ourselves. Fedilab folks, hi, I hope you don't mind. If you do, please say so and I'll fork the discussion back to the Tusky issue.
Some initial thoughts:
Version numbers
Please include version numbers as explicit items in protocols.
Custom intent and MIME type?
Could this be implemented / prototyped as something that is AntennaPod specific. If it proves to be worthwhile there's then real world evidence that it should be made more "standard".
For example, AntennaPod could create implicit intents with a MIME type of
application/x-antennapod
and sendcontent:
scheme intents, to be processed with:Bonus points if you provide a small library that Fedilab, Tusky, etc can depend on that provides functions for parsing content from the intent in a consistent fashion.
Webfinger?
Could this be implemented with existing webfinger Well-Known URIs (WKU) instead of a new scheme?
Instead of
web+activitypub://post/${encoded post uri}
, something like:I think (but have not checked) that Android apps can catch this with:
Prior art
Have any of the proposers read https://www.rfc-editor.org/rfc/rfc7595 (Guidelines and Registration Procedures for URI Schemes) and https://www.rfc-editor.org/rfc/rfc8615 (Well-Known Uniform Resource Identifiers)? The previous documents (PROPOSAL.md and webap.md) don't mention them, nor does this, so it's not clear.
New Well-Known URI?
Instead of a new URI scheme or webfinger, could this be achieved with Well-Known URIs like
https://{anything}/.well-known/activitypub/v1/...
? There's a list of existing registered WKUs at https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtmlThat community and the associated mailing list at https://www.ietf.org/mailman/listinfo/wellknown-uri-review should also be consulted, as I'm sure they'll have very relevant feedback.
Intended supported activities?
Is there an enumeration of all the different activities that would be supported by this? Is it just opening a post? Or is composing, replying, boosting, etc also in scope? If not in scope now, could they conceivably be in scope in the future (and if so, any proposal should be clearly extensible to do that).
For example, you could want to allow users to boost an episode by sending an intent that an app receives, boosts the post in the background, and the app returns a success/failure response to AntennaPod. The user never sees the app's UI in this scenario.
Multiple accounts
What is the UX supposed to be if the user has multiple accounts configured in their client?
UX when no app is installed
Re this:
Can't the post be opened in the user's browser instead?
Hope that's all helpful food for thought.
https://{somehost}/… is not good for common custom url schema that is not bind to specific app and specific site.
because Google requires "Digital Asset Links JSON" that indicate HOST allows which APP can open the link. https://developers.google.com/digital-asset-links/v1/getting-started
to open android apps, using URL that schema is http, https and bind to specific host, it is meanful only in case of app and host is strongly bind, but fediverse app is not so.
What nikclayton is talking about is overall far from the essence of the proposal.
Translated with www.DeepL.com/Translator (free version)
What the app should do when it receives this URL:.
testing implementation in Subway Tooter.
https://mastodon.juggler.jp/@SubwayTooter/109875655056667836
long ago we used to be able to open some https://host/@user/numId style URLs, but due to Google's restrictions we couldn't open them now.
this time handling the proposal is just to rewrite it a little, and there is no difficulty at all.
There was an issue that the caller app might not handle well.
If there is no app on your Android device to open it, your web browser will try to open web+activitypub://. If there is no protocol handler on the browser side, it just shows a blank page.
Is this something the calling app can handle?
please try https://juggler.jp/test/fedilink/ on your android device.
@tateisu:
What happens if the
android:host
part of the filter is*
, as in:?
@keunes:
All of that could be done with a custom intent and mime type. I haven't seen anything that requires a new URI scheme.
Just in case I wasn't sufficiently clear above, to view the root post AntennaPod could construct an intent like this:
and apps would have this intent filter:
This:
That doesn't work either though, even with
host="*"
. I have Fedilab on one of my devices, and it has this intent filter.The effect is that it hijacks links to Medium article, because they look like
https://somedomain.com/@authorname/path-to-post
. (e.g., https://medium.com/@Zhuinden/an-update-to-the-fragmentviewbindingdelegate-the-bug-weve-inherited-from-autoclearedvalue-7fc0a89fcae1)It got so bad I went in to the Android settings and disabled Fedilab's ability to do this.
What are the advantages of using MIME types instead of URL schemes?
We experienced that when Android 12 came.
Although it may be superfluous to state this for the given example. The content:// schema is used to manage ContentProvider on Android devices, and the authority part is managed by the OS. Having multiple apps with the same authority is extremely bad. A schema that has other legitimate uses should not be used for completely unrelated uses.
I am totally against automating actions. What he calls for is "a backdoor that spreads favorites and boosts without authentication". Those actions should be performed by explicit user manipulation, but receiver app can't trust sender that checked user's will.
I think it's the limit of acceptable to show message "{app name} is requesting boost this post". In other words, the suggestion text from sender is acceptable, but action is not.
Wrt this subject I would strongly recommend considering following the Fediverse Enhancement Proposal process, that is picking up steam currently.
The repository sits here at Codeberg at: https://codeberg.org/fediverse/fep
And discussions take place at SocialHub, the ActivityPub developer community at: https://socialhub.activitypub.rocks
The FEP's main purpose is to avoid fragmentation and ad-hoc interoperability that is prevalent on the Fediverse, and the process will continue to be improved.
MIME types already have a standard mechanism for conducting experiments and creating potentially vendor-specific extensions before any standardisation attempt, with either the
x-
prefix (or, actually better) thevnd.
prefix on the MIME subtype.See https://www.nih-cfde.org/resource/intro-mime-type for example.
So it's easy to conduct limited experiments without risking polluting a global namespace, and/or stomping on anyone else who's working in the same area.
To the best of my knowledge, new schemes do not have this property (https://html.spec.whatwg.org/#web+-scheme-prefix).
It is possible that these experiments will demonstate a use for a
web+activitypub
prefix. But I think to try and use that scheme first, when safer options exist, is irresponsible.I think you may be confused about the purpose of the MIME type in the intent.
The MIME type in an Android intent refers to the MIME type of the data carried in the intent, not the MIME type of the data referenced by the intent.
Proof: Look at https://developer.android.com/guide/components/intents-common#ViewUrl. The MIME type is one of
text/plain
,text/html
,application/xhtml+xml
, orapplication/vnd.wap.xhtml+xhtml
. However, the URI in thedata
portion of the intent could be a URI to an image, or a video file, or a PDF, or any other MIME type.So there is no need to know the MIME type of the data at the other end of the link.
This is only partially correct.
Yes, Android Content Providers use
content:
URIs to resolve content.No, their use is not restricted to just this. It is entirely possible for apps to create intents with
content:
URIs.However, implementing this as Content Providers would also be a valid approach. Specifically, Fedilab, Tusky, etc would be Content Providers from AntennaPod's perspective.
That probably makes Fedilab et al more complicated, so I'm not sure that's worthwhile for an experiment, but it would be possible.
[Edit: the more I think about this, the more I think it might be a good end-goal. If Fedilab, Tusky, etc exposed a hypothetical "MastodonApiContentProvider" this would allow apps like AntennaPod to query through that instead of needing to write their own code that talks to the Mastodon API]
Good question. The
mailto:
scheme has gone through multiple revisions since it was first introduced in RFC 1738, via RFCs 2368 and 6068.Because the original design did not include a version component each of those revisions had to ensure strict backwards compatability. That could have been avoided.
That is a gross mischaracterisation of what I said. I'm going to assume that that is because we have different native languages, and not deliberate.
Here's a sketch of how that could work the first time the user clicks "Boost" in AntennaPod.
startActivityForResult()
getCallingPackage()
orgetCallingActivity()
to, unspoofably, find the package name or component that sent the intentNow the user clicks "Boost" on a different post in AntennaPod.
Everything proceeds as before. Except this time, between steps 5 and 6 the app also checks the allowlist. If the sending package is listed as trusted then it performs the boost without needing to show any UI, and control returns back to AntennaPod. If it's not in the allowlist then the user sees the confirmation dialog.
The app would also need to provide a UI to allow the user to view the allowlist, and remove items from it.
And there is scope for more nuance, like "Trust this app for 90 days", or similar.
But this is entirely achievable in a way that is opt-in, preserves user choice, and allows the user to make the decision about which apps they trust.
Note that there's no such thing as "post" in ActivityPub. We have actors, objects and activities, so
web+activitypub://object/
would probably make more sense.This is even better. A similar proposal was discussed here: https://socialhub.activitypub.rocks/t/suggestion-a-custom-url-scheme-handler-as-a-streamlined-ux-for-cross-instance-interactions-on-the-web/504. The topic of AP URI scheme actually comes up quite often, but these conversations are scattered across the Fediverse and various issue trackers. I agree with @circlebuilder that FEP and SocialHub are the best places to propose and discuss fediverse standards.
There are several things that need to be said.
But overall I agree that this discussion is unlikely to converge in this thread.
Thanks all for your contributions! Some parts of the discussion go beyond my technical knowledge, but I did want to make some comments. CC @tateisu, @nikclayton, @silverpill
This sounds cool, but the request here is explicitly the opposite. If we wanted to support boosting, replying, commenting etc. in AntennaPod, we should just directly implement support for it (requiring the user to log in on AntennaPod with an ActivityPub account). This request is explicitly not about that
We want to externalise and let a dedicated app do the work. We need to facilitate direct communication from a sender (in this case AntennaPod, but could also be Funkwhale for Android) and a receiver (in my case it'd be Fedilab).
That's an important question. Not knowing much about Android development, I was kinda hoping that AntennaPod could implement a check if there's a receiver for the intent. And if not, guide the user (first display explanation about Mastodon, then open remote 'root post'/object).
That was not my comment, and all I can say is that I don't know the differences between the two approaches (again: not my area of expertise).
Frankly, this feels like the lazy approach. If an app developer wants to implement ActivityPub support, do it from scratch or use a library. This partial offloading to other apps feels wrong. But again: that different request, different discussion :-)
Thanks for pointing that out. I wasn't fully aware when creating the original post.
I was thinking indeed: the discussions about cross-server communication within a webbrowser is something else than Android app-to-app communication, no?
Yeap. I'll create a thread on SocialHub.
To solve the problem of cross-instance interaction on the web (remote follows, replies etc) we need to connect two web clients. In both cases we're dealing with app-to-app communication, but you're right, the optimal solution could differ depending on the platform (Web / Android).
no one create thread in other place?
The lengthy mechanism proposed by nikclayton doesn't convince me "why should the boost button be on the caller" and "why the callee should return the result".
I think that users will be satisfied if there is "Open post in another application".
There is no reason to need a uselessly complicated mechanism.
Is it because the calling app wants to track user behavior?
The plugin system is very prone to vulnerabilities. In particular, the proposal this time includes a procedure for "the user authenticates the caller app", but all the information that the user sees can be freely set by the caller app. Attackers can set icon and name as they want, also how many users will notice a one-letter difference in package name.
I am not impressed with the idea of using only convenient parts of other apps as plug-ins.
the proposed action flow is fully intended for native apps. Web browser apps and PWA cannot handle this. That's a complete mismatch with the
web+**
schema illustrated at the beginning of this proposal.Some services offer emoji reactions instead of favorites. Another service may offer both of quote boost and normal boost. The idea of "the caller app providing a common UI without being aware of the type of service" will probably only work for a limited range of services.
@tateisu @nikclayton @silverpill @circlebuilder: I have created a post to start the discussion about a possible FEP:
https://socialhub.activitypub.rocks/t/possible-fep-proposal-cross-android-app-way-to-open-object/2985
Hope you're willing to chip in there also!