Files
stun-nav/EDGEONE.md
2026-07-12 16:22:32 +08:00

64 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# EdgeOne Pages 部署说明
这个项目已经包含 EdgeOne Pages 版本:
- 静态页面:`public/`
- Edge Functions:`edge-functions/api/[[default]].js`
- EdgeOne 配置:`edgeone.json`
## 需要在 EdgeOne 配置的内容
1. 创建一个 EdgeOne Pages / Makers 项目,并导入这个仓库。
2. 创建并绑定 KV Namespace。
3. 绑定 KV 时,变量名填写:
```text
STUN_NAV_KV
```
4. 配置环境变量:
```text
WEBHOOK_TOKEN=换成你自己的随机密钥
```
5. 部署后访问:
```text
https://你的域名/
https://你的域名/admin
```
## Lucky Webhook 示例
简单 URL 参数方式:
```text
https://你的域名/api/webhook/alist?token=你的随机密钥&name=AList&group=文件&url=http://{STUN_你的STUN规则名_ADDR}
```
JSON 方式:
```text
URL: https://你的域名/api/webhook/alist?token=你的随机密钥
Method: POST
Content-Type: application/json
Body:
{
"name": "AList",
"group": "文件",
"url": "http://{STUN_你的STUN规则名_ADDR}",
"note": "家中文件服务"
}
```
## 数据存储
EdgeOne 版本不再使用 `data/links.json`,所有数据会存到 KV 的 `stun_nav_store` 这个 key 里。
本地 Node 版本仍然保留,可以继续用:
```bash
WEBHOOK_TOKEN=你的随机密钥 PORT=8080 npm start
```