refactor: move project under backend

这个提交包含在:
cryptocommuniums-afk
2026-02-02 10:12:26 +08:00
父节点 810d0420d6
当前提交 616f9bd8c6
修改 27 个文件,包含 35 行新增16 行删除

3
backend/.gitignore vendored 普通文件
查看文件

@@ -0,0 +1,3 @@
app/node_modules/
app/data/
*.log

93
backend/README.md 普通文件
查看文件

@@ -0,0 +1,93 @@
# Capay 一站式加密货币支付平台(自托管模板)
本仓库提供:
- 统一商户开通(简单 Merchant API
- x402 FacilitatorEVM/Solana配置模板
- BTCPay / Keagate 对接占位
- Webhook 聚合 `/payments/webhook`
- 低开销交易跟踪(免费套餐默认低频轮询)
- Nginx 反向代理与 HTTPSLet's Encrypt示例
## 目录结构
```
app/ # 统一业务 API
infra/nginx/sites-enabled/ # Nginx 配置
infra/docker/ # BTCPay/Keagate 占位
x402/facilitator/ # x402 配置模板
```
## 快速开始App
```bash
cd app
npm install
npm run dev
```
服务默认监听 `:3001`(可在 `app/.env` 修改)。
通过域名访问时统一前缀为:`https://capay.hao.work/backend`
### 免费套餐低频监控
`app/.env` 中已设置:
- `TX_POLL_INTERVAL_MS=180000`3 分钟)
- `MAX_TX_CHECK_PER_CYCLE=20`
- `MIN_CONFIRMATIONS=1`
交易跟踪采用“待确认 tx 列表 + 轮询 receipt”的低开销方式。
支持多个 Alchemy 免费 key使用 `ALCHEMY_API_KEYS=key1,key2`,系统会按轮询周期进行轮转调用,降低单 key 的频率。
## API 说明(简化版)
域名访问时请在路径前加 `/backend` 前缀(例如:`/backend/payments/orders`)。
### 1) 开通商户
`POST /merchants`
```json
{ "name": "Acme", "email": "ops@acme.com", "webhookUrl": "https://merchant.example.com/webhook" }
```
返回:`merchantId``apiKey``webhookSecret`
### 2) 创建订单
`POST /payments/orders`
Headers: `x-merchant-id`, `x-api-key`
```json
{ "amount": "9.99", "currency": "USD", "network": "evm:ethereum", "asset": "USDC", "description": "API Access" }
```
返回:订单信息与 `paymentRequirementsBase64`
### 3) 追踪链上交易(低开销)
`POST /payments/track`
Headers: `x-merchant-id`, `x-api-key`
```json
{ "orderId": "ORD123", "txHash": "0x...", "network": "evm:ethereum" }
```
Bitcoin 示例:
```json
{ "orderId": "ORD123", "txHash": "btc_txid", "network": "btc:mainnet" }
```
### 4) Webhook 聚合入口
`POST /payments/webhook`
- `X-Source: keagate | btcpay | x402`
- Keagate 校验:`x-keagate-sig`sha512 HMAC
- BTCPay 校验:`btcpay-sig`sha256 HMAC
- x402 校验:`x402-sig`sha256 HMAC
## Nginx + HTTPS免费
配置在:`infra/nginx/sites-enabled/capay.conf`
证书建议使用 certbotLet’s Encrypt
```bash
apt-get update && apt-get install -y certbot python3-certbot-nginx
certbot --nginx -d capay.hao.work -d pay.capay.hao.work -d btc.capay.hao.work
```
## x402 Facilitator
配置文件在:`x402/facilitator/`,已绑定 `pay.capay.hao.work`,并写入 Alchemy ETH RPC。
## Bitcoin 节点Alchemy
默认使用 `ALCHEMY_BTC_API_KEY(S)``BTC_RPC_URL(S)` 来访问 Bitcoin 主网 RPC。
`/payments/track``network` 统一使用 `btc:mainnet`
## 生产建议
-`.env` 中的密钥替换为强随机值
- 生产环境建议使用数据库PostgreSQL/MySQL替换本地 JSON
- 重要订单建议提高 `MIN_CONFIRMATIONS`
- Webhook 需做好幂等与重试

32
backend/app/.env 普通文件
查看文件

@@ -0,0 +1,32 @@
APP_PORT=3001
APP_HOST=https://capay.hao.work/backend
PLAN=free
ADMIN_API_KEY=whoami139
# Low-cost polling for free plan
TX_POLL_INTERVAL_MS=180000
MAX_TX_CHECK_PER_CYCLE=20
MIN_CONFIRMATIONS=1
# Alchemy Ethereum RPC (supports multiple free keys)
ALCHEMY_API_KEYS=P9kZiHB6Q7CLrBlMsUN3n
ALCHEMY_API_KEY=P9kZiHB6Q7CLrBlMsUN3n
ETHEREUM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n
# Optional: comma-separated RPC URLs (overrides/extends)
# ETHEREUM_RPC_URLS=https://eth-mainnet.g.alchemy.com/v2/KEY1,https://eth-mainnet.g.alchemy.com/v2/KEY2
# Bitcoin RPC via Alchemy (optional)
ALCHEMY_BTC_API_KEYS=P9kZiHB6Q7CLrBlMsUN3n
ALCHEMY_BTC_API_KEY=P9kZiHB6Q7CLrBlMsUN3n
# Optional: full RPC URL with auth (overrides/extends)
# BTC_RPC_URL=https://alchemy:YOUR_KEY@bitcoin-mainnet.g.alchemy.com/v2/YOUR_KEY
# BTC_RPC_URLS=https://alchemy:KEY1@bitcoin-mainnet.g.alchemy.com/v2/KEY1,https://alchemy:KEY2@bitcoin-mainnet.g.alchemy.com/v2/KEY2
# Webhook signature secrets (replace in production)
IPN_HMAC_SECRET=replace-with-strong-secret
BTCPAY_WEBHOOK_SECRET=replace-with-strong-secret
X402_WEBHOOK_SECRET=replace-with-strong-secret
# Payment platform
DB_PATH=./data/db.json
WEBHOOK_TIMEOUT_MS=8000

966
backend/app/package-lock.json 自动生成的 普通文件
查看文件

