initial: api v1 draft
commit
780b16cf5f
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 qcode.ch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
@ -0,0 +1,88 @@
|
||||
# noxy is a nostr proxy
|
||||
|
||||
noxy receives a [nostr](https://nostr.info/) 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
|
||||
|
||||
there's a single endpoint accepting a nostr event id and relay to fetch the event from:
|
||||
|
||||
GET /api/v1/e/<event-id>?relay=<relay-uri>
|
||||
|
||||
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:
|
||||
|
||||
```json
|
||||
{
|
||||
"images": {
|
||||
"https://git.qcode.ch/avatars/5a8071777eba7ebf178143fa650c8012?size=870": "https://noxy.example.org/abcdef/abcdef0123456789.png"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[event raw data →](https://nostr.com/e/e01ac1cfc5cb68b54183f878261b21ef30a65f5e06a24356cfe3ecdacce14bae)
|
||||
|
||||
if a noxy instance is unable to fetch the original, it responds with an empty object:
|
||||
|
||||
```json
|
||||
{
|
||||
"images": {}
|
||||
}
|
||||
```
|
||||
|
||||
### fetch images from a text note, event kind 1
|
||||
|
||||
request example:
|
||||
|
||||
GET /api/v1/e/d822fdd220d8a74d2f025f331840eec8a640a663f1d3ca3de9f6a74ff0cc61fa?relay=wss%3A%2F%2Frelay.damus.io
|
||||
|
||||
response:
|
||||
|
||||
```json
|
||||
{
|
||||
"images": {
|
||||
"https://res.cloudinary.com/eskema/image/upload/v1668636521/osso_vt7qh7.png": "https://noxy.example.org/fedcba/fedcba9876543210.png"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[event raw data →](https://nostr.com/e/d822fdd220d8a74d2f025f331840eec8a640a663f1d3ca3de9f6a74ff0cc61fa)
|
||||
|
||||
### 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:
|
||||
|
||||
```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"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[event raw data →](https://nostr.com/e/af30dac1d800acc25b87d0d6d0dd33bddf49e7f356556540a6c7722e3cb363fe)
|
Loading…
Reference in New Issue