a new simpler api and mvp implementation #2

Closed
x1ddos wants to merge 0 commits from api-simpler into master

@offbyn please take a look at first commit, the readme file. it has curl examples. they all work - i already set it up and running at noxy.nostr.ch.

@offbyn please take a look at first commit, the readme file. it has `curl` examples. they all work - i already set it up and running at noxy.nostr.ch.
x1ddos added 2 commits 2022-12-05 22:54:36 +00:00
8dc6a62eb8
docs: replace api with a simpler version
the previous design was too complex to implement due its double
roundtrip: first JSON, then data.

in this new design, the client gets the data right away, single
roundtrip.
23dd93f12a
basic implementation of the last api version
the meat is in Noxer struct, in noxy.go.
executable server entry point is in cmd/noxy/main.go.

all request responses are cached using a rudimentary filesystem
based caching. a max storage quota is not implemented yet.
x1ddos requested review from offbyn 2022-12-05 22:55:18 +00:00

very nice, I'll need more time testing and playing with it, see profile pics PR nostr/nostrweb#19

sometimes I get "context deadline exceeded" i.e. for

https://noxy.nostr.ch/data?id=45c340a8e338aeddfeb1ccf6e1a26d7cb990afbc961fa5637c9d77a7ae3f7dec&relay=wss%3A%2F%2Fnostr.x1ddos.ch&url=https%3A%2F%2Fbranle.netlify.app%2Fbird.png

I'll need more time to take a closer look at this PR.

very nice, I'll need more time testing and playing with it, see profile pics PR https://git.qcode.ch/nostr/nostrweb/pulls/19 sometimes I get "context deadline exceeded" i.e. for https://noxy.nostr.ch/data?id=45c340a8e338aeddfeb1ccf6e1a26d7cb990afbc961fa5637c9d77a7ae3f7dec&relay=wss%3A%2F%2Fnostr.x1ddos.ch&url=https%3A%2F%2Fbranle.netlify.app%2Fbird.png I'll need more time to take a closer look at this PR.
Poster
Owner

sometimes I get "context deadline exceeded" i.e. for

https://noxy.nostr.ch/data?id=45c340a8e338aeddfeb1ccf6e1a26d7cb990afbc961fa5637c9d77a7ae3f7dec&relay=wss%3A%2F%2Fnostr.x1ddos.ch&url=https%3A%2F%2Fbranle.netlify.app%2Fbird.png

I'll need more time to take a closer look at this PR.

💩 i think it's a bug in noxy. i restarted it just now and it works. this means there's some kind of deadlock in the code. i'll try to debug.

> sometimes I get "context deadline exceeded" i.e. for > > https://noxy.nostr.ch/data?id=45c340a8e338aeddfeb1ccf6e1a26d7cb990afbc961fa5637c9d77a7ae3f7dec&relay=wss%3A%2F%2Fnostr.x1ddos.ch&url=https%3A%2F%2Fbranle.netlify.app%2Fbird.png > > I'll need more time to take a closer look at this PR. 💩 i think it's a bug in noxy. i restarted it just now and it works. this means there's some kind of deadlock in the code. i'll try to debug.

@x1ddos I am getting 400 Bad Request, could you enable cors on https://noxy.nostr.ch/meta ?

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://noxy.nostr.ch/meta?id=dc2707d4b4b2cd1c0d65dfcf1bfe3ddc3eb9313572cd5cfa6a8f235b7d2472ed&relay=wss%3A%2F%2Frelay.nostr.info&url=https%3A%2F%2Fcommonreader.substack.com%2Fp%2Fhow-to-write-like-malcolm-gladwell. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

@x1ddos I am getting 400 Bad Request, could you enable cors on https://noxy.nostr.ch/meta ? > Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://noxy.nostr.ch/meta?id=dc2707d4b4b2cd1c0d65dfcf1bfe3ddc3eb9313572cd5cfa6a8f235b7d2472ed&relay=wss%3A%2F%2Frelay.nostr.info&url=https%3A%2F%2Fcommonreader.substack.com%2Fp%2Fhow-to-write-like-malcolm-gladwell. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
Poster
Owner

@x1ddos I am getting 400 Bad Request, could you enable cors on https://noxy.nostr.ch/meta ?

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

🙈 completely forgot. will do!

> @x1ddos I am getting 400 Bad Request, could you enable cors on https://noxy.nostr.ch/meta ? > > > Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource 🙈 completely forgot. will do!
Poster
Owner

@x1ddos I am getting 400 Bad Request, could you enable cors on https://noxy.nostr.ch/meta ?

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

🙈 completely forgot. will do!

how about now?

$ curl -i https://noxy.nostr.ch/
HTTP/2 200 
server: nginx
date: Fri, 09 Dec 2022 22:49:05 GMT
content-type: text/plain; charset=utf-8
content-length: 60
access-control-allow-headers: *
access-control-allow-methods: GET, OPTIONS
access-control-allow-origin: *
access-control-expose-headers: *
strict-transport-security: max-age=63072000; includeSubDomains; preload

this is noxy version v0.0.1
https://git.qcode.ch/nostr/noxy
> > @x1ddos I am getting 400 Bad Request, could you enable cors on https://noxy.nostr.ch/meta ? > > > > > Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource > > 🙈 completely forgot. will do! how about now? ``` $ curl -i https://noxy.nostr.ch/ HTTP/2 200 server: nginx date: Fri, 09 Dec 2022 22:49:05 GMT content-type: text/plain; charset=utf-8 content-length: 60 access-control-allow-headers: * access-control-allow-methods: GET, OPTIONS access-control-allow-origin: * access-control-expose-headers: * strict-transport-security: max-age=63072000; includeSubDomains; preload this is noxy version v0.0.1 https://git.qcode.ch/nostr/noxy ```
x1ddos force-pushed api-simpler from 23dd93f12a to b8bde8fbf2 2022-12-09 22:53:32 +00:00 Compare
x1ddos force-pushed api-simpler from b8bde8fbf2 to 78a1aae7e8 2022-12-09 22:58:17 +00:00 Compare

thank you 👍 .. I'll open a PR in nostrweb in a moment.

thank you 👍 .. I'll open a PR in nostrweb in a moment.
Poster
Owner

@offbyn i think i'll merge as is and iterate in the next commits to make this more performant. i want to auto-deploy this similarly to nostrweb so i don't have to copy the binary every time myself :)

@offbyn i think i'll merge as is and iterate in the next commits to make this more performant. i want to auto-deploy this similarly to nostrweb so i don't have to copy the binary every time myself :)

yes please 👍

yes please 👍
Poster
Owner

merged manually

merged manually
x1ddos closed this pull request 2022-12-10 14:50:27 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nostr/noxy#2
There is no content yet.