cameri / nostream

A Nostr Relay written in TypeScript
MIT License
729 stars 188 forks source link

Disclose limits better at runtime in `relayInformationDocument` #201

Closed jnmclarty closed 1 year ago

jnmclarty commented 1 year ago

Clarifies limits advertised systematically in the relayInformationDocument accessible from a GET to the relay over HTTP.

Description

Motivation and Context

How Has This Been Tested?

I hit the following command on my local.

curl -X GET http://localhost:8008 -H 'accept: application/nostr+json' | jq

Screenshots (if appropriate):


{
  "name": "nostream.your-domain.com",
  "description": "A nostr relay written in Typescript.",
  "pubkey": "replace-with-your-pubkey-in-hex",
  "contact": "operator@your-domain.com",
  "supported_nips": [
    1,
    2,
    4,
    9,
    11,
    12,
    15,
    16,
    20,
    22,
    26,
    28,
    33,
    40,
    111
  ],
  "software": "git+https://github.com/Cameri/nostream.git",
  "version": "1.22.2",
  "limitation": {
    "max_payload_size": 524288,
    "max_subscriptions": 10,
    "max_filters": 10,
    "max_subid_length": 256,
    "min_prefix": 4,
    "max_event_tags": 2500,
    "max_content_length": [
      {
        "description": "64 KB for event kind ranges 0-10 and 40-49",
        "kinds": [
          [
            0,
            10
          ],
          [
            40,
            49
          ]
        ],
        "maxLength": 65536
      },
      {
        "description": "96 KB for event kind ranges 11-39 and 50-max",
        "kinds": [
          [
            11,
            39
          ],
          [
            50,
            9007199254740991
          ]
        ],
        "maxLength": 98304
      }
    ],
    "min_pow_difficulty": 0,
    "auth_required": false,
    "payment_required": false
  },
  "payments_url": "https://nostream.your-domain.com/invoices",
  "fees": {
    "admission": []
  }
}

Types of changes

Checklist:

...I think this matches docs now. If for some reason this PR is rejected, then I'd say docs need updating.

I didn't try to run the tests. LMK if I really need to figure it out for this.