nostr-protocol / nips

Nostr Implementation Possibilities
2.22k stars 527 forks source link

NIP-05 and CORS wildcards #1223

Open mleku opened 2 months ago

mleku commented 2 months ago

due to the limitations of the http request runtime of javascript in browsers, it is technically correct that JSON is in fact JS code, and thus servers serving up nostr.json files should be putting the wildcard header on

otherwise, web apps just get a cors error even though it's also a 404, which should take precedence but doesn't

it was a surprise to me that popped up recently - i assume - due to changes in this part of the javascript runtime of chrome

it's not hard to fix, but as with the net/http library in Go, the default static file hosting server does not enable the changing of headers and i had to write a custom handler specifically for anything nostr.json which serves the json if the matching path is sent in the request

mikedilger commented 2 months ago

JSON is in fact JS code

Which is another reason we need to work on binary events.

mleku commented 2 months ago

JSON is in fact JS code

Which is another reason we need to work on binary events.

as i've been discovering today also, websockets don't seem to like handling messages much bigger than 160kb and the number of follow lists that blow past that towards 500kb is astounding

it would be good if there could be some kind of survey done of multi-language binary codecs, and indeed, multi-language RPC libraries (jsonrpc, grpc, rpcx, etc) to try and build a consensus about what is the best candidate

my money is on gRPC/Protobuf because they are the most widely used binary RPCs in the industry, and could massively simplify the envelopes madness, to use an actual RPC library