-
Notifications
You must be signed in to change notification settings - Fork 35
Mentions #3
Comments
The challenge with using @ is that there are no handles in Fritter, so it would need to be more like the way facebook completes than how twitter does. Also, URL tags are going to be challenging with dat URLs. Some thinking on this here: https://indieweb.org/person-tag |
Yeah probably
Is the person-tag an HTML based spec? All of fritter's data is published as JSON. What we really need to do is switch to JSON-LD and adopt one of the popular vocabs (like activitypub). |
I started sketching out some implementation here - whenever the user enters Next, I can add the array of mentioned users/their Dat URLs to the post, work on a way to remove a mention from a post (maybe a tag-style border around the mention with an "X" to remove?), and add to the notifications index. Let me know if there are any thoughts on the way this is going so far, otherwise I'll keep at it in the coming week! |
Awesome! |
The big change so far is that the post input is now a I'm also using a modified version of LibFritter that accepts mentions as a parameter. The way I have it set up there is pretty bare-bones, so we should talk about what it should look like (or if we need it at all) when it comes time to implement. Frets with mentions under that schema look like this: Roadmap from here is:
|
Looking good! |
The proposed structure here feels like a step towards the dreaded twitter entities model. At least you have the text to match rather than offsets into it though. But having an actual HTML fragment for this might be clearer, especially fi you want to support other contenteditable features in future. |
That's a fair point. In SSB we used Markdown to solve the issue. If we use HTML, we have sanitation issues though, right? CSPs help with that sort of thing but it still makes me nervous. WDYT? |
Markdown is a "now you have 2 problems" kind of answer. |
Sanitation is much easier if you're not expecting html elements to be specified in the input though, right? |
The best way to sanitize is to parse with a real html parser, then edit the
resulting dom to remove any elements you don't allow (or keep only the ones
that you allow). How browsers handle svg in an img tag is an example,
iframe sandbox is another. Beaker has a very good html parser available,
leverage that.
…On 24 Jan 2018 16:17, "Paul Frazee" ***@***.***> wrote:
Sanitation is much easier if you're not expecting html elements to be
specified in the input though, right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGCwFPEm9brZWGC4EaxKxCNzxtlpOXyks5tN1e2gaJpZM4RWsIH>
.
|
The simplest to implement and therefore safest approach is to create a container element and then set the content using I'm not saying that means we absolutely shouldn't use HTML, but it's an important tradeoff that we should consider. |
Great point on the entities model @kevinmarks. Just to summarize and make sure I'm understanding correctly, the fret from above:
could instead look like this:
Then it's a matter of filtering out undesired tags, attributes, values, etc. like @pfrazee mentioned, which can be handled on the Fritter feed when rendering posts (and any other apps that can read Fritter posts). I really like the idea of storing fret text as HTML - it keeps things much more flexible, even if it does have the increased security requirements that Paul mentioned. I'd be willing to spend some more time on this than originally planned and document allowed tags & attributes, if that was a helpful factor. Thoughts? |
Well, I'd advocate for the full indeweb person tag syntax, so If you want some good prior art on sanitizing html from unknown sources, I recommend feedparser or if you want a full js+css+html approach, Caja which is on npm here |
This test is an interesting one: https://news.ycombinator.com/item?id=11446984 |
We're stacking in a lot of new complexity here. Not only is security more complex to handle, but you're putting data into a second internal format. The mention We should only be considering a general markup like HTML in the text if we're really sure that we need that flexibility, and then we need to consider rules around presentation, semantics, fallback behaviors, and etc. |
Really good points on nesting data formats @pfrazee! While HTML itself might be fine in a post's content (based on its use in the ActivityPub spec, I can definitely see how that extra level of data being encoded would be overly complicated. Based on that and on Fritter's purpose as a microblogging platform, it does makes more sense not to include the extra flexibility of general markup like HTML. (I forget that this is all decentralized web, after all, and if someone wanted the flexibility of HTML, they're literally three clicks away from creating and hosting it themselves!) So to do a complete 180 😝, we could make a fret look like this:
This way, the fret:
It's still got the separate I also thought that using |
@SaFrMo I think that's good. It also lets non-supporting clients know that a mention was attempted without putting too much junk in the text. |
Sweet!
…On Tue, Jan 30, 2018 at 9:17 AM, Sander Moolin ***@***.***> wrote:
Almost there! Here it is in action using a couple test accounts:
[image: screen shot 2018-01-30 at 10 15 19 am]
<https://user-images.githubusercontent.com/5344587/35573963-8dbe2db4-05a6-11e8-9b21-ac858c218d8c.png>
Just need to format mentions in frets, double-check the PR code, and
submit!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABNhUx8KF1l8uZBohkbp41q5dNDDaaUEks5tPzJsgaJpZM4RWsIH>
.
|
Awesome project/feature! I am really new to P2P and super confused about how notifications would work...can someone do an ELI5? I tried peering through the source/browsing the archive on Beaker but no success 😬 |
@NicholasGWK By notifications, do you mean push notifications, or the notifications tab in fritter? If it's the former, that's not implemented yet. The latter works by listening on changes in your peers' dats and when it sees a new message mentioning you, it creates the notification. |
The code for that starts around here |
Thanks @RangerMauve, dug into source + more articles and its making sense now! I was referring to the notifications tab where it hits all people you're following. Cheers |
@NicholasGWK I'm working on some new data-channel APIs in Beaker to make pinging (some) peers possible, even if they don't follow you. We'll see how well they work. |
Awesome @pfrazee ! Would love to read up on that if possible or get some more context; just discovered Beaker/Dat after JSConfg and am really excited about it and trying to build stuff/contribute! Cheers |
@NicholasGWK I'm working on the internals still, see dat-ecosystem-archive/DEPs#27 to learn about that (Closing this issue since mentions were added, but feel free to keep discussion) |
Did you mean to close this issue @pfrazee? |
Yep, > (Closing this issue since mentions were added, but feel free to keep discussion) |
It'd be very nice if we could mention other users. This will require:
The text was updated successfully, but these errors were encountered: