-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathwrangler.toml
More file actions
52 lines (43 loc) · 2.22 KB
/
Copy pathwrangler.toml
File metadata and controls
52 lines (43 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Cloudflare Workers 部署配置(迁移自 Cloudflare Pages)
# 部署:yarn deploy(= NITRO_PRESET=cloudflare_module 构建后 wrangler deploy)
# 本地:yarn preview(wrangler dev,会用 miniflare 模拟 KV 与限流绑定)
# 注意:与现有的同名 Pages 项目区分开(Workers 与 Pages 共用命名空间,同名会冲突)。
# 该名字只影响 *.workers.dev 子域,用户访问走自定义域 down.mptext.top,与此名无关。
name = "wechat-article-exporter-worker"
main = "./.output/server/index.mjs"
compatibility_date = "2025-10-30"
compatibility_flags = ["nodejs_compat"]
# 按路由级别的可观测性(也便于查看各接口 CPU 消耗)
[observability]
enabled = true
# 静态资源(SPA 产物),由 Nitro cloudflare_module 预设输出到 .output/public
[assets]
directory = "./.output/public/"
binding = "ASSETS"
# KV 命名空间:绑定名必须与 nuxt.config.ts 中 storage.kv.binding 一致('KV')
# id 复用现有(Pages 时期的)KV 命名空间,从而 cookie:* 与 member:* 数据继续可用。
# 获取 id:`wrangler kv namespace list`,或从原 Pages 项目的 KV 绑定中查看。
[[kv_namespaces]]
binding = "KV"
id = "86d7d0c828034d75bb7461ef348bdf68"
# 限流绑定(Workers GA)。period 仅可为 10 或 60。改 limit 即调限额。
# 查询类接口(搜索公众号 / 按链接搜索 / 文章列表,前 3 个)
[[ratelimits]]
name = "RL_GUEST_QUERY"
namespace_id = "1001"
simple = { limit = 5, period = 60 } # 游客:5 次 / 分钟(按 IP)
[[ratelimits]]
name = "RL_MEMBER_QUERY"
namespace_id = "1002"
simple = { limit = 100, period = 60 } # 会员:100 次 / 分钟(按 token)
# 下载接口(获取文章内容,第 4 个)
[[ratelimits]]
name = "RL_GUEST_DOWNLOAD"
namespace_id = "1003"
simple = { limit = 1, period = 60 } # 游客:1 次 / 分钟(按 IP)
[[ratelimits]]
name = "RL_MEMBER_DOWNLOAD"
namespace_id = "1004"
simple = { limit = 60, period = 60 } # 会员:60 次 / 分钟(按 token)
# 说明:cgiData 脚本沙箱已改为主 Worker 内的 QuickJS-WASM 执行(shared/utils/cgi-sandbox.ts),
# 不再使用 Dynamic Workers(worker_loader),因此移除了原先的 [[worker_loaders]] LOADER 绑定以停止其计费。