Git Product home page Git Product logo

nostr-proxy's Introduction

Nostr Proxy

Push and get events to your Proxy, get results from multiple Nostr relays

Installation

In the project directory, run:

pnpm install

Edit your env variables. You can use a .env file by copying the file .env.example in the root directory, or you can set your variables into your hosting provider UI.
For APP_KEY, you can use the following command to generate one node ace generate:key

PORT=3333
HOST=0.0.0.0
NODE_ENV=development
APP_KEY=unique-key
DRIVE_DISK=local
SESSION_DRIVER=cookie
CACHE_VIEWS=false
PROXY_URL=wss://your-proxy.com
RELAYS=wss://relay1.com,wss://relay2.com,wss://relay.com

Launch

Development

npm run dev to start the app in dev mode.
Open http://localhost:3333 to view it in the browser.
Use ws://localhost:3333 into your Nostr client.

Production

npm run build
cd build
pnpm install --prod
node server.js

Running tests

TODO

Known issues

  • None?

Learn More

License

This project is MIT licensed.

nostr-proxy's People

Contributors

dolu89 avatar fryheid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nostr-proxy's Issues

Add connection limits

Proxy should be like a relay with connection limitation.
Also limiting clients connected to the proxy can reduce REQ limit to relays. (not perfect)

Explore NDK as replacement

NDK is a great tool and have a solid bases. Let's see if it can replace the current pool in a better way

Footer styling issues (floating over relays and showing a gap)

image

There are two thing going on with the footer:

  • The footer has a styling of position absolute
  • The footer has a gap on the right side on smaller screens

Position absolute

This causes overlap of the footer with the relay list with longer lists (~30 relays) and on mobile views. It can be resolved by removing position: absolute, but I think the intent is position: sticky.

Footer gap

This is only a problem on mobile views . The input.copy-text bleeds outside of the container because it gets a larger width than the container.

Add NIP 42

Adding NIP 42 to restrict people using a public instance of Nostr proxy.
Add authorized pubkeys in an env variable.

An idea for later: A paywall can be added, like nostream, to allow new members.

TypeError: Cannot read property 'sendUTF' of undefined

Proxy seems to be working, but it outputs lots of errors like these:

