Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 2.98 KB

02.md

File metadata and controls

76 lines (57 loc) · 2.98 KB

NID-02

Website comments

draft optional

This a method to have comments or a conversation around an URL. Without this method someone would have to post a link to a page in a kind:1 event and then others can reply to it, but that puts the conversation around the author posting that URL. This spec tries to de-emphasize the author of the root post and make the primary focus on the URL instead.

By using a kind:443 URL event with the URL as an r tag, clients create a root event for the URL. Multiple authors can post the same URL, but to the client it should be treated as a single (virtual) root post, the root being a single URL.

The kind:443 URL event by itself is not enough, a normal kind:1 reply to the kind:443 event is where the actual conversation happens.

Events

kind:443 URL event that represents a page or website

{
  "pubkey": "9be0be0e64d38a29a9cec9a5c8ef5d873c2bfa5362a4b558da5ff69bc3cbb81e",
  "id": "8c6ae3ecdc7380ad7bd6c0c2b2039f7f5faf1cf1ba2aaa040a594d15629bae14",
  "content": "Comments on nostur.com", // alt text for clients that don't support kind:443
  "kind": 443,
  "tags": [
    [
      "r", "https://nostur.com" // The URL (required)
    ]
  ]
}

kind:1 reply that represents a comment or reply on a page or website

// Should be like any other kind 1 reply, but with the `e` tag referring to the `kind:443` URL event
{
  "pubkey": "9be0be0e64d38a29a9cec9a5c8ef5d873c2bfa5362a4b558da5ff69bc3cbb81e",
  "id": "26d6a50b447153848f365d11e56fb65a066a41fc5729c5a392032670fe7bb812",
  "content": "Your website looks old", // The comment or reply text, same as any normal `kind:1`
  "kind": 1,
  "tags": [
    [
      "e",
      "8c6ae3ecdc7380ad7bd6c0c2b2039f7f5faf1cf1ba2aaa040a594d15629bae14" // id of the `kind:443` URL that is being replied to
      "",
      "root"
    ]
  ]
}

Creating replies or comments

When someone makes a new comment on a website, clients should send a kind:1 reply to a kind:443 URL event.

Clients can either use an existing kind:443 event for that URL or create a new one, it is ok to have multiple kind:443 events for the same URL, but it is recommended to reuse an existing one to make querying for all replies easier.

Reading replies or comments:

Clients that display kind:1 replies should show the reply not to the author of the kind:443 URL event, but to the URL in the r tag of the kind:443 URL event.

It is recommended to have a special view that displays the URL as root without author.

Replies to different kind:443 events that have the same URL in the r tag should be treated as replies to the same URL, as if there were only 1 single kind:443 event for that URL.

Fetching replies to a URL in 2 steps:

  1. Fetch all kind:443 URL events for that URL:
["REQ","sub1",{"kinds":[443],"#r":["https://nostur.com"]}]
  1. Fetch all kind:1 replies to the resulting ids of the previous request:
["REQ","sub2",{"kinds":[1],"#e":[<kind 443 ids here>]}]