Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send webmentions #1395

Closed
chrysn opened this issue Jan 30, 2021 · 7 comments
Closed

Send webmentions #1395

chrysn opened this issue Jan 30, 2021 · 7 comments
Labels
enhancement New feature or request extra: help wanted Extra attention is needed

Comments

@chrysn
Copy link

chrysn commented Jan 30, 2021

Is your proposal related to a problem?

Without going full ActivityPub (not sure if it'd work even then), I can't tell from my website whether it has been talked about on lemmy.

Getting this information would be useful, as then the (mostly static) website could, rather than employing any local or centralized "comments" tool, say something like "Post about this on the fediverse, eg. by posting it on Lemmy", and then have below a list of all the threads talking about this particular page.

Describe the solution you'd like

Implementing the Webmention specification would just do this:

Whenever a post is created about a page (possibly also when it's just linked to in formatted text, I'm not sure whether that makes sense), the Lemmy server would load the page (it probably does so anyway already to get title and stuff), look at whether it has a rel="webmention" link outgoing (in Link headers, or a <{link,a} href="..."> link), and if so POSTs a short x-www-form-urlencoded thingy there.

There's probably a few details I'm missing (being new to the tool myself), but in the end it should rather be straightforward.

Describe alternatives you've considered

There's a lot of technologies that led up to webmentions -- pingback, refback, talkback, trackback -- but webmentions is what made it to W3C Recommendation and generally looks sound.

The static page could, instead, go full ActivityPub, participate in the fediverse and look for mentions -- but a) I don't even know if that works without the page setting itself up, and b) is a lot more complex than webmentions, which a page can even do just in JavaScript by referring to https://webmention.io/ and evaluating it at runtime (although there may be reasons not to do that, cf. https://martymcgui.re/2020/07/15/what-we-talk-about-when-were-talking-about-webmentions/ on "Just let JavaScript do it!").

I could of course link to something like https://commentpara.de/ -- but Lemmy lends itself to having an actual discussion,

Additional context

This has been requested for Reddit, but rather ignored there.

How I tested it doesn't work already

(for I don't have a website running that'd actually make use of it yet)

I checked the source code for any mention of "webmentions", "pingback", "linkback", "refback", "talkback" and "trackback" (the technologies available for this mentioned on https://github.com/pelican-plugins/linkbacks/), and none of that showed up.

Also, the post at https://lemmy.ml/post/41713 mentions https://martymcgui.re/2020/07/15/what-we-talk-about-when-were-talking-about-webmentions/ which uses the webmention.io backend and thus would be visible at https://webmention.io/api/mentions.jf2?target=https://martymcgui.re/2020/07/15/what-we-talk-about-when-were-talking-about-webmentions/ -- but nothing there indicates that lemmy has ever pinged it.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@chrysn chrysn added the enhancement New feature or request label Jan 30, 2021
@Nutomic Nutomic added the extra: help wanted Extra attention is needed label Feb 1, 2021
@Nutomic
Copy link
Member

Nutomic commented Feb 1, 2021

We use iframely to get info about linked sites, and it has an endpoint to get the rel field among other things: https://iframely.com/docs/iframely-api

So this is gonna need a new method in crates/utils/src/request.rs which calls that endpoint and extracts the value (because right now we only use the oembed endpoint). And then a change in crates/api/post.rs::CreatePost to make the webmention request itself.

Contributions welcome, we probably wont be able to work on this anytime soon.

@chrysn
Copy link
Author

chrysn commented Feb 1, 2021

I'm open to giving it a try, but how would I test this locally? The publicly available test API does seem to support arbitrary links including webmention (checked on http://debug.iframely.com/?uri=https%3A%2F%2Fwebmention.io on origin data), but how can I (now or even when playing around with the code) verify it works with the actually used API endpoint? Looks like I'd need to populate the iframely_url config value – do I need to get a subscription with Iframely, and even then where does the token go in? (format!("{}/oembed?url={}", Settings::get().iframely_url, url); seems to indicate it's not in the iframely_url)

And implementation details apart, would this be active by default on lemmy instances? (It really only makes sense if it is, so we may want to have that discussion beforehand. IMO it's OK because it's not like the information can't be spidered off just as well, so it could be on by default unless the instance kind of completely locks itself down).

@Nutomic
Copy link
Member

Nutomic commented Feb 1, 2021

You should be able to test it with the setup in docker/dev/docker_update.sh. I'm also not sure if this should be a default, in fact thats what I was gonna ask. Does it make sense to send webmentions always, or would it make sense to add a config option or something?

@chrysn
Copy link
Author

chrysn commented Feb 1, 2021 via email

@Nutomic
Copy link
Member

Nutomic commented Feb 1, 2021

I see, as long as there are no negative effects from webmentions then I'm fine with having it as default. So far all posts and communities are public, so you dont have to worry about that. We are gonna add private communities later, and will have to keep in mind to disable webmentions then (so maybe just mention it in a code comment).

@Nutomic
Copy link
Member

Nutomic commented Jul 3, 2021

I checked and there is actually a webmentions crate. So fixing this issue should be as simple as calling that crate from CreatePost, then running Lemmy locally to test if it sends the webmention as expected. Would you like to give that a try?

@chrysn
Copy link
Author

chrysn commented Oct 11, 2021

Thanks a lot for implementing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request extra: help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants