这是一个用打字稿写的鼻接力。
此实现已做好生产准备。有关支持的功能,请参阅下文。
项目主存储库可在 GitHub 上找到。
此处列出了具有中继特定实现的NIP。
created_at
警告:来自 Snap、Brew 或 Debian 仓库的 Docker 发行版不受支持,并且会导致错误。仅从他们的官方指南中安装 Docker。
按照官方指南安装 Docker 桌面。如果你使用其他指南安装了 Docker,则可能需要在计算机上卸载它。
克隆存储库并输入目录:
git clone git@github.com:Cameri/nostream.git cd nostream
开始:
./scripts/start_local
这将在终端的前台运行,直到你使用 Ctrl+C 停止它。
按照官方指南安装 Docker。如果你使用其他指南安装 Docker,则可能需要卸载它。
克隆存储库并输入目录:
git clone git@github.com:Cameri/nostream.git cd nostream
开始:
./scripts/start
或
./scripts/start_with_tor
通过以下方式停止服务器:
./scripts/stop
打印 Tor 主机名:
./scripts/print_tor_hostname
默认情况下,此服务器将连续运行,直到你使用 Ctrl+C 停止它或直到系统重新启动。
如果希望服务器在系统重新启动时自动再次运行,则可以作为 systemd 服务进行安装。例如:
$ nano /etc/systemd/system/nostream.service # Note: replace "User=..." with your username, and # "/home/nostr/nostream" with the directory where you cloned the repo. [Unit] Description=Nostr TS Relay After=network.target StartLimitIntervalSec=0 [Service] Type=simple Restart=always RestartSec=5 User=nostr WorkingDirectory=/home/nostr/nostream ExecStart=/home/nostr/nostream/scripts/start ExecStop=/home/nostr/nostream/scripts/stop [Install] WantedBy=multi-user.target
然后:
systemctl enable nostream systemctl start nostream
可以通过以下方式查看日志:
journalctl -u nostream
设置以下环境变量:
DB_URI="postgresql://postgres:postgres@localhost:5432/nostr_ts_relay_test" or DB_HOST=localhost DB_PORT=5432 DB_NAME=nostr_ts_relay DB_USER=postgres DB_PASSWORD=postgres REDIS_URI="redis://default:nostr_ts_relay@localhost:6379" REDIS_HOST=localhost REDIS_PORT=6379 REDIS_USER=default REDIS_PASSWORD=nostr_ts_relay
创建数据库:
nostr_ts_relay
$ psql -h $DB_HOST -p $DB_PORT -U $DB_USER -W postgres=# create database nostr_ts_relay; postgres=# quit
启动 Redis 并用于设置默认密码并验证:
redis-cli
$ redis-cli 127.0.0.1:6379> CONFIG SET requirepass "nostr_ts_relay" OK 127.0.0.1:6379> AUTH nostr_ts_relay Ok
克隆存储库并输入目录:
git clone git@github.com:Cameri/nostream.git cd nostream
安装依赖项:
npm install -g knex npm install
运行迁移(至少一次并在拉取新更改后):
npm run db:migrate
在 nostream 项目文件夹中创建 .nostr 文件夹:
mkdir .nostr
要在开发模式下启动:
npm run dev
或者,在生产模式下启动:
npm run start
若要清理生成、覆盖率和测试报告,请运行:
npm run clean
打开终端并切换到项目的目录:
cd /path/to/nostream
使用以下命令运行单元测试:
npm run test:unit
或者,在监视模式下运行单元测试:
npm run test:unit:watch
若要运行单元测试覆盖率,请执行以下操作:
npm run cover:unit
若要查看使用浏览器打开的单元测试报告,请执行以下操作:
.test-reports/unit/index.html
open .test-reports/unit/index.html
若要查看使用浏览器打开的单元测试覆盖率报告,请执行以下操作:
.coverage/unit/lcov-report/index.html
open .coverage/unit/lcov-report/index.html
打开终端并切换到项目的目录:
cd /path/to/nostream
使用以下命令运行集成测试:
npm run docker:test:integration
要运行集成测试覆盖率,请执行以下操作:
npm run docker:cover:integration
打开终端并切换到项目的目录:
cd /path/to/nostream
设置以下环境变量:
DB_URI="postgresql://postgres:postgres@localhost:5432/nostr_ts_relay_test" or DB_HOST=localhost DB_PORT=5432 DB_NAME=nostr_ts_relay_test DB_USER=postgres DB_PASSWORD=postgres DB_MIN_POOL_SIZE=1 DB_MAX_POOL_SIZE=2
然后运行集成测试:
npm run test:integration
若要查看使用浏览器打开的集成测试报告,请执行以下操作:
.test-reports/integration/report.html
open .test-reports/integration/report.html
要运行集成测试覆盖率,请执行以下操作:
npm run cover:integration
查看集成测试覆盖率报告,请使用浏览器打开。
.coverage/integration/lcov-report/index.html
open .coverage/integration/lcov-report/index.html
你可以通过将环境变量设置为其他路径来更改默认文件夹。
NOSTR_CONFIG_DIR
至少使用其中一个快速入门指南运行 nostream 一次,然后创建。对设置文件所做的任何更改都将在下次启动时读取。
nostream/.nostr/settings.json
默认设置可在 下找到。如果你想在先运行中继之前拥有一个设置文件,请随意将其复制到。
resources/default-settings.yaml
nostream/.nostr/settings.yaml
有关每个环境变量和设置的详细说明,请参阅 CONFIGURATION.md。
对于开发讨论,请使用 Nostr Typescript 中继开发组。
有关协议的讨论,请随时使用Nostr电报组。
我是大多数社交网络上的卡梅里。你可以在 Nostr 上找到我 通过 npub1qqqqqyz0la2jjl752yv8h7wgs3v098mh9nztd4nr6gynaef6uqqt0n47m.
该项目已获得 MIT 许可。