config.js 或源代码的开关搬到网页端,保存到 D1 site_settings.features。
开关列表
读取与保存
features 是 JSON 字符串,读取端需要 JSON.parse。保存使用 PUT /api/settings,请求体是合并式 upsert:
config.js 的静态默认值合并。
相关页面:站点设置 · 配置参考 · 可观测性Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
后台 Feature switches 的覆盖范围与存储方式
config.js 或源代码的开关搬到网页端,保存到 D1 site_settings.features。
| 字段 | 默认 | 作用 |
|---|---|---|
pageSize | 5 | 首页每页文章数,0 = 不分页 |
ads | {} | 广告总开关、AdSense Client ID 与列表上方 / 列表间隔 / 文章底部三个广告位 |
errorReport | true | 前端错误上报;关闭后浏览器不再上报错误日志 |
commentGuard | true | 评论蜜罐 + 时间戳反机器人;关闭后仍保留其它评论安全机制 |
richContent | true | Mermaid / KaTeX 按需加载;关闭后正文不再加载这两个库 |
GET /api/settings
features 是 JSON 字符串,读取端需要 JSON.parse。保存使用 PUT /api/settings,请求体是合并式 upsert:
{
"features": {
"pageSize": 8,
"ads": { "enabled": false },
"errorReport": true,
"commentGuard": true,
"richContent": true
}
}
config.js 的静态默认值合并。
相关页面:站点设置 · 配置参考 · 可观测性