Open knownasilya opened 6 years ago
@pfrazee feel free to correct or add anything that needs to be 👍
@knownasilya this is looking good. I'd probably just add a new internal web api (so, only exposed to beaker:
and intent:
locations) called beaker.intents
for reading/writing the data.
Thinking forward, there are two other major pieces:
@knownasilya for now, if you can just get something serving on intent:share
(or similar) with hardcoded handlers, that demos/mocks up the core experience, that'd be a good first step
@pfrazee what are you thinking would be on beaker.intents
as a start?
For (1) each intent probably needs to also use a certain query param for further filtering. Like in the share example, if your service only shares text, it would have a type: ['text/html']
or something of the sort. Haven't thought through this enough though, and it's definitely not a required feature for a minimal implementation I think.
@knownasilya Yeah we can iterate our way to things like that. For now I think all you need is a list/query function that takes the intent name.
Still very early and mostly hard coded stuff.
Very nice!
Works with twitter
Nice. I wonder if we'll end up needing a translation between query param names when registering an intent. Eg, "Register for intent:share
with the URL of https://foo.com?content={text}". We'll have to see-- obviously it'd be nicer if you could just say "...with the url of https://foo.com" and then have the params be added directly from the intent, with no remapping.
Yeah, been wondering the same. We might need a template like that:
let query = '?url=dat://mysite.com&text=hello';
let one = format('?share={text} {url}', query);
let two = format('?url={url}&content={url}', query);
// one => ?share=hello dat://mysite.com
// two => ?url=dat://mysite.com&content=hello
There's a fairly detailed spec for URI templates which is overkill for what we need, but might make good inspiration. I'm not sure we'd need more than simple string expansion, but who knows.
Yeah, have used that spec format a bit in the past. It might be a good solution so we aren't rolling something that is completely different. But if we can do simple, and then use the spec later without making it a breaking change, that would probably be best.
That's true, though that means we inherit that complex spec which I'd only want to do if I thought we needed most of the features
On Thu, Jul 19, 2018 at 2:20 PM Ilya Radchenko notifications@github.com wrote:
Yeah, have used that spec format a bit in the past. It might be a good solution so we aren't rolling something that is completely different. But if we can do simple, and then use the spec later without making it a breaking change, that would probably be best.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/beakerbrowser/beaker/issues/1079#issuecomment-406386073, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNhU1822toApTInLmZlu8oX3T29QQVrks5uINv0gaJpZM4VSE2C .
What about using the same syntax as registerProtocolHandler? It uses %s
as a placeholder for the URL.
It seems to be using the syntax for sprintf
I think only %s
is supported. Would we be able to intercept that navigator call? We'd still have to specify the site as a service provider and then load it and get it's specified configs. Might be a way to do it but also allow manual setup from beaker or from dat.json
.
Would we be able to intercept that navigator call?
I dont think that's what @RangerMauve was suggesting. Either way, let's not worry about this syntax yet because it's not clear we'll need it.
@knownasilya regarding intent registration, I think it'll need to be fields in the dat.json. I have a feeling if sites can prompt the user to install their intent-handlers, it'll become non-stop spam to do so (like with push notifications).
I wasn't even thinking about allowing that 😸 Agreed, dat.json
is probably best.
@knownasilya regarding intent registration, I think it'll need to be fields in the dat.json. I have a feeling if sites can prompt the user to install their intent-handlers, it'll become non-stop spam to do so (like with push notifications).
There is also study that supports the claim that permissions at install time causes users to grant permissions without considering what they are. So I would recommend incremental enhancement approach with different spam prevention mechanism:
I think advantage of intents over navigator.registerProtocolHandler
is that it provides one to many mapping so user can choose on demand. On the other hand navigator.registerProtocolHandler
has advantage of more wider browser support.
I wonder if later could be enhanced to support one to many mapping.
It also might be worth taking a look at Web Activities that Mozilla was pushing as counter proposal to intents & used in Firefox OS.
Intent Scheme: https://github.com/beakerbrowser/beaker/wiki/Intent-Scheme
I've been thinking of working on this and have had some discussions with @pfrazee in IRC, so decided to write down some notes for myself and in case anyone else wanted to come and help out.
Implementing intents as a MVF (Minimum Viable Feature) would include the following:
intent
protocol and redirect to an internal Beaker pageintent:share
and render the registered apps.To take this beyond the basics the following might be implemented:
currentUserProfile = await beaker.profiles.getCurrentUserProfile()
?Related Issues
Follow dev here https://github.com/knownasilya/beaker/tree/feat/intents