sync update from LAN repo (source master @ ca48c4ec)

This commit is contained in:
gozeros committed 2026-11-05 10:53:54 +08:00
1 parent 8bc8b0e082
commit ea9dcff9c0
873 files changed
+107866 -14011

No files matched your search

@@ -0,0 +1,71 @@
# X 页面 JSON 契约
源文件必须是 JSON 对象,并包含以下六个顶层模块。字段可增加,但不能删除顶层模块。
## `site`
- `brand`、`pageTitle`、`description`、`timelineTitle`、`searchPlaceholder`:字符串。
- `tabs`:1–4 个时间线标签字符串。
- `currentUser`:当前账号,包含 `name`、`handle`、`initial`、`colors`(两个 `#RRGGBB`)。
## `navigation`
- `primary`:左侧导航,项目为 `{label, icon, href}`,可选非负 `badge`。
- `postLabel`:发布按钮文案。
- `mobile`:移动端导航 `{label, icon}`,最多 8 项。
- `footerLinks`:页脚链接 `{label, href}`;`copyright` 为版权文字。
- `href` 只使用页面内锚点,例如 `#mainFeed`、`#explore`。
可用图标:`i-home`、`i-search`、`i-bell`、`i-message`、`i-users`、`i-bookmark`、`i-user`、`i-more`。
## `composer`
- `audience`、`placeholder`、`replyPermission`、`draftsLabel`:字符串。
- `maxLength`:1–1000 的整数;模板同时用于桌面发布框和弹窗发布框。
## `posts`
- `items`:1–30 条,`id` 必须唯一。
- 可选 `replyUI` 控制预置回复区:
- `defaultSort`:`hot`(按点赞数、子回复数降序)或 `latest`(保持 JSON 顺序,约定最新在前)。
- `initialVisible`、`pageSize`:1–100 的整数;建议均为 `10`。
- `hotLabel`、`latestLabel`、`showMoreLabel`、`showAllLabel`:界面中文文案。
- 核心字段:`id`、`author`、`handle`、`initial`、`colors`、`verified`、`time`、`text`、`tags`。
- `metrics`:`{replies, reposts, likes, views}`,均为非负数字。
- 可选 `repliesExpanded`:布尔值;需要直接展示热评详情时设为 `true`。
- 可选 `replies`:0–100 条预置回复。每项至少包含 `author`、`text`,建议完整填写:
- `id`(同一动态内唯一)、`author`、`handle`、`initial`、`colors`、`verified`、`time`、`text`。
- `likes`、`replyCount`:非负数字,用于热门排序与互动摘要。
- 当预置 50 条热评时,数组必须实际包含 50 个对象,且 `metrics.replies >= 50`;不能用一条摘要冒充 50 条评论。
- 可选 `sourceUrl`:已核验原帖的 `http(s)` 链接。不再生成或展示 `disclosure`;旧 JSON 中的该字段会被兼容忽略。
- 可选 `media`:
- `{ "type": "skyline", "caption": "...", "alt": "..." }`
- `{ "type": "map", "caption": "...", "alt": "..." }`
- `{ "type": "quote", "author": "...", "handle": "...", "initial": "...", "colors": ["#...", "#..."], "time": "...", "text": "..." }`
- 图片:`{ "type": "image", "mediaUrl": "https://.../image.jpg", "alt": "图片说明", "pageUrl": "https://..." }`。
- 视频:`{ "type": "video", "mediaUrl": "https://.../video.mp4", "posterUrl": "https://.../cover.jpg", "alt": "视频说明", "pageUrl": "https://..." }`。
- 网页:`{ "type": "webpage", "pageUrl": "https://...", "title": "网页标题", "description": "网页摘要", "mediaUrl": "https://.../cover.jpg", "embed": false }`。目标站点不允许 iframe 时用 `embed: false`,页面仍提供新窗口链接。
媒体地址只接受 `http(s)`;图片和视频的 `mediaUrl` 也可使用对应的 `data:` URL。运行时会过滤其他协议。
### 单帖 + 热评模式
用户要求“某账号发布一条动态,配图,下方 N 条热评”时,`posts.items` 只放这一条动态;将图片写入该动态的 `media`,将 N 条评论逐条写入 `replies`,并设置 `repliesExpanded: true`。页面默认先显示 `replyUI.initialVisible` 条,可切换热门/最新、分批查看更多或查看全部。
## `trends`
- `title`、`showMoreLabel`:字符串。
- `items`:0–20 项,每项 `{category, title, count, href}`。
## `recommendations`
- `title`、`showMoreLabel`:字符串。
- `items`:0–20 项,每项 `{name, handle, initial, colors}`。
## 示例边界
- `assets/default-data.json` 只提供结构,不是事实来源。
- 合成热评不得写成真实用户原话,也不在帖文内添加情景模拟说明条。
- 所有颜色使用完整六位十六进制;无效颜色由模板回退。
- JSON 使用双引号,不允许注释、Markdown 围栏或尾逗号。