@@ -0,0 +1,966 @@
{
"name": "capay-app",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "capay-app",
"version": "0.1.0",
"dependencies": {
"dotenv": "^16.4.5",
"ethers": "^6.12.1",
"express": "^4.19.2",
"nanoid": "^5.0.7"
}
},
"node_modules/@adraffy/ens-normalize": {
"version": "1.10.1",
"resolved": "https://registry.npmmirror.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz",
"integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==",
"license": "MIT"
},
"node_modules/@noble/curves": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/@noble/curves/-/curves-1.2.0.tgz",
"integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
"license": "MIT",
"dependencies": {
"@noble/hashes": "1.3.2"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@noble/hashes": {
"version": "1.3.2",
"resolved": "https://registry.npmmirror.com/@noble/hashes/-/hashes-1.3.2.tgz",
"integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
"license": "MIT",
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@types/node": {
"version": "22.7.5",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.7.5.tgz",
"integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"license": "MIT",
"dependencies": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/aes-js": {
"version": "4.0.0-beta.5",
"resolved": "https://registry.npmmirror.com/aes-js/-/aes-js-4.0.0-beta.5.tgz",
"integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==",
"license": "MIT"
},
"node_modules/array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
"license": "MIT"
},
"node_modules/body-parser": {
"version": "1.20.4",
"resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-1.20.4.tgz",
"integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==",
"license": "MIT",
"dependencies": {
"bytes": "~3.1.2",
"content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "~1.2.0",
"http-errors": "~2.0.1",
"iconv-lite": "~0.4.24",
"on-finished": "~2.4.1",
"qs": "~6.14.0",
"raw-body": "~2.5.3",
"type-is": "~1.6.18",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/call-bound": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz",
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"get-intrinsic": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmmirror.com/content-disposition/-/content-disposition-0.5.4.tgz",
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "5.2.1"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmmirror.com/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.7.2",
"resolved": "https://registry.npmmirror.com/cookie/-/cookie-0.7.2.tgz",
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.0.7",
"resolved": "https://registry.npmmirror.com/cookie-signature/-/cookie-signature-1.0.7.tgz",
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
"license": "MIT"
},
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"license": "MIT",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/destroy": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
"license": "MIT",
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/dotenv": {
"version": "16.6.1",
"resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-16.6.1.tgz",
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
"license": "MIT"
},
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmmirror.com/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ethers": {
"version": "6.16.0",
"resolved": "https://registry.npmmirror.com/ethers/-/ethers-6.16.0.tgz",
"integrity": "sha512-U1wulmetNymijEhpSEQ7Ct/P/Jw9/e7R1j5XIbPRydgV2DjLVMsULDlNksq3RQnFgKoLlZf88ijYtWEXcPa07A==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/ethers-io/"
},
{
"type": "individual",
"url": "https://www.buymeacoffee.com/ricmoo"
}
],
"license": "MIT",
"dependencies": {
"@adraffy/ens-normalize": "1.10.1",
"@noble/curves": "1.2.0",
"@noble/hashes": "1.3.2",
"@types/node": "22.7.5",
"aes-js": "4.0.0-beta.5",
"tslib": "2.7.0",
"ws": "8.17.1"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/express": {
"version": "4.22.1",
"resolved": "https://registry.npmmirror.com/express/-/express-4.22.1.tgz",
"integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "~1.20.3",
"content-disposition": "~0.5.4",
"content-type": "~1.0.4",
"cookie": "~0.7.1",
"cookie-signature": "~1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.3.1",
"fresh": "~0.5.2",
"http-errors": "~2.0.0",
"merge-descriptors": "1.0.3",
"methods": "~1.1.2",
"on-finished": "~2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "~0.1.12",
"proxy-addr": "~2.0.7",
"qs": "~6.14.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "~0.19.0",
"serve-static": "~1.16.2",
"setprototypeof": "1.2.0",
"statuses": "~2.0.1",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/finalhandler": {
"version": "1.3.2",
"resolved": "https://registry.npmmirror.com/finalhandler/-/finalhandler-1.3.2.tgz",
"integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"on-finished": "~2.4.1",
"parseurl": "~1.3.3",
"statuses": "~2.0.2",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmmirror.com/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
"license": "MIT",
"dependencies": {
"depd": "~2.0.0",
"inherits": "~2.0.4",
"setprototypeof": "~1.2.0",
"statuses": "~2.0.2",
"toidentifier": "~1.0.1"
},
"engines": {
"node": ">= 0.8"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"license": "MIT",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmmirror.com/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/merge-descriptors": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/methods": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/methods/-/methods-1.1.2.tgz",
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"license": "MIT",
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"license": "MIT"
},
"node_modules/nanoid": {
"version": "5.1.6",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-5.1.6.tgz",
"integrity": "sha512-c7+7RQ+dMB5dPwwCp4ee1/iV/q2P6aK1mTZcfr1BTuVlyW9hJYiMPybJCcnBlQtuSmTIWNeazm/zqNoZSSElBg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"bin": {
"nanoid": "bin/nanoid.js"
},
"engines": {
"node": "^18 || >=20"
}
},
"node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmmirror.com/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"license": "MIT",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmmirror.com/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "0.1.12",
"resolved": "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
"license": "MIT"
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmmirror.com/proxy-addr/-/proxy-addr-2.0.7.tgz",
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
"license": "MIT",
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.14.1",
"resolved": "https://registry.npmmirror.com/qs/-/qs-6.14.1.tgz",
"integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==",
"license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.1.0"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "2.5.3",
"resolved": "https://registry.npmmirror.com/raw-body/-/raw-body-2.5.3.tgz",
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
"license": "MIT",
"dependencies": {
"bytes": "~3.1.2",
"http-errors": "~2.0.1",
"iconv-lite": "~0.4.24",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT"
},
"node_modules/send": {
"version": "0.19.2",
"resolved": "https://registry.npmmirror.com/send/-/send-0.19.2.tgz",
"integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "~0.5.2",
"http-errors": "~2.0.1",
"mime": "1.6.0",
"ms": "2.1.3",
"on-finished": "~2.4.1",
"range-parser": "~1.2.1",
"statuses": "~2.0.2"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/serve-static": {
"version": "1.16.3",
"resolved": "https://registry.npmmirror.com/serve-static/-/serve-static-1.16.3.tgz",
"integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
"license": "MIT",
"dependencies": {
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "~0.19.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"license": "ISC"
},
"node_modules/side-channel": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz",
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3",
"side-channel-list": "^1.0.0",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-list": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/side-channel-list/-/side-channel-list-1.0.0.tgz",
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-map": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/side-channel-map/-/side-channel-map-1.0.1.tgz",
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-weakmap": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3",
"side-channel-map": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.2.tgz",
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"license": "MIT",
"engines": {
"node": ">=0.6"
}
},
"node_modules/tslib": {
"version": "2.7.0",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.7.0.tgz",
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==",
"license": "0BSD"
},
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmmirror.com/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"license": "MIT",
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/undici-types": {
"version": "6.19.8",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"license": "MIT"
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
"license": "MIT",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/ws": {
"version": "8.17.1",
"resolved": "https://registry.npmmirror.com/ws/-/ws-8.17.1.tgz",
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
}
}
}

16
backend/app/package.json 普通文件
查看文件

@@ -0,0 +1,16 @@
{
"name": "capay-app",
"version": "0.1.0",
"private": true,
"main": "src/server.js",
"scripts": {
"dev": "node src/server.js",
"start": "node src/server.js"
},
"dependencies": {
"dotenv": "^16.4.5",
"express": "^4.19.2",
"ethers": "^6.12.1",
"nanoid": "^5.0.7"
}
}

查看文件

