buckket / twtxt

Decentralised, minimalist microblogging service for hackers.
http://twtxt.readthedocs.org/en/stable/
MIT License
1.94k stars 79 forks source link

Support linkbacks as in the blogosphere #109

Open archusr opened 8 years ago

archusr commented 8 years ago

Consider two users foo (https://foo.org/twtxt.txt) and bar (https://bar.org/twtxt.txt).

When user foo mentions user bar in her tweet, the client could call the linkback url as defined in bar's metadata (#22 #48), e.g. https://bar.org/twtxt/ping.php?url=https://foo.org/twtxt.txt&name=foo (name optional?)

ping.php would log the request to https://bar.org/twtxt/ping.txt (linkback log) as in: 2016-03-06T11:12:25+01:00 <@foo https://foo.org/twtxt.txt> mentioned you.

As user bar is subscribed to her linkback log she'd see the mention in her timeline.

Similar to pingback/trackback as in blogs, cf. https://en.wikipedia.org/wiki/Linkback. Sorry, if you already thought of all this.

Exemplary ping.php to write the linkback log ping.txt

$line = date('Y-m-d\TH:i:sP')."\t"."<@$_GET['name'] $_GET['url']> mentioned you.";
$fh = fopen('ping.txt','a'); fwrite($fh, $line."\n"); fclose($fh);
mdom commented 8 years ago

If user foo is registered at a registry, user bar could just query for mentions to see foo's tweet. Although i think it would be very nice to have a linkback plugin if a plugin system is ever added.

archusr commented 8 years ago

Ah, registries, thanks for pointing that out. It's a bit opposing the idea of decentralization, though.

mdom commented 8 years ago

The plan is to have multiple registries than can exchange their data. You would always be able to run your own registry.

timofurrer commented 8 years ago

I really like the idea of of the linkback - it must be optional though: if the linkback call fails it doesn't matter.

Ah, registries, thanks for pointing that out. It's a bit opposing the idea of decentralization, though.

I agree with that.

mdom commented 8 years ago

Yeah, you're right. I implemented basic support for Linkback in txtnix. Maybe we can discuss here what a twtxt client should send to a linkback URL. Is the URL enough? Anything else the endpoint would need? Should the endpoint check if user foo really mentioned user bar and only then write to the linkback log? Do you have an logback log we could play with archuser? But in the end it all hinges on our answer to #48.

archusr commented 8 years ago

Great, I like it a lot. I want to suggest:

[edit]: Not sure about also sending the tweet itself (for emailing), as the endpoint can retrieve it by itself to process/mail it etc.

DracoBlue commented 8 years ago

:+1:

Url of the twtxt.txt should be sifficient. Nick and real content of the tweet can be retrieved by the client ondemand.

So it is more like a ping ;)

archusr commented 8 years ago

You're right, URL is enough. Here's my initial ping.php (working for me ;).

edit 2016-03-14: For simple testing purposes here's a ping endpoint that allows to set a mentioningurl as if it was your ping endpoint, e.g. foo mentions bar:

curl -XPOST https://post.aldebaran.uberspace.de/twtxt/ping/test/ -d url=https://foo.org/twtxt.txt -d mentioningurl=https://bar.org/twtxt.txt

(So, basically user sending the ping/source is "url", while "mentioningurl" is the mentioned target user.) Note, that the content from url is retrieved to search for the mentioningurl.

The calls are recorded into this twtxt: http://post.aldebaran.uberspace.de/twtxt/ping/test/pingtest.txt

Puddinglord commented 8 years ago

I have a question for archusr, I am a college student working with a group that was going to work on this feature for a class, I see you have ping.php so would the link-back mention still be applicable to work on?

archusr commented 8 years ago

Hi @Puddinglord, thanks for your interest and support. The ping.php is just a simple/sample ping backend/receiver. At the moment, txtnix is the first and only twtxt client to support linkbacks. I'm not sure if @buckket is interested in working code for twtxt -- which could be a nice project from my point of view, and I definately would be happy to see it :)

Zegnat commented 7 years ago

Just driving by and wanted to drop in and point people at Webmention, the latest W3C Recommendation for “a simple way to notify any URL when you mention it on your site”.

The syntax is basically as described by @archusr in https://github.com/buckket/twtxt/issues/109#issuecomment-196016659, except the parameters are called source and target.

kixiQu commented 3 years ago

The change would be that the webmention endpoint would have to be discoverable.

The sender must fetch the target URL (and follow redirects [FETCH]) and check for an HTTP Link header [RFC5988] with a rel value of webmention. If the content type of the document is HTML, then the sender must look for an HTML and element with a rel value of webmention. If more than one of these is present, the first HTTP Link header takes precedence, followed by the first or element in document order. Senders must support all three options and fall back in this order.

webmention spec

Adding a Link header is possible for anyone who's willing to fiddle with their web server, but isn't straightforward otherwise.

zzo38 commented 2 years ago

If you want to reference a specific message (e.g. to reply to a question that it asks), then how are you supposed to know which message you are referencing? It seems to me that doing that would be more useful than merely a mention of the user name, which isn't very helpful in my opinion.