a new simpler api and mvp implementation #2

Closed
x1ddos wants to merge 0 commits from api-simpler into master
x1ddos commented 1 year ago
Owner

@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 1 year ago
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 1 year ago
offbyn commented 1 year ago
Owner

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.
x1ddos commented 1 year ago
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.
offbyn commented 1 year ago
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 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.
x1ddos commented 1 year ago
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!
x1ddos commented 1 year ago
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 1 year ago
x1ddos force-pushed api-simpler from b8bde8fbf2 to 78a1aae7e8 1 year ago
offbyn commented 1 year ago
Owner

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

thank you 👍 .. I'll open a PR in nostrweb in a moment.
offbyn referenced this issue from a commit 1 year ago
x1ddos commented 1 year ago
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 :)
offbyn commented 1 year ago
Owner

yes please 👍

yes please 👍
offbyn referenced this issue from a commit 1 year ago
offbyn referenced this issue from a commit 1 year ago
x1ddos commented 1 year ago
Poster
Owner

merged manually

merged manually
x1ddos closed this pull request 1 year ago

Reviewers

offbyn was requested for review 1 year ago
This pull request cannot be reopened because the branch was deleted.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b api-simpler master
git pull origin api-simpler

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff api-simpler
git push origin master
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
Loading…
There is no content yet.