@@ -0,0 +1,228 @@
const adminKeyInput = document.getElementById('admin-key');
const loginForm = document.getElementById('login-form');
const loginError = document.getElementById('login-error');
const loginSection = document.getElementById('login-section');
const appSection = document.getElementById('app-section');
const statusText = document.getElementById('status-text');
const statusPill = document.getElementById('status-pill');
const logoutButton = document.getElementById('logout');
const clearKeyButton = document.getElementById('clear-key');
const refreshButton = document.getElementById('refresh-merchants');
const merchantRows = document.getElementById('merchant-rows');
const merchantEmpty = document.getElementById('merchant-empty');
const merchantForm = document.getElementById('merchant-form');
const merchantResult = document.getElementById('merchant-result');
const tabs = document.querySelectorAll('.tabs button');
const panels = document.querySelectorAll('.tab-panel');
const curlCreateMerchant = document.getElementById('curl-create-merchant');
const curlCreateOrder = document.getElementById('curl-create-order');
const curlTrackTx = document.getElementById('curl-track-tx');
const webhookTip = document.getElementById('webhook-tip');
const STORAGE_KEY = 'capay_admin_key';
const basePath = window.location.pathname.replace(/\/[^/]*$/, '/').replace(/\/+$/, '');
const apiBase = basePath || '';
const baseUrl = `${window.location.origin}${apiBase}`;
function setStatus(text, ok) {
statusText.textContent = text;
statusPill.textContent = ok ? '已连接' : '未连接';
statusPill.style.borderColor = ok ? 'rgba(52, 211, 153, 0.6)' : 'rgba(248, 113, 113, 0.6)';
statusPill.style.color = ok ? '#34d399' : '#f87171';
}
function showLoginError(message) {
loginError.textContent = message;
loginError.classList.toggle('hidden', !message);
}
function getAdminKey() {
return localStorage.getItem(STORAGE_KEY) || '';
}
function setAdminKey(value) {
localStorage.setItem(STORAGE_KEY, value);
}
function withBase(path) {
if (!apiBase) return path;
return `${apiBase}${path}`;
}
async function request(path, options = {}) {
const headers = options.headers ? { ...options.headers } : {};
const adminKey = getAdminKey();
if (adminKey) {
headers['x-admin-key'] = adminKey;
}
const res = await fetch(withBase(path), { ...options, headers });
if (!res.ok) {
const text = await res.text();
let message = text;
try {
message = JSON.parse(text).error || text;
} catch (error) {
// ignore
}
throw new Error(message || `request failed (${res.status})`);
}
const text = await res.text();
return text ? JSON.parse(text) : null;
}
async function loadHealth() {
try {
const health = await request('/health', { headers: {} });
setStatus(`服务正常 · 计划 ${health.plan}`, true);
} catch (error) {
setStatus('无法连接服务', false);
}
}
function renderMerchants(merchants) {
merchantRows.innerHTML = '';
if (!merchants || merchants.length === 0) {
merchantEmpty.classList.remove('hidden');
return;
}
merchantEmpty.classList.add('hidden');
merchants.forEach((merchant) => {
const row = document.createElement('tr');
const apiKey = merchant.apiKey || '-';
const webhookSecret = merchant.webhookSecret || '-';
row.innerHTML = `
<td>${merchant.id}</td>
<td>${merchant.name}</td>
<td>${merchant.email}</td>
<td>${merchant.webhookUrl || '-'}</td>
<td><span class="chip" data-value="${apiKey}">${apiKey}</span></td>
<td><span class="chip" data-value="${webhookSecret}">${webhookSecret}</span></td>
<td>${merchant.createdAt || '-'}</td>
`;
row.querySelectorAll('.chip').forEach((chip) => {
const btn = document.createElement('button');
btn.type = 'button';
btn.textContent = '复制';
btn.className = 'ghost copy-btn';
btn.addEventListener('click', () => {
navigator.clipboard.writeText(chip.dataset.value || '');
btn.textContent = '已复制';
setTimeout(() => (btn.textContent = '复制'), 1200);
});
chip.appendChild(btn);
});
merchantRows.appendChild(row);
});
}
async function loadMerchants() {
try {
const data = await request('/admin/merchants');
renderMerchants(data.merchants || []);
} catch (error) {
renderMerchants([]);
showLoginError(error.message);
}
}
function updateGuide() {
const adminKey = getAdminKey() || '<ADMIN_API_KEY>';
curlCreateMerchant.textContent = `curl -X POST ${baseUrl}/admin/merchants \\\n -H \"Content-Type: application/json\" \\\n -H \"X-Admin-Key: ${adminKey}\" \\\n -d '{\"name\":\"Acme\",\"email\":\"ops@acme.com\",\"webhookUrl\":\"https://merchant.example.com/webhook\"}'`;
curlCreateOrder.textContent = `curl -X POST ${baseUrl}/payments/orders \\\n -H \"Content-Type: application/json\" \\\n -H \"x-merchant-id: <merchantId>\" \\\n -H \"x-api-key: <apiKey>\" \\\n -d '{\"amount\":\"9.99\",\"currency\":\"USD\",\"network\":\"evm:ethereum\",\"asset\":\"USDC\",\"description\":\"API Access\"}'`;
curlTrackTx.textContent = `curl -X POST ${baseUrl}/payments/track \\\n -H \"Content-Type: application/json\" \\\n -H \"x-merchant-id: <merchantId>\" \\\n -H \"x-api-key: <apiKey>\" \\\n -d '{\"orderId\":\"<orderId>\",\"txHash\":\"<txHash>\",\"network\":\"btc:mainnet\"}'`;
webhookTip.textContent = `Webhook 入口: ${baseUrl}/payments/webhook\n签名头:\n- Keagate: x-keagate-sig (sha512 HMAC)\n- BTCPay: btcpay-sig (sha256 HMAC)\n- x402: x402-sig (sha256 HMAC)\n商户侧使用 webhookSecret 验签后处理。`;
}
function showApp() {
loginSection.classList.add('hidden');
appSection.classList.remove('hidden');
showLoginError('');
updateGuide();
loadHealth();
loadMerchants();
}
function showLogin() {
loginSection.classList.remove('hidden');
appSection.classList.add('hidden');
}
loginForm.addEventListener('submit', async (event) => {
event.preventDefault();
const key = adminKeyInput.value.trim();
if (!key) {
showLoginError('请输入管理员密钥');
return;
}
setAdminKey(key);
try {
await request('/admin/merchants');
showApp();
} catch (error) {
showLoginError(error.message || '登录失败');
}
});
clearKeyButton.addEventListener('click', () => {
localStorage.removeItem(STORAGE_KEY);
adminKeyInput.value = '';
showLoginError('');
});
logoutButton.addEventListener('click', () => {
localStorage.removeItem(STORAGE_KEY);
adminKeyInput.value = '';
showLogin();
});
refreshButton.addEventListener('click', () => {
loadMerchants();
});
merchantForm.addEventListener('submit', async (event) => {
event.preventDefault();
merchantResult.classList.add('hidden');
const name = document.getElementById('merchant-name').value.trim();
const email = document.getElementById('merchant-email').value.trim();
const webhookUrl = document.getElementById('merchant-webhook').value.trim();
try {
const result = await request('/admin/merchants', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, email, webhookUrl: webhookUrl || null })
});
merchantResult.textContent = `创建成功merchantId=${result.merchantId}`;
merchantResult.classList.remove('hidden');
merchantForm.reset();
await loadMerchants();
} catch (error) {
merchantResult.textContent = `创建失败:${error.message}`;
merchantResult.classList.remove('hidden');
}
});
tabs.forEach((tab) => {
tab.addEventListener('click', () => {
tabs.forEach((item) => item.classList.remove('active'));
tab.classList.add('active');
const target = tab.dataset.tab;
panels.forEach((panel) => {
panel.classList.toggle('hidden', panel.id !== `tab-${target}`);
});
});
});
(function init() {
const key = getAdminKey();
if (key) {
adminKeyInput.value = key;
showApp();
} else {
showLogin();
}
loadHealth();
})();

查看文件

