alex
8d1e0c3520
a possibly better data format to work with in javascript. |
2 years ago | |
---|---|---|
LICENSE | 2 years ago | |
README.md | 2 years ago |
README.md
noxy is a nostr proxy
noxy receives a nostr event id, fetches images and link previews, and returns the result in a JSON object. the idea is to run such proxies to reduce IP address leaks and client fingerprinting.
API v1
over HTTP, noxy exposes a single endpoint accepting a nostr event id and a relay to fetch the event from:
GET /api/v1/e/<event-id>?relay=<relay-uri>
the response is an array of objects:
[
{
"url": "<original url>",
"cache": "<noxy url>",
"kind": "media|preview",
"size": 123,
"title": "resource title",
"descr": "resource description"
}
]
where url
is the original url found in a nostr event payload and cache
is the
proxied url or a link preview image. the other fields presence and their values
depend on the kind
of the resource.
for images, videos and audio the kind
field is media
and the size
is the
file size in bytes as stored in cache. if the file size is unknown at the time
of a response, it is 0.
for link previews, the kind
field is preview
, cache
url points to a link
preview image and the size
is the preview image size. link preview image,
title
and descr
field values are collected using
the open graph protocol or oEmbed.
some examples follow.
fetch a pubkey profile picture, event kind 0
request example:
GET /api/v1/e/e01ac1cfc5cb68b54183f878261b21ef30a65f5e06a24356cfe3ecdacce14bae?relay=wss%3A%2F%2Frelay.nostr.info
response:
[
{
"url": "https://git.qcode.ch/avatars/5a8071777eba7ebf178143fa650c8012?size=870",
"cache": "https://noxy.example.org/abcdef/abcdef0123456789.png",
"kind": "media",
"size": 279342
}
]
if a noxy instance is unable to fetch the original, it responds with an empty array:
[]
fetch images from a text note, event kind 1
request example:
GET /api/v1/e/d822fdd220d8a74d2f025f331840eec8a640a663f1d3ca3de9f6a74ff0cc61fa?relay=wss%3A%2F%2Frelay.damus.io
response:
[
{
"url": "https://res.cloudinary.com/eskema/image/upload/v1668636521/osso_vt7qh7.png",
"cache": "https://noxy.example.org/fedcba/fedcba9876543210.png",
"kind": "media",
"size": 93241
}
]
fetch link preview from a text note, event kind 1
request example:
GET /api/v1/e/af30dac1d800acc25b87d0d6d0dd33bddf49e7f356556540a6c7722e3cb363fe?relay=wss%3A%2F%2Fnostr.x1ddos.ch%2F
response:
[
{
"url": "https://github.com/fiatjaf/noscl/pull/24",
"cache": "https://noxy.example.org/beef01/beef0123456789.png",
"kind": "preview",
"size": 110480,
"title": "publish,message: accept content from stdin by x1ddos · Pull Request #24 · fiatjaf/noscl",
"descr": "if the arg to publish or message command is '-', it is read from stdin.\ncloses #19"
}
]