Feb 17 14:26:47 106310-h-box node[149621]: TypeError: Cannot read property 'sendUTF' of undefined
Feb 17 14:26:47 106310-h-box node[149621]:     at WebSocket.send (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/websocket-polyfill/lib/WebSocket.js:72:30)
Feb 17 14:26:47 106310-h-box node[149621]:     at trySend (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:427:10)
Feb 17 14:26:47 106310-h-box node[149621]:     at Object.unsub (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:454:9)
Feb 17 14:26:47 106310-h-box node[149621]:     at /home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:627:35
Feb 17 14:26:47 106310-h-box node[149621]:     at Array.forEach (<anonymous>)
Feb 17 14:26:47 106310-h-box node[149621]:     at Object.unsub (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:627:14)
Feb 17 14:26:47 106310-h-box node[149621]:     at WebSocket.<anonymous> (/home/nproxy/nostr-proxy/app/Services/NostrSocket.ts:92:62)
Feb 17 14:26:47 106310-h-box node[149621]:     at WebSocket.emit (events.js:400:28)
Feb 17 14:26:47 106310-h-box node[149621]:     at Receiver.receiverOnMessage (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:1180:20)
Feb 17 14:26:47 106310-h-box node[149621]:     at Receiver.emit (events.js:400:28)
Feb 17 14:26:47 106310-h-box node[149621]: TypeError: Cannot read property 'sendUTF' of undefined
Feb 17 14:26:47 106310-h-box node[149621]:     at WebSocket.send (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/websocket-polyfill/lib/WebSocket.js:72:30)
Feb 17 14:26:47 106310-h-box node[149621]:     at trySend (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:427:10)
Feb 17 14:26:47 106310-h-box node[149621]:     at Object.sub (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:444:5)
Feb 17 14:26:47 106310-h-box node[149621]:     at /home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:603:17
Feb 17 14:26:47 106310-h-box node[149621]:     at runMicrotasks (<anonymous>)
Feb 17 14:26:47 106310-h-box node[149621]:     at processTicksAndRejections (internal/process/task_queues.js:95:5)
Feb 17 14:26:50 106310-h-box node[149621]: TypeError: Cannot read property 'sendUTF' of undefined
Feb 17 14:26:50 106310-h-box node[149621]:     at WebSocket.send (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/websocket-polyfill/lib/WebSocket.js:72:30)
Feb 17 14:26:50 106310-h-box node[149621]:     at trySend (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:427:10)
Feb 17 14:26:50 106310-h-box node[149621]:     at Object.unsub (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:454:9)
Feb 17 14:26:50 106310-h-box node[149621]:     at /home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:627:35
Feb 17 14:26:50 106310-h-box node[149621]:     at Array.forEach (<anonymous>)
Feb 17 14:26:50 106310-h-box node[149621]:     at Object.unsub (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:627:14)
Feb 17 14:26:50 106310-h-box node[149621]:     at WebSocket.<anonymous> (/home/nproxy/nostr-proxy/app/Services/NostrSocket.ts:92:62)
Feb 17 14:26:50 106310-h-box node[149621]:     at WebSocket.emit (events.js:400:28)
Feb 17 14:26:50 106310-h-box node[149621]:     at Receiver.receiverOnMessage (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:1180:20)
Feb 17 14:26:50 106310-h-box node[149621]:     at Receiver.emit (events.js:400:28)
Feb 17 14:27:38 106310-h-box node[149621]: TypeError: Cannot read property 'sendUTF' of undefined
Feb 17 14:27:38 106310-h-box node[149621]:     at WebSocket.send (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/websocket-polyfill/lib/WebSocket.js:72:30)
Feb 17 14:27:38 106310-h-box node[149621]:     at trySend (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:427:10)
Feb 17 14:27:38 106310-h-box node[149621]:     at Object.sub (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:444:5)
Feb 17 14:27:38 106310-h-box node[149621]:     at /home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:603:17
Feb 17 14:27:38 106310-h-box node[149621]:     at runMicrotasks (<anonymous>)
Feb 17 14:27:38 106310-h-box node[149621]:     at processTicksAndRejections (internal/process/task_queues.js:95:5)
Feb 17 14:27:38 106310-h-box node[149621]: TypeError: Cannot read property 'sendUTF' of undefined
Feb 17 14:27:38 106310-h-box node[149621]:     at WebSocket.send (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/websocket-polyfill/lib/WebSocket.js:72:30)
Feb 17 14:27:38 106310-h-box node[149621]:     at trySend (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:427:10)
Feb 17 14:27:38 106310-h-box node[149621]:     at Object.unsub (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:454:9)
Feb 17 14:27:38 106310-h-box node[149621]:     at /home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:627:35
Feb 17 14:27:38 106310-h-box node[149621]:     at Array.forEach (<anonymous>)
Feb 17 14:27:38 106310-h-box node[149621]:     at Object.unsub (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/nostr-tools/lib/nostr.cjs.js:627:14)
Feb 17 14:27:38 106310-h-box node[149621]:     at WebSocket.<anonymous> (/home/nproxy/nostr-proxy/app/Services/NostrSocket.ts:92:62)
Feb 17 14:27:38 106310-h-box node[149621]:     at WebSocket.emit (events.js:400:28)
Feb 17 14:27:38 106310-h-box node[149621]:     at Receiver.receiverOnMessage (/home/nproxy/nostr-proxy/build/node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:1180:20)
Feb 17 14:27:38 106310-h-box node[149621]:     at Receiver.emit (events.js:400:28)

Build fails, tries to load local npm lib

Followed readme instructions and everything built but this:

npm install
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "link:": link:@noble/hashes/sha256
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rabble/.npm/_logs/2023-03-01T21_22_05_923Z-debug-0.log
pnpm install
Lockfile is up to date, resolution step is skipped
Already up to date
 > WARN  Local dependency not found at /Users/rabble/code/experiments/nostr-proxy/@noble/hashes/sha256
Done in 1.1s

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.