@@ -0,0 +1,62 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Capay API Docs</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" />
<link rel="stylesheet" href="../styles.css" />
<style>
.docs-header {
max-width: 1180px;
margin: 24px auto 0;
padding: 0 24px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.docs-header a {
text-decoration: none;
}
.swagger-ui .topbar {
display: none;
}
.swagger-ui {
max-width: 1180px;
margin: 12px auto 60px;
padding: 0 12px;
}
.swagger-ui .info .title {
font-family: "Fraunces", "Times New Roman", serif;
}
.swagger-ui .opblock-tag {
color: #e2e8f0;
}
</style>
</head>
<body>
<div class="docs-header">
<div>
<h2>Capay API Docs</h2>
<p class="muted">Swagger-style documentation with live requests.</p>
</div>
<a class="pill link" href="../">Back to Admin</a>
</div>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js"></script>
<script>
window.onload = function () {
window.ui = SwaggerUIBundle({
url: "../openapi.json",
dom_id: "#swagger-ui",
deepLinking: true,
presets: [SwaggerUIBundle.presets.apis],
layout: "BaseLayout"
});
};
</script>
</body>
</html>

查看文件

@@ -0,0 +1,136 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Capay 管理后台</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="page">
<header class="hero">
<div>
<h1>Capay 管理后台</h1>
<p>商户管理 · REST 配置 · 接入指导</p>
</div>
<div class="hero-meta">
<span class="pill">API Admin</span>
<span class="pill" id="status-pill">未连接</span>
<a class="pill link" href="docs/">API Docs</a>
</div>
</header>
<section id="login-section" class="card">
<h2>管理员登录</h2>
<p class="muted">使用 ADMIN_API_KEY 进入管理后台默认whoami139</p>
<form id="login-form">
<label>
管理员密钥
<input id="admin-key" type="password" placeholder="X-Admin-Key" autocomplete="current-password" />
</label>
<div class="form-actions">
<button type="submit" class="primary">登录</button>
<button type="button" id="clear-key" class="ghost">清除</button>
</div>
<p id="login-error" class="error hidden"></p>
</form>
</section>
<section id="app-section" class="hidden">
<div class="toolbar">
<div class="toolbar-left">
<span id="status-text" class="muted">连接中...</span>
</div>
<div class="toolbar-right">
<button id="refresh-merchants" class="ghost">刷新商户</button>
<button id="logout" class="ghost">退出</button>
</div>
</div>
<nav class="tabs">
<button data-tab="merchants" class="active">商户列表</button>
<button data-tab="create">新增商户</button>
<button data-tab="guide">REST 管理配置与教程</button>
</nav>
<div id="tab-merchants" class="tab-panel card">
<h2>已接入商户</h2>
<p class="muted">支持多商户并行接入,复制 API Key / Secret 交付对应商户即可。</p>
<div id="merchant-table" class="table-wrap">
<table>
<thead>
<tr>
<th>ID</th>
<th>名称</th>
<th>邮箱</th>
<th>Webhook</th>
<th>API Key</th>
<th>Secret</th>
<th>创建时间</th>
</tr>
</thead>
<tbody id="merchant-rows"></tbody>
</table>
</div>
<p id="merchant-empty" class="muted hidden">暂无商户,请先新增。</p>
</div>
<div id="tab-create" class="tab-panel card hidden">
<h2>新增商户</h2>
<form id="merchant-form">
<div class="form-grid">
<label>
商户名称
<input id="merchant-name" type="text" required />
</label>
<label>
邮箱
<input id="merchant-email" type="email" required />
</label>
<label class="span-2">
Webhook URL可选
<input id="merchant-webhook" type="url" placeholder="https://merchant.example.com/webhook" />
</label>
</div>
<div class="form-actions">
<button type="submit" class="primary">创建商户</button>
<button type="reset" class="ghost">重置</button>
</div>
<p id="merchant-result" class="success hidden"></p>
</form>
</div>
<div id="tab-guide" class="tab-panel card hidden">
<h2>REST 管理配置与教程</h2>
<div class="guide">
<ol>
<li>使用管理员密钥创建商户,获取 merchantId / apiKey / webhookSecret。</li>
<li>将 apiKey 与 merchantId 提供给商户,用于创建订单与跟踪交易。</li>
<li>商户创建订单后,把链上 txHash 回传到 /payments/track 进行确认。</li>
<li>Webhook 由平台签名,商户侧自行验签并处理订单状态。</li>
</ol>
</div>
<h3>1. 创建商户(管理员)</h3>
<pre><code id="curl-create-merchant"></code></pre>
<h3>2. 创建订单(商户)</h3>
<pre><code id="curl-create-order"></code></pre>
<h3>3. 追踪链上交易</h3>
<pre><code id="curl-track-tx"></code></pre>
<h3>4. Webhook 验签提示</h3>
<pre><code id="webhook-tip"></code></pre>
<div class="callout">
<strong>多商户接入</strong>
<p>每个商户都会得到独立的 merchantId/apiKey/webhookSecret。重复创建即可支持不同商户并行接入。</p>
</div>
</div>
</section>
</div>
<script src="app.js"></script>
</body>
</html>

查看文件

@@ -0,0 +1,365 @@
{
"openapi": "3.0.3",
"info": {
"title": "Capay API",
"version": "0.1.0",
"description": "Capay merchant payment API with admin controls."
},
"servers": [
{
"url": "/backend"
}
],
"tags": [
{ "name": "Admin", "description": "Admin merchant management" },
{ "name": "Merchant", "description": "Merchant order & tracking APIs" },
{ "name": "Webhook", "description": "Unified webhook entry" }
],
"components": {
"securitySchemes": {
"adminKey": {
"type": "apiKey",
"in": "header",
"name": "X-Admin-Key"
},
"merchantId": {
"type": "apiKey",
"in": "header",
"name": "x-merchant-id"
},
"merchantApiKey": {
"type": "apiKey",
"in": "header",
"name": "x-api-key"
}
},
"schemas": {
"MerchantCreateRequest": {
"type": "object",
"required": ["name", "email"],
"properties": {
"name": { "type": "string" },
"email": { "type": "string", "format": "email" },
"webhookUrl": { "type": "string", "format": "uri", "nullable": true }
}
},
"MerchantCredentials": {
"type": "object",
"properties": {
"merchantId": { "type": "string" },
"apiKey": { "type": "string" },
"webhookSecret": { "type": "string" }
}
},
"MerchantPublic": {
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" },
"email": { "type": "string" },
"webhookUrl": { "type": "string", "nullable": true },
"createdAt": { "type": "string", "format": "date-time" }
}
},
"MerchantFull": {
"allOf": [
{ "$ref": "#/components/schemas/MerchantPublic" },
{
"type": "object",
"properties": {
"apiKey": { "type": "string" },
"webhookSecret": { "type": "string" }
}
}
]
},
"OrderRequest": {
"type": "object",
"required": ["amount", "currency", "network", "asset"],
"properties": {
"amount": { "type": "string" },
"currency": { "type": "string" },
"network": { "type": "string" },
"asset": { "type": "string" },
"description": { "type": "string", "nullable": true },
"lockWindowSeconds": { "type": "number" },
"slippage": { "type": "number" },
"orderId": { "type": "string" }
}
},
"TrackRequest": {
"type": "object",
"required": ["orderId", "txHash", "network"],
"properties": {
"orderId": { "type": "string" },
"txHash": { "type": "string" },
"network": { "type": "string" }
}
},
"Order": {
"type": "object",
"properties": {
"id": { "type": "string" },
"merchantId": { "type": "string" },
"amount": { "type": "string" },
"currency": { "type": "string" },
"network": { "type": "string" },
"asset": { "type": "string" },
"description": { "type": "string", "nullable": true },
"status": { "type": "string" },
"createdAt": { "type": "string", "format": "date-time" },
"updatedAt": { "type": "string", "format": "date-time" }
}
},
"TrackResponse": {
"type": "object",
"properties": {
"tracked": { "type": "boolean" },
"tx": {
"type": "object",
"properties": {
"id": { "type": "string" },
"orderId": { "type": "string" },
"network": { "type": "string" },
"txHash": { "type": "string" },
"status": { "type": "string" },
"confirmations": { "type": "number" },
"lastCheckedAt": { "type": "string", "format": "date-time", "nullable": true },
"createdAt": { "type": "string", "format": "date-time" },
"updatedAt": { "type": "string", "format": "date-time" }
}
}
}
}
}
},
"paths": {
"/health": {
"get": {
"summary": "Health check",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": { "type": "string" },
"plan": { "type": "string" }
}
}
}
}
}
}
}
},
"/merchants": {
"post": {
"tags": ["Admin"],
"summary": "Create merchant (admin)",
"security": [{ "adminKey": [] }],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/MerchantCreateRequest" }
}
}
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/MerchantCredentials" }
}
}
}
}
}
},
"/merchants/{id}": {
"get": {
"tags": ["Admin"],
"summary": "Get merchant public profile",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/MerchantPublic" }
}
}
}
}
}
},
"/admin/merchants": {
"get": {
"tags": ["Admin"],
"summary": "List merchants (admin)",
"security": [{ "adminKey": [] }],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"merchants": {
"type": "array",
"items": { "$ref": "#/components/schemas/MerchantFull" }
}
}
}
}
}
}
}
},
"post": {
"tags": ["Admin"],
"summary": "Create merchant (admin)",
"security": [{ "adminKey": [] }],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/MerchantCreateRequest" }
}
}
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/MerchantCredentials" }
}
}
}
}
}
},
"/payments/orders": {
"post": {
"tags": ["Merchant"],
"summary": "Create order",
"security": [{ "merchantId": [], "merchantApiKey": [] }],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/OrderRequest" }
}
}
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"order": { "$ref": "#/components/schemas/Order" },
"paymentRequirements": { "type": "object" },
"paymentRequirementsBase64": { "type": "string" }
}
}
}
}
}
}
}
},
"/payments/orders/{id}": {
"get": {
"tags": ["Merchant"],
"summary": "Get order",
"security": [{ "merchantId": [], "merchantApiKey": [] }],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Order" }
}
}
}
}
}
},
"/payments/track": {
"post": {
"tags": ["Merchant"],
"summary": "Track transaction",
"security": [{ "merchantId": [], "merchantApiKey": [] }],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/TrackRequest" }
}
}
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/TrackResponse" }
}
}
}
}
}
},
"/payments/webhook": {
"post": {
"tags": ["Webhook"],
"summary": "Unified webhook entry",
"parameters": [
{
"name": "X-Source",
"in": "header",
"required": true,
"schema": { "type": "string" }
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "type": "object" }
}
}
},
"responses": {
"200": {
"description": "OK"
}
}
}
}
}
}

