|
|
|
@ -6,10 +6,39 @@ such proxies to reduce IP address leaks and client fingerprinting.
|
|
|
|
|
|
|
|
|
|
## API v1
|
|
|
|
|
|
|
|
|
|
there's a single endpoint accepting a nostr event id and relay to fetch the event from:
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"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](https://ogp.me/) or [oEmbed](https://oembed.com/).
|
|
|
|
|
|
|
|
|
|
some examples follow.
|
|
|
|
|
|
|
|
|
|
### fetch a pubkey profile picture, event kind 0
|
|
|
|
@ -22,21 +51,22 @@ request example:
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"images": {
|
|
|
|
|
"https://git.qcode.ch/avatars/5a8071777eba7ebf178143fa650c8012?size=870": "https://noxy.example.org/abcdef/abcdef0123456789.png"
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"url": "https://git.qcode.ch/avatars/5a8071777eba7ebf178143fa650c8012?size=870",
|
|
|
|
|
"cache": "https://noxy.example.org/abcdef/abcdef0123456789.png",
|
|
|
|
|
"kind": "media",
|
|
|
|
|
"size": 279342
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
[event raw data →](https://nostr.com/e/e01ac1cfc5cb68b54183f878261b21ef30a65f5e06a24356cfe3ecdacce14bae)
|
|
|
|
|
|
|
|
|
|
if a noxy instance is unable to fetch the original, it responds with an empty object:
|
|
|
|
|
if a noxy instance is unable to fetch the original, it responds with an empty array:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"images": {}
|
|
|
|
|
}
|
|
|
|
|
[]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### fetch images from a text note, event kind 1
|
|
|
|
@ -48,11 +78,14 @@ request example:
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"images": {
|
|
|
|
|
"https://res.cloudinary.com/eskema/image/upload/v1668636521/osso_vt7qh7.png": "https://noxy.example.org/fedcba/fedcba9876543210.png"
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"url": "https://res.cloudinary.com/eskema/image/upload/v1668636521/osso_vt7qh7.png",
|
|
|
|
|
"cache": "https://noxy.example.org/fedcba/fedcba9876543210.png",
|
|
|
|
|
"kind": "media",
|
|
|
|
|
"size": 93241
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
[event raw data →](https://nostr.com/e/d822fdd220d8a74d2f025f331840eec8a640a663f1d3ca3de9f6a74ff0cc61fa)
|
|
|
|
@ -66,23 +99,16 @@ request example:
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"links": {
|
|
|
|
|
"https://github.com/fiatjaf/noscl/pull/24": {
|
|
|
|
|
"og:image": "https://opengraph.githubassets.com/dc27...92c8/fiatjaf/noscl/pull/24",
|
|
|
|
|
"og:image:alt": "if the arg to publish or message command is '-', it is read from stdin.\ncloses #19",
|
|
|
|
|
"og:image:width": "1200",
|
|
|
|
|
"og:image:height": "600",
|
|
|
|
|
"og:site_name": "GitHub",
|
|
|
|
|
"og:type": "object",
|
|
|
|
|
"og:title": "publish,message: accept content from stdin by x1ddos · Pull Request #24 · fiatjaf/noscl",
|
|
|
|
|
"og:description": "if the arg to publish or message command is '-', it is read from stdin.\ncloses #19"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"images": {
|
|
|
|
|
"https://opengraph.githubassets.com/dc27...92c8/fiatjaf/noscl/pull/24": "https://noxy.example.org/beef01/beef0123456789.png"
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"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"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
[event raw data →](https://nostr.com/e/af30dac1d800acc25b87d0d6d0dd33bddf49e7f356556540a6c7722e3cb363fe)
|
|
|
|
|