刚开源了 可以参考一下

https://github.com/haorendashu/cfrelay

Reply to this note

Please Login to reply.

Discussion

赞啊,晚上空了部署试试看🫰

😅 部署了 也没什么体验上的变化

你只会得到这句话:

Run your relay and own your datas.

这句话很重要 [Doge] 我写了个电脑上运行的中继应用,可以备份自己的事件,也可以作为 nostrudel 的缓存中继,有兴趣可以试试看🤗

https://github.com/CodyTseng/nostr-relay-tray

我等各位大佬更新以及我看看研究一下cloudflare worker怎么用。

这是啥错误?

~/cfrelay$ npm run deploy

> cfrelay@0.0.0 deploy

> wrangler deploy

⛅️ wrangler 3.51.0

-------------------

✘ [ERROR] Could not resolve "@noble/hashes/utils"

src/index.js:10:25:

10 │ import {bytesToHex} from '@noble/hashes/utils'

╵ ~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@noble/hashes/utils" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Could not resolve "@noble/hashes/sha256"

src/index.js:11:23:

11 │ import { sha256 } from '@noble/hashes/sha256'

╵ ~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@noble/hashes/sha256" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Could not resolve "@noble/curves/secp256k1"

src/index.js:12:24:

12 │ import { schnorr } from '@noble/curves/secp256k1'

╵ ~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@noble/curves/secp256k1" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Build failed with 3 errors:

src/index.js:10:25: ERROR: Could not resolve "@noble/hashes/utils"

src/index.js:11:23: ERROR: Could not resolve "@noble/hashes/sha256"

src/index.js:12:24: ERROR: Could not resolve "@noble/curves/secp256k1"

也许需要先跑一个 npm install 命令

npm install @noble/hashes @noble/curves

这样就ok了,多谢。

wss://relay.bostr.online/

再问下dashu, index.js 里面配置那个owner pubkey 有啥用呢?是会现在relay私有吗?我想部署一个公开中继。

这个是公钥来的,原始数据,没有 nip19 格式化就是这个样子。

限制了只有 owner 才能写数据,因为 cf 的服务是配额是有限的,所以一开始就定位个人使用,一个人使用应该勉强够用。如果想有多个人可写,只能手动加到后面去。

我的数据较少,读的人也不多,所以还配额还剩不少。

多谢啦,很赞的项目👍

发现一个小问题,这个项目部署的中继,在 nostrmo 和 amethyst 上都能正常使用,在freefrom里就不行,一直显示连接不上,并且发出去的帖子在D1数据库里也没有看到有记录,我在amethyst里广播一次就有了。。。

不知道是哪里的问题😅

观察了下, nostrmo 这边偶尔也会发送不到 cfrelay 上😇

收到