查看文件

@@ -0,0 +1,292 @@
@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@500;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap");
:root {
color-scheme: dark;
--bg: #0b0f19;
--panel: #0f172a;
--panel-strong: #111d35;
--text: #e2e8f0;
--muted: #9aa4b2;
--accent: #38bdf8;
--accent-2: #f97316;
--stroke: rgba(148, 163, 184, 0.25);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
}
body::before {
content: "";
position: fixed;
inset: 0;
background:
radial-gradient(circle at 12% 20%, rgba(56, 189, 248, 0.2), transparent 45%),
radial-gradient(circle at 90% 10%, rgba(249, 115, 22, 0.16), transparent 38%),
linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(11, 15, 25, 0.98));
z-index: -2;
}
body::after {
content: "";
position: fixed;
inset: 0;
background-image:
linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
background-size: 28px 28px;
opacity: 0.35;
z-index: -1;
pointer-events: none;
}
.page {
max-width: 1180px;
margin: 0 auto;
padding: 36px 24px 90px;
display: grid;
gap: 24px;
}
.hero {
display: flex;
justify-content: space-between;
align-items: center;
gap: 24px;
padding: 28px;
border-radius: 22px;
background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(17, 29, 53, 0.95));
border: 1px solid rgba(56, 189, 248, 0.25);
box-shadow: 0 24px 60px rgba(2, 6, 23, 0.6);
}
.hero h1 {
margin: 0 0 8px;
font-family: "Fraunces", "Times New Roman", serif;
font-size: 30px;
letter-spacing: 0.6px;
}
.hero p {
margin: 0;
color: var(--muted);
}
.hero-meta {
display: flex;
gap: 12px;
flex-wrap: wrap;
align-items: center;
}
.pill {
padding: 6px 14px;
border-radius: 999px;
background: rgba(15, 23, 42, 0.7);
border: 1px solid var(--stroke);
font-size: 12px;
letter-spacing: 0.4px;
text-transform: uppercase;
color: var(--text);
}
.pill.link {
text-decoration: none;
border-color: rgba(56, 189, 248, 0.45);
color: var(--accent);
}
.card {
background: rgba(15, 23, 42, 0.95);
border: 1px solid var(--stroke);
border-radius: 20px;
padding: 26px;
box-shadow: 0 18px 50px rgba(2, 6, 23, 0.55);
backdrop-filter: blur(6px);
}
.muted {
color: var(--muted);
}
.hidden {
display: none !important;
}
form {
display: grid;
gap: 16px;
}
label {
display: grid;
gap: 8px;
font-size: 14px;
color: var(--muted);
}
input {
padding: 12px 14px;
border-radius: 12px;
border: 1px solid rgba(148, 163, 184, 0.35);
background: #0b1224;
color: var(--text);
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus {
outline: none;
border-color: rgba(56, 189, 248, 0.6);
box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
.form-actions {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
button {
border: none;
padding: 10px 18px;
border-radius: 12px;
cursor: pointer;
font-weight: 600;
font-family: "IBM Plex Sans", sans-serif;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
button:hover {
transform: translateY(-1px);
}
.primary {
background: linear-gradient(135deg, #38bdf8, #0ea5e9);
color: #03121f;
box-shadow: 0 14px 28px rgba(14, 165, 233, 0.25);
}
.ghost {
background: transparent;
color: var(--text);
border: 1px solid rgba(148, 163, 184, 0.4);
}
.error {
color: #fca5a5;
}
.success {
color: #6ee7b7;
}
.toolbar {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 18px;
gap: 12px;
}
.tabs {
display: flex;
gap: 12px;
margin-bottom: 18px;
flex-wrap: wrap;
}
.tabs button {
background: #0b1224;
border: 1px solid rgba(148, 163, 184, 0.3);
color: var(--text);
}
.tabs button.active {
border-color: rgba(56, 189, 248, 0.7);
color: var(--accent);
}
.tab-panel {
margin-bottom: 16px;
}
.table-wrap {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
th, td {
text-align: left;
padding: 12px 8px;
border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
tbody tr:hover {
background: rgba(56, 189, 248, 0.08);
}
th {
color: #cbd5f5;
font-weight: 600;
}
.chip {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
border-radius: 999px;
border: 1px solid rgba(148, 163, 184, 0.35);
font-size: 12px;
background: rgba(15, 23, 42, 0.6);
}
.copy-btn {
margin-left: 6px;
font-size: 11px;
padding: 4px 8px;
}
.form-grid {
display: grid;
gap: 16px;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.span-2 {
grid-column: span 2;
}
pre {
background: #0b1224;
padding: 16px;
border-radius: 14px;
border: 1px solid rgba(148, 163, 184, 0.2);
overflow-x: auto;
color: #cbd5f5;
}
.guide ol {
margin: 0 0 16px 20px;
}
.callout {
margin-top: 20px;
padding: 16px;
border-radius: 14px;
background: rgba(56, 189, 248, 0.08);
border: 1px solid rgba(56, 189, 248, 0.3);
}

333
backend/app/src/server.js 普通文件
查看文件

@@ -0,0 +1,333 @@
require('dotenv').config();
const crypto = require('crypto');
const express = require('express');
const { nanoid } = require('nanoid');
const path = require('path');
const { readDb, withDb } = require('./storage');
const { startEvmWatcher } = require('./watchers/evmWatcher');
const { startBtcWatcher } = require('./watchers/btcWatcher');
const app = express();
app.use(express.json({ limit: '1mb' }));
app.use(express.static(path.join(__dirname, 'public')));
const PLAN = process.env.PLAN || 'free';
const ADMIN_API_KEY = process.env.ADMIN_API_KEY || 'whoami139';
function nowIso() {
return new Date().toISOString();
}
function base64Json(data) {
return Buffer.from(JSON.stringify(data)).toString('base64');
}
function getHeader(req, name) {
const key = Object.keys(req.headers).find((header) => header.toLowerCase() === name.toLowerCase());
return key ? req.headers[key] : undefined;
}
async function requireMerchant(req, res) {
const merchantId = getHeader(req, 'x-merchant-id');
const apiKey = getHeader(req, 'x-api-key');
if (!merchantId || !apiKey) {
res.status(401).json({ error: 'missing merchant auth headers' });
return null;
}
const db = await readDb();
const merchant = db.merchants.find((item) => item.id === merchantId && item.apiKey === apiKey);
if (!merchant) {
res.status(403).json({ error: 'invalid merchant credentials' });
return null;
}
return merchant;
}
function requireAdmin(req, res) {
const adminKey = getHeader(req, 'x-admin-key');
if (!adminKey || adminKey !== ADMIN_API_KEY) {
res.status(403).json({ error: 'invalid admin key' });
return false;
}
return true;
}
async function logEvent(source, payload) {
await withDb((db) => {
db.events.push({
id: nanoid(),
source,
payload,
createdAt: nowIso()
});
});
}
async function notifyMerchant(order, tx) {
if (!order) return;
const db = await readDb();
const merchant = db.merchants.find((item) => item.id === order.merchantId);
if (!merchant || !merchant.webhookUrl) return;
const payload = {
type: 'payment.confirmed',
orderId: order.id,
txHash: tx.txHash,
network: tx.network,
amount: order.amount,
currency: order.currency,
asset: order.asset,
confirmedAt: nowIso()
};
const body = JSON.stringify(payload);
const signature = crypto.createHmac('sha256', merchant.webhookSecret).update(body).digest('hex');
const timeoutMs = Number(process.env.WEBHOOK_TIMEOUT_MS || 8000);
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), timeoutMs);
try {
await fetch(merchant.webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Capay-Signature': signature
},
body,
signal: controller.signal
});
} catch (error) {
console.warn('[webhook] failed to notify merchant', merchant.id, error.message);
} finally {
clearTimeout(timeout);
}
}
app.get('/health', (req, res) => {
res.json({ status: 'ok', plan: PLAN });
});
app.get('/', (req, res) => {
res.status(200).sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.get('/admin/merchants', async (req, res) => {
if (!requireAdmin(req, res)) return;
const db = await readDb();
res.json({ merchants: db.merchants });
});
app.post('/admin/merchants', async (req, res) => {
if (!requireAdmin(req, res)) return;
const { name, email, webhookUrl } = req.body || {};
if (!name || !email) {
return res.status(400).json({ error: 'name and email are required' });
}
const merchant = {
id: nanoid(),
name,
email,
webhookUrl: webhookUrl || null,
apiKey: nanoid(32),
webhookSecret: nanoid(32),
createdAt: nowIso()
};
await withDb((db) => {
db.merchants.push(merchant);
});
res.status(201).json({
merchantId: merchant.id,
apiKey: merchant.apiKey,
webhookSecret: merchant.webhookSecret
});
});
app.post('/merchants', async (req, res) => {
if (!requireAdmin(req, res)) return;
const { name, email, webhookUrl } = req.body || {};
if (!name || !email) {
return res.status(400).json({ error: 'name and email are required' });
}
const merchant = {
id: nanoid(),
name,
email,
webhookUrl: webhookUrl || null,
apiKey: nanoid(32),
webhookSecret: nanoid(32),
createdAt: nowIso()
};
await withDb((db) => {
db.merchants.push(merchant);
});
res.status(201).json({
merchantId: merchant.id,
apiKey: merchant.apiKey,
webhookSecret: merchant.webhookSecret
});
});
app.get('/merchants/:id', async (req, res) => {
const db = await readDb();
const merchant = db.merchants.find((item) => item.id === req.params.id);
if (!merchant) return res.status(404).json({ error: 'merchant not found' });
const safe = { ...merchant };
delete safe.apiKey;
delete safe.webhookSecret;
res.json(safe);
});
app.post('/payments/orders', async (req, res) => {
const merchant = await requireMerchant(req, res);
if (!merchant) return;
const { amount, currency, network, asset, description, lockWindowSeconds, slippage, orderId } = req.body || {};
if (!amount || !currency || !network || !asset) {
return res.status(400).json({ error: 'amount, currency, network, asset are required' });
}
const order = {
id: orderId || nanoid(),
merchantId: merchant.id,
amount: String(amount),
currency: String(currency),
network: String(network),
asset: String(asset),
description: description || null,
status: 'pending',
createdAt: nowIso(),
updatedAt: nowIso()
};
await withDb((db) => {
db.orders.push(order);
});
const paymentRequirements = {
requirements: [
{
kind: 'exact',
network: order.network,
asset: order.asset,
amount: order.amount,
currency: order.currency,
description: order.description || 'Capay order'
}
],
lockWindowSeconds: Number(lockWindowSeconds || 1200),
slippage: Number(slippage || 0.02),
orderId: order.id
};
const base64 = base64Json(paymentRequirements);
res.status(201).json({
order,
paymentRequirements,
paymentRequirementsBase64: base64
});
});
app.post('/payments/track', async (req, res) => {
const merchant = await requireMerchant(req, res);
if (!merchant) return;
const { orderId, txHash, network } = req.body || {};
if (!orderId || !txHash || !network) {
return res.status(400).json({ error: 'orderId, txHash, network are required' });
}
const txRecord = {
id: nanoid(),
orderId,
network,
txHash,
status: 'pending',
confirmations: 0,
lastCheckedAt: null,
createdAt: nowIso(),
updatedAt: nowIso()
};
await withDb((db) => {
db.txs.push(txRecord);
});
res.status(201).json({ tracked: true, tx: txRecord });
});
app.get('/payments/orders/:id', async (req, res) => {
const merchant = await requireMerchant(req, res);
if (!merchant) return;
const db = await readDb();
const order = db.orders.find((item) => item.id === req.params.id && item.merchantId === merchant.id);
if (!order) return res.status(404).json({ error: 'order not found' });
res.json(order);
});
app.post('/payments/webhook', async (req, res) => {
const source = (getHeader(req, 'x-source') || '').toLowerCase();
if (!source) {
return res.status(400).json({ error: 'missing X-Source header' });
}
if (source === 'keagate') {
const secret = process.env.IPN_HMAC_SECRET || '';
const sorted = JSON.stringify(req.body, Object.keys(req.body || {}).sort());
const hmac = crypto.createHmac('sha512', secret).update(sorted).digest('hex');
const sig = getHeader(req, 'x-keagate-sig');
if (!sig || sig !== hmac) {
return res.status(403).json({ error: 'invalid keagate signature' });
}
await logEvent('keagate', req.body);
} else if (source === 'btcpay') {
const secret = process.env.BTCPAY_WEBHOOK_SECRET || '';
const payload = JSON.stringify(req.body || {});
const expected = crypto.createHmac('sha256', secret).update(payload).digest('hex');
const sig = getHeader(req, 'btcpay-sig') || getHeader(req, 'btcpay-signature');
if (sig && sig !== expected) {
return res.status(403).json({ error: 'invalid btcpay signature' });
}
await logEvent('btcpay', req.body);
} else if (source === 'x402') {
const secret = process.env.X402_WEBHOOK_SECRET || '';
const payload = JSON.stringify(req.body || {});
const expected = crypto.createHmac('sha256', secret).update(payload).digest('hex');
const sig = getHeader(req, 'x402-sig');
if (sig && sig !== expected) {
return res.status(403).json({ error: 'invalid x402 signature' });
}
await logEvent('x402', req.body);
} else {
return res.status(400).json({ error: 'unknown source' });
}
const orderId = req.body?.orderId || req.body?.metadata?.orderId;
if (orderId) {
await withDb((db) => {
const order = db.orders.find((item) => item.id === orderId);
if (order) {
order.status = 'paid';
order.updatedAt = nowIso();
}
});
}
res.status(200).json({ received: true });
});
const port = Number(process.env.APP_PORT || 3000);
app.listen(port, () => {
console.log(`capay app listening on :${port}`);
startEvmWatcher({ notifyMerchant });
startBtcWatcher({ notifyMerchant });
});

56
backend/app/src/storage.js 普通文件
查看文件

@@ -0,0 +1,56 @@
const fs = require('fs/promises');
const path = require('path');
const DEFAULT_DB = {
merchants: [],
orders: [],
txs: [],
events: []
};
function resolveDbPath() {
const dbPath = process.env.DB_PATH || './data/db.json';
if (path.isAbsolute(dbPath)) return dbPath;
return path.join(process.cwd(), dbPath);
}
async function ensureDbFile() {
const dbPath = resolveDbPath();
await fs.mkdir(path.dirname(dbPath), { recursive: true });
try {
await fs.access(dbPath);
} catch (error) {
await fs.writeFile(dbPath, JSON.stringify(DEFAULT_DB, null, 2));
}
}
async function readDb() {
await ensureDbFile();
const dbPath = resolveDbPath();
const raw = await fs.readFile(dbPath, 'utf-8');
try {
return JSON.parse(raw);
} catch (error) {
return { ...DEFAULT_DB };
}
}
async function writeDb(db) {
const dbPath = resolveDbPath();
const tmpPath = `${dbPath}.tmp`;
await fs.writeFile(tmpPath, JSON.stringify(db, null, 2));
await fs.rename(tmpPath, dbPath);
}
async function withDb(mutator) {
const db = await readDb();
const result = await mutator(db);
await writeDb(db);
return result;
}
module.exports = {
readDb,
writeDb,
withDb
};

查看文件

@@ -0,0 +1,75 @@
function parseList(value) {
if (!value) return [];
return value
.split(',')
.map((item) => item.trim())
.filter(Boolean);
}
function buildAlchemyUrls(keys) {
return keys.map((key) => `https://eth-mainnet.g.alchemy.com/v2/${key}`);
}
function buildAlchemyBitcoinUrls(keys) {
return keys.map((key) => `https://alchemy:${key}@bitcoin-mainnet.g.alchemy.com/v2/${key}`);
}
function unique(items) {
return Array.from(new Set(items));
}
function getEthereumRpcUrls() {
const urls = [];
const explicitUrls = parseList(process.env.ETHEREUM_RPC_URLS);
urls.push(...explicitUrls);
if (process.env.ETHEREUM_RPC_URL) {
urls.push(process.env.ETHEREUM_RPC_URL);
}
const keyList = parseList(process.env.ALCHEMY_API_KEYS);
if (keyList.length > 0) {
urls.push(...buildAlchemyUrls(keyList));
} else if (process.env.ALCHEMY_API_KEY) {
urls.push(...buildAlchemyUrls([process.env.ALCHEMY_API_KEY]));
}
return unique(urls);
}
function getBitcoinRpcUrls() {
const urls = [];
const explicitUrls = parseList(process.env.BTC_RPC_URLS);
urls.push(...explicitUrls);
if (process.env.BTC_RPC_URL) {
urls.push(process.env.BTC_RPC_URL);
}
const keyList = parseList(process.env.ALCHEMY_BTC_API_KEYS);
if (keyList.length > 0) {
urls.push(...buildAlchemyBitcoinUrls(keyList));
} else if (process.env.ALCHEMY_BTC_API_KEY) {
urls.push(...buildAlchemyBitcoinUrls([process.env.ALCHEMY_BTC_API_KEY]));
}
return unique(urls);
}
function createRoundRobinPicker(items) {
let index = 0;
return function pick() {
if (!items.length) return null;
const item = items[index % items.length];
index = (index + 1) % items.length;
return item;
};
}
module.exports = {
getEthereumRpcUrls,
getBitcoinRpcUrls,
createRoundRobinPicker
};

查看文件

@@ -0,0 +1,103 @@
const { readDb, writeDb } = require('../storage');
const { getBitcoinRpcUrls, createRoundRobinPicker } = require('../utils/rpc');
const BTC_NETWORK = 'btc:mainnet';
async function callRpc(url, method, params = []) {
const body = JSON.stringify({
jsonrpc: '1.0',
id: 'capay',
method,
params
});
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body
});
if (!response.ok) {
throw new Error(`rpc ${method} failed (${response.status})`);
}
const payload = await response.json();
if (payload.error) {
const message = payload.error.message || JSON.stringify(payload.error);
throw new Error(`rpc ${method} error: ${message}`);
}
return payload.result;
}
function startBtcWatcher({ notifyMerchant }) {
const rpcUrls = getBitcoinRpcUrls();
if (!rpcUrls.length) {
console.warn('[btcWatcher] No Bitcoin RPC URLs configured. Skipping watcher.');
return;
}
const pollInterval = Number(process.env.TX_POLL_INTERVAL_MS || 180000);
const maxPerCycle = Number(process.env.MAX_TX_CHECK_PER_CYCLE || 20);
const minConfirmations = Number(process.env.MIN_CONFIRMATIONS || 1);
const pickRpcUrl = createRoundRobinPicker(rpcUrls);
let running = false;
async function poll() {
if (running) return;
running = true;
try {
const db = await readDb();
const pending = db.txs.filter((tx) => tx.network === BTC_NETWORK && tx.status === 'pending');
if (pending.length === 0) {
running = false;
return;
}
const rpcUrl = pickRpcUrl();
const now = new Date().toISOString();
const confirmedEvents = [];
for (const tx of pending.slice(0, maxPerCycle)) {
try {
const result = await callRpc(rpcUrl, 'getrawtransaction', [tx.txHash, true]);
const confirmations = Number(result?.confirmations || 0);
tx.confirmations = confirmations;
tx.lastCheckedAt = now;
tx.updatedAt = now;
if (confirmations >= minConfirmations) {
tx.status = 'confirmed';
const order = db.orders.find((item) => item.id === tx.orderId);
if (order) {
order.status = 'paid';
order.updatedAt = now;
confirmedEvents.push({ order, tx });
}
}
} catch (error) {
tx.lastCheckedAt = now;
console.warn('[btcWatcher] rpc error', tx.txHash, error.message);
}
}
await writeDb(db);
for (const event of confirmedEvents) {
await notifyMerchant(event.order, event.tx);
}
} catch (error) {
console.error('[btcWatcher] poll error', error.message);
} finally {
running = false;
}
}
poll();
setInterval(poll, pollInterval);
console.log(`[btcWatcher] started with interval ${pollInterval}ms`);
}
module.exports = { startBtcWatcher };

查看文件

@@ -0,0 +1,76 @@
const { JsonRpcProvider } = require('ethers');
const { readDb, writeDb } = require('../storage');
const { getEthereumRpcUrls, createRoundRobinPicker } = require('../utils/rpc');
function startEvmWatcher({ notifyMerchant }) {
const rpcUrls = getEthereumRpcUrls();
if (!rpcUrls.length) {
console.warn('[evmWatcher] No Ethereum RPC URLs configured. Skipping watcher.');
return;
}
const pollInterval = Number(process.env.TX_POLL_INTERVAL_MS || 180000);
const maxPerCycle = Number(process.env.MAX_TX_CHECK_PER_CYCLE || 20);
const minConfirmations = Number(process.env.MIN_CONFIRMATIONS || 1);
const pickRpcUrl = createRoundRobinPicker(rpcUrls);
let running = false;
async function poll() {
if (running) return;
running = true;
try {
const db = await readDb();
const pending = db.txs.filter((tx) => tx.network === 'evm:ethereum' && tx.status === 'pending');
if (pending.length === 0) {
running = false;
return;
}
const rpcUrl = pickRpcUrl();
const provider = new JsonRpcProvider(rpcUrl);
const latestBlock = await provider.getBlockNumber();
const now = new Date().toISOString();
const confirmedEvents = [];
for (const tx of pending.slice(0, maxPerCycle)) {
const receipt = await provider.getTransactionReceipt(tx.txHash);
tx.lastCheckedAt = now;
if (!receipt) continue;
const confirmations = latestBlock - receipt.blockNumber + 1;
tx.confirmations = confirmations;
tx.updatedAt = now;
if (receipt.status === 1 && confirmations >= minConfirmations) {
tx.status = 'confirmed';
const order = db.orders.find((item) => item.id === tx.orderId);
if (order) {
order.status = 'paid';
order.updatedAt = now;
confirmedEvents.push({ order, tx });
}
} else if (receipt.status === 0) {
tx.status = 'failed';
}
}
await writeDb(db);
for (const event of confirmedEvents) {
await notifyMerchant(event.order, event.tx);
}
} catch (error) {
console.error('[evmWatcher] poll error', error.message);
} finally {
running = false;
}
}
poll();
setInterval(poll, pollInterval);
console.log(`[evmWatcher] started with interval ${pollInterval}ms`);
}
module.exports = { startEvmWatcher };

子模块 backend/infra/docker/btcpay-src 已添加到 3bd29ae5a4

查看文件

@@ -0,0 +1,6 @@
BTCPAY_HOST=btc.capay.hao.work
LETSENCRYPT_EMAIL=ops@capay.hao.work
BTCPAYGEN_EXCLUDE_FRAGMENTS=nginx-https
BTCPAYGEN_ADDITIONAL_FRAGMENTS=opt-save-storage,bitcoin
BTCPAYGEN_LIGHTNING=lnd
NBITCOIN_NETWORK=mainnet

查看文件

@@ -0,0 +1,43 @@
version: "3"
services:
postgres:
image: postgres:9.6.5
restart: unless-stopped
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
nbxplorer:
image: nicolasdorier/nbxplorer:1.0.2.31
restart: unless-stopped
environment:
NBXPLORER_NETWORK: mainnet
NBXPLORER_BIND: 0.0.0.0:32838
NBXPLORER_CHAINS: "btc"
NBXPLORER_BTCRPCURL: https://alchemy:P9kZiHB6Q7CLrBlMsUN3n@bitcoin-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n
NBXPLORER_BTCNODEENDPOINT: bitcoin-mainnet.g.alchemy.com:443
NBXPLORER_BTCRPCUSER: "alchemy"
NBXPLORER_BTCRPCPASSWORD: "P9kZiHB6Q7CLrBlMsUN3n"
volumes:
- "nbxplorer_datadir:/datadir"
depends_on:
- postgres
btcpayserver:
image: nicolasdorier/btcpayserver:1.0.2.106
restart: unless-stopped
ports:
- "23000:49392"
environment:
BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Database=btcpayservermainnet
BTCPAY_NETWORK: mainnet
BTCPAY_BIND: 0.0.0.0:49392
BTCPAY_EXTERNALURL: https://btc.capay.hao.work/
BTCPAY_ROOTPATH: /
BTCPAY_BTCEXPLORERURL: http://nbxplorer:32838/
depends_on:
- postgres
- nbxplorer
volumes:
postgres_datadir:
nbxplorer_datadir:

子模块 backend/infra/docker/keagate-src 已添加到 0581525abb

查看文件

@@ -0,0 +1,21 @@
{
"HOST": "https://capay.hao.work/backend",
"PORT": 8081,
"MONGO_CONNECTION_STRING": "mongodb://localhost:27017",
"MONGO_KEAGATE_DB": "keagate",
"IP_WHITELIST": ["127.0.0.1"],
"TRANSACTION_TIMEOUT": 1200000,
"TRANSACTION_MIN_REFRESH_TIME": 30000,
"TRANSACTION_SLIPPAGE_TOLERANCE": 0.02,
"SEED": "hex-128-bit-seed",
"KEAGATE_API_KEY": "replace-api-key",
"INVOICE_ENC_KEY": "hex-32-bytes",
"IPN_HMAC_SECRET": "replace-hmac-secret",
"SOL": {
"ADMIN_PUBLIC_KEY": "SolPublicAddress",
"ADMIN_PRIVATE_KEY": null
}
}

子模块 backend/infra/docker/x402-rs 已添加到 4b0134acb1

查看文件

@@ -0,0 +1,71 @@
server {
listen 80;
server_name capay.hao.work pay.capay.hao.work btc.capay.hao.work;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name capay.hao.work;
# ssl_certificate /etc/letsencrypt/live/capay.hao.work/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/capay.hao.work/privkey.pem;
# include /etc/letsencrypt/options-ssl-nginx.conf;
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location = / {
return 302 /backend/;
}
location = /backend {
return 301 /backend/;
}
location /backend/ {
proxy_pass http://127.0.0.1:3001/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443 ssl http2;
server_name pay.capay.hao.work;
# ssl_certificate /etc/letsencrypt/live/pay.capay.hao.work/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/pay.capay.hao.work/privkey.pem;
# include /etc/letsencrypt/options-ssl-nginx.conf;
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location /verify {
proxy_pass http://127.0.0.1:4020/verify;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /settle {
proxy_pass http://127.0.0.1:4020/settle;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443 ssl http2;
server_name btc.capay.hao.work;
# ssl_certificate /etc/letsencrypt/live/btc.capay.hao.work/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/btc.capay.hao.work/privkey.pem;
# include /etc/letsencrypt/options-ssl-nginx.conf;
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://127.0.0.1:23000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

查看文件

@@ -0,0 +1,19 @@
PORT=4020
HOST=https://pay.capay.hao.work
LOG_LEVEL=info
FACILITATOR_JWT_SECRET=replace-with-strong-secret
PAYMENT_HMAC_SECRET=replace-with-strong-secret
EVM_PRIVATE_KEY=da31295a02cb4bf55be60827d72be87c60d7c40efc9b10f6f04dd87e97735da5
SOLANA_PRIVATE_KEY=fQ6DNzNNJmwiuB9VQSCn5UnwrJktp1ZKsgkmds8NsQowgswv58TGibnJpQkKcLzQtHztizvshfcQVoCJBZrfWsB
# Alchemy Ethereum RPC
ETHEREUM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n
# Optional BSC RPC (Alchemy BNB Mainnet)
BSC_RPC_URL=https://bnb-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n
# Solana RPC (Alchemy)
SOLANA_RPC_URL=https://solana-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n
REDIS_URL=redis://127.0.0.1:6379

查看文件

@@ -0,0 +1,49 @@
{
"port": 4020,
"host": "0.0.0.0",
"chains": {
"eip155:1": {
"eip1559": true,
"signers": ["$EVM_PRIVATE_KEY"],
"rpc": [
{
"http": "https://eth-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n",
"rate_limit": 20
}
]
},
"eip155:56": {
"eip1559": false,
"signers": ["$EVM_PRIVATE_KEY"],
"rpc": [
{
"http": "https://bnb-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n",
"rate_limit": 20
}
]
},
"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": {
"signer": "$SOLANA_PRIVATE_KEY",
"rpc": "https://solana-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n",
"pubsub": "wss://solana-mainnet.g.alchemy.com/v2/P9kZiHB6Q7CLrBlMsUN3n"
}
},
"schemes": [
{
"id": "v1-eip155-exact",
"chains": "eip155:*"
},
{
"id": "v2-eip155-exact",
"chains": "eip155:*"
},
{
"id": "v1-solana-exact",
"chains": "solana:*"
},
{
"id": "v2-solana-exact",
"chains": "solana:*"
}
]
}

查看文件

@@ -0,0 +1,21 @@
{
"evm": {
"ethereum": {
"chainId": 1,
"rpcEnv": "ETHEREUM_RPC_URL",
"explorer": "https://etherscan.io/tx/"
},
"bsc": {
"chainId": 56,
"rpcEnv": "BSC_RPC_URL",
"explorer": "https://bscscan.com/tx/"
}
},
"svm": {
"solana": {
"cluster": "mainnet-beta",
"rpcEnv": "SOLANA_RPC_URL",
"explorer": "https://solscan.io/tx/"
}
}
}

查看文件

@@ -0,0 +1,21 @@
{
"evm": {
"ethereum": {
"USDC": { "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "decimals": 6 },
"USDT": { "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "decimals": 6 },
"ETH": { "native": true, "decimals": 18 }
},
"bsc": {
"USDC": { "address": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", "decimals": 18 },
"USDT": { "address": "0x55d398326f99059fF775485246999027B3197955", "decimals": 18 },
"BNB": { "native": true, "decimals": 18 }
}
},
"svm": {
"solana": {
"USDC": { "mint": "EPjFWdd5AufqSSqeM2qE1z3vY2Z9K5xkqkQ3yqC4wR5Z", "decimals": 6 },
"USDT": { "mint": "Es9vMFrzaCERzmxEtpmJieE5s3bD4ZjbFj9a2yq6VQ8G", "decimals": 6 },
"SOL": { "native": true, "decimals": 9 }
}
}
}