206 views
owned this note
# Webmentions vs. Custom Mentions Spec for Twtxt/Yarn
Should we support the existing [Webmention](https://www.w3.org/TR/webmention/) specification or make a specific mentions format for twtxt.txt?
The issue with webmentions is that it depends on a canonical webpage to verify the validity of the mention, but not all twtxt feeds have such a webpage (e.g. https://lyse.isobeef.org/twtxt.txt). And in the indieweb world they like to parse HTML which adds more complexity to the implementation compare to, if we only use txt files. Keeping it simple and plain text based in the backend makes sure we can also support other protocols like Gemini and not just HTTP.
__Sørenpeter:__ *I'm in favour of a specific twt mention to keep the base layer plain text and letting the clients deal with the UI stuff.*
# How Should Mentions Work Across the Network?
## Exposing and deceting the endpoint
1. Similar to webmentions: Go to example.com and scan for a `<link rel="webmention" href="https://darch.dk/timeline/webmention" />`
2. add a webmention field to the twtxt.txt file: `webmention = https://darch.dk/timeline/webmention'
## Sender (Client)
- When a client detects a mention (`@<nick url>`) in a new post, it sends this as a webmention to the `url` if it can detect a valid endpoint. Then mentions should include the twt timestamp (`2021-01-19T18:20:11Z`), since this is more universal than the twt hash `(#abcd123)`.
- Should the client also send a mention when replying to a twt using `(#abcd123)` that does not include an explicit @mention?
- And should it also be possible to send a mention when you start following a feed?
## The POST Request
This is how a normal webmention request looks (from: https://www.w3.org/TR/webmention/#sender-notifies-receiver)
```HTTP
POST /webmention-endpoint HTTP/1.1
Host: aaronpk.example
Content-Type: application/x-www-form-urlencoded
source=https://waterpigs.example/post-by-barnaby&
target=https://aaronpk.example/post-by-aaron
```
~~Inspired by [RFC 5147: URI Fragment Identifiers for the text/plain Media Type](https://www.rfc-editor.org/rfc/rfc5147#section-3) we can use the following syntax for mentions between twtxt feeds: `http://example.com/twtxt.txt#twt=2024-03-04T17:11:38Z`~~
Useing the [Text fragments](https://developer.mozilla.org/en-US/docs/Web/Text_fragments) ([Boldly link where no one has linked before: Text Fragments](https://web.dev/articles/text-fragments)) syntax would look like this:
`http://example.com/twtxt.txt#:~:text=2024-03-04T17:11:38Z`
It works in Safari, but not in Chrome or Firefox (not without a plugin like [ichaoX/ext-textFragment: Firefox Text Fragment Extension](https://github.com/ichaoX/ext-textFragment)):
http://darch.dk/twtxt.txt#:~:text=2024-03-17T00:12:09Z
https://darch.dk/twtxt.txt#:~:text=2024-03-17T00:12:09Z,%0A (with linebreak as end paramenter)
So using `curl`, a request would look like this:
```bash
curl -i -d "source=http://algorave.dk/twtxt.txt#:~:text=2024-03-04T17:11:38Z&target=http://darch.dk/twtxt.txt#:~:text=2024-03-05T20:33:55Z" https://darch.dk/timeline/mention
```
## Receiver (Server)
- The endpoints receives the webmention and responds with `200 OK`, if it can find a twt in the sender's twtxt.txt with the included timestamp.
- Then the endpoint needs to inform the user of the recived webmentions in some way.
1. Make a special private feed like a `mentions.txt`, where mentions are written to.
2. Send the user an email with the mentions.
3. Some custom UI element in the receiver's application.
Going with option 1 reuses the rendering of a timeline that applications already have.
It could either include the full message as a blockquote or just a link to a web-based UI with the calculated twt hash.
```
Prologic mentioned you:
> @<sorenpeter https://darch.dk/twtxt.txt> what do you think about AI?
```
# Naming: twt-mentions or txt-mentions
Pros and cons for twt-mentions or txt-mentions?