Skip to content

开放协议:touched.json v1 与独立节点直连 ​

touched.page 的开放协议设计得足够轻量:任何网站——无论是 GitHub Pages 静态博客、Cloudflare Worker、自建 touched-node,还是你自己写的 Python / Go / Rust 后端——只要对外提供一个带 CORS 的 JSON 文件,就能直接接入跨媒介跨节点订阅网络。

在线协议校验与预览演练场 ​

直接在浏览器内编辑并校验 touched.page/v1 载荷,实时检测潜在隐私泄漏(email、private、archive)与 NIP-36 contentWarning: "nsfw" 渲染效果,或直接填写任意带 CORS 的 https://.../touched.json 地址做零后端拉取测试。

touched.json2274 chars
实时校验与客户端渲染预览通过 · 2 评价 / 1 随笔
全部 Schema、来源键与零隐私泄漏检查均已通过。
林深 · Lin@lin
评价夯二周目通关
极乐迪斯科 / Disco Elysium

开局摘领带死了两次,对话树写得真绝,冰面上看到竹节虫那段直接坐直了。

game · ZA/UM · 2019steam:632470
评价人上人一周目通路线NSFW · 浏览器本地模糊
Rance X -決戦-

系列三十年收官真没糊弄人,策略深度放到今天还是独一档。

game · AliceSoft · 2018erogamescape:25420
随笔
二周目《极乐迪斯科》:为什么内陆帝国线最值得走

一周目靠逻辑和视觉计算硬推主线,二周目拉满内陆帝国和感同身受,整个马丁内斯的对话走向完全变了样。

/disco-inland-empire-runsteam:632470

1. 公开空间协议(touched.page/v1) ​

自动发现与响应头 ​

每个公开个人空间在 <head> 中同时声明 RSS 与 touched.json:

html
<link rel="alternate" type="application/rss+xml" title="RSS" href="/@handle/rss.xml" />
<link rel="alternate" type="application/json" title="touched.json" href="/@handle/touched.json" />

必须返回的 HTTP 响应头:

http
Content-Type: application/json; charset=utf-8
Access-Control-Allow-Origin: *
Cache-Control: public, max-age=60

完整数据格式(Schema) ​

json
{
  "protocol": "touched.page/v1",
  "generatedAt": "2026-12-01T14:20:00.000Z",
  "profile": {
    "handle": "lin",
    "displayName": "林深",
    "bio": "在游戏、动画、书页与唱片之间整理自己的个人媒体库。",
    "avatarUrl": "https://example.com/avatar.png",
    "spaceUrl": "https://library.example.com",
    "rssUrl": "https://library.example.com/rss.xml",
    "touchedJsonUrl": "https://library.example.com/touched.json",
    "blogUrl": "https://lin.example.com",
    "tierLabels": {
      "5": "夯",
      "4": "顶级",
      "3": "人上人",
      "2": "NPC",
      "1": "拉完了"
    }
  },
  "reviews": [
    {
      "id": "rev-disco-2026",
      "rating": 5,
      "tierLabel": "夯",
      "statusText": "二周目通关",
      "note": "开局摘领带死了两次,对话树写得真绝,冰面上看到竹节虫那段直接坐直了。",
      "updatedAt": "2026-12-01T10:30:00.000Z",
      "work": {
        "publicId": "k7m4p9x2",
        "title": "极乐迪斯科",
        "titlesI18n": {
          "zh-CN": ["极乐迪斯科"],
          "en": ["Disco Elysium"]
        },
        "category": "game",
        "subtype": "rpg",
        "creator": "ZA/UM",
        "releaseYear": 2019,
        "coverUrl": "https://shared.fastly.steamstatic.com/store_item_assets/steam/apps/632470/library_600x900_2x.jpg",
        "workUrl": "https://touched.page/works/k7m4p9x2",
        "sources": [
          {
            "namespace": "steam",
            "externalId": "632470",
            "canonicalUrl": "https://store.steampowered.com/app/632470/",
            "label": "steam"
          }
        ]
      }
    },
    {
      "id": "rev-rancex-2026",
      "rating": 3,
      "tierLabel": "人上人",
      "statusText": "一周目通路线",
      "note": "三十年系列收官作,把庞大的角色群像和策略卡片节奏塞进同一套系统里。",
      "contentWarning": "nsfw",
      "updatedAt": "2026-11-20T09:00:00.000Z",
      "work": {
        "publicId": "r9x4k2n7",
        "title": "Rance X -決戦-",
        "category": "game",
        "subtype": "visual_novel",
        "creator": "AliceSoft",
        "releaseYear": 2018,
        "workUrl": "https://touched.page/works/r9x4k2n7",
        "sources": [
          {
            "namespace": "erogamescape",
            "externalId": "25420",
            "canonicalUrl": "https://erogamescape.dyndns.org/~ap2/ero/toukei_kaiseki/game.php?game=25420",
            "label": "erogamescape"
          }
        ]
      }
    }
  ],
  "posts": [
    {
      "id": "post-disco-inland",
      "slug": "disco-inland-empire-run",
      "title": "二周目《极乐迪斯科》:为什么内陆帝国线最值得走",
      "summary": "一周目靠逻辑和视觉计算硬推主线,二周目拉满内陆帝国和感同身受,整个马丁内斯的对话走向完全变了样。",
      "url": "https://library.example.com/articles/disco-inland-empire-run",
      "publishedAt": "2026-11-29T08:00:00.000Z",
      "updatedAt": "2026-11-29T08:00:00.000Z",
      "workPublicIds": ["k7m4p9x2"],
      "workSources": [
        {
          "workPublicId": "k7m4p9x2",
          "namespace": "steam",
          "externalId": "632470",
          "canonicalUrl": "https://store.steampowered.com/app/632470/",
          "label": "steam"
        }
      ]
    }
  ]
}

隐私边界与 NIP-36 NSFW 规范 ​

  • 严格仅输出公开内容:绝不输出邮箱、密码哈希、会话凭证、API Key、private 私密记录、archive 归档条目、未写评语也未打分的静默 ready 收藏、私密静音列表,以及未主动公开的 OAuth 绑定或博客外链。
  • NIP-36 contentWarning: "nsfw":NSFW 作品评价、NSFW 随笔(或关联 NSFW 作品的随笔)输出 "contentWarning": "nsfw";安全内容完全省略该字段。消费端必须按读者自身的 nsfwMode(hide | blur | show)渲染,且严禁把 NSFW 封面图片送进服务端图片代理缓存。
  • 前向兼容预留:消费端必须忽略未知字段,方便后续平滑扩展可选的加密身份(profile.identity 含 pubkey/npub/relays)与条目签名(proof 含 eventId/sig)。

2. 浏览器直连独立节点(零 SSRF)与智能去重 ​

跨节点订阅完全在读者的浏览器内完成:

  1. 零服务端外发 / 零 SSRF:无论是主站还是 touched-node,服务端永远不会替用户去请求外部节点 URL。
  2. 手动订阅外部节点:任意用户可在首页「关注」栏订阅最多 50 个外部 touched.json 地址。列表仅保存在本地 localStorage(tp-external-nodes-v1),附带 5 分钟本地缓存与 6 秒超时控制,所有文本与链接均通过安全 DOM API(createElement + textContent,仅放行 http(s)://)渲染防 XSS。
  3. 主动开启独立节点直连:当你关注的作者运行着自己的 touched-node 并在设置/云端桥接页主动公开了 nodeUrl(默认关闭),你的浏览器会自动以 CORS 直连拉取对方的 touched.json(5 秒超时、5 分钟缓存),并与云端流做智能去重:
    • 评价按 namespace:externalId(回退规范化标题)对齐去重。
    • 随笔按稳定 slug(回退规范化标题)对齐去重。
    • 独立节点更新的内容会自动替换云端旧缓存并标注 直连节点 · <域名>;若对方家庭服务器暂时离线,页面无缝保留云端缓存内容不报错。

3. 订阅便携与全量备份(OPML 2.0 & touched.page/backup/v1) ​

以下接口通过登录 Cookie 或作用域密钥(Authorization: Bearer tp_live_...)鉴权,统一返回 Cache-Control: no-store:

  • GET /api/me/following.json — 可携带的关注清单(包含对方已公开的 nodeUrl)
  • GET /api/me/following.opml — 标准 OPML 2.0 XML,可直接导入 Folo、NetNewsWire、Reeder、Miniflux 等 RSS 阅读器
  • GET /api/me/export.json — 完整 touched.page/backup/v1 备份包(资料、偏好设置、作品与多语标题与来源、含私密/归档在内的全量评价记录、主题清单、标签、随笔、关注关系与私密静音列表)
  • POST /api/me/import — 幂等导入恢复(上限 2 MB),主站与 touched-node 双向无损互通

4. 5 分钟接入网络(30 行上手模板) ​

任选下面一种你熟悉的技术栈发布 /touched.json,把链接贴进主站或自建节点的「关注 → 外部节点」即可立刻被订阅!

模板 A:GitHub Pages / Hugo / Astro 静态 JSON ​

在任意静态博客根目录放入 public/touched.json(GitHub Pages 默认对公开站点返回 Access-Control-Allow-Origin: *):

json
{
  "protocol": "touched.page/v1",
  "generatedAt": "2026-12-01T00:00:00.000Z",
  "profile": {
    "handle": "yourname",
    "displayName": "你的昵称",
    "spaceUrl": "https://yourname.github.io",
    "touchedJsonUrl": "https://yourname.github.io/touched.json"
  },
  "reviews": [
    {
      "id": "outer-wilds",
      "rating": 5,
      "tierLabel": "夯",
      "statusText": "全成就通关",
      "note": "没有任何数值成长,所有推进都来自你自己弄懂了世界如何运转。",
      "updatedAt": "2026-11-28T12:00:00.000Z",
      "work": {
        "title": "星际拓荒",
        "titlesI18n": { "zh-CN": ["星际拓荒"], "en": ["Outer Wilds"] },
        "category": "game",
        "creator": "Mobius Digital",
        "releaseYear": 2019,
        "sources": [
          { "namespace": "steam", "externalId": "753640", "canonicalUrl": "https://store.steampowered.com/app/753640/" }
        ]
      }
    }
  ],
  "posts": []
}

模板 B:Cloudflare Worker(零服务器边缘节点) ​

ts
export default {
  async fetch(req: Request): Promise<Response> {
    if (req.method === 'OPTIONS') {
      return new Response(null, {
        headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, OPTIONS' },
      });
    }
    const payload = {
      protocol: 'touched.page/v1',
      generatedAt: new Date().toISOString(),
      profile: {
        handle: 'edge-reader',
        displayName: '边缘书架',
        spaceUrl: 'https://reader.example.workers.dev',
        touchedJsonUrl: 'https://reader.example.workers.dev/touched.json',
      },
      reviews: [
        {
          id: 'disco-elysium',
          rating: 5,
          tierLabel: '夯',
          statusText: '二周目通关',
          note: '每段内心的声音都在替你保留一点不肯妥协的尊严。',
          updatedAt: '2026-11-30T10:00:00.000Z',
          work: {
            title: '极乐迪斯科',
            titlesI18n: { 'zh-CN': ['极乐迪斯科'], en: ['Disco Elysium'] },
            category: 'game',
            creator: 'ZA/UM',
            releaseYear: 2019,
            sources: [{ namespace: 'steam', externalId: '632470', canonicalUrl: 'https://store.steampowered.com/app/632470/' }],
          },
        },
      ],
      posts: [],
    };
    return new Response(JSON.stringify(payload), {
      headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Access-Control-Allow-Origin': '*',
        'Cache-Control': 'public, max-age=60',
      },
    });
  },
};

模板 C:Python FastAPI ​

python
from datetime import datetime, timezone
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

app = FastAPI()
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["GET"])

@app.get("/touched.json")
def touched_json():
    return {
        "protocol": "touched.page/v1",
        "generatedAt": datetime.now(timezone.utc).isoformat(),
        "profile": {
            "handle": "py-reader",
            "displayName": "夜读笔记",
            "spaceUrl": "https://library.example.org",
            "touchedJsonUrl": "https://library.example.org/touched.json",
        },
        "reviews": [
            {
                "id": "invisible-cities",
                "rating": 5,
                "tierLabel": "夯",
                "statusText": "已读完",
                "note": "五十五座虚构城市其实都是在重写威尼斯,适合睡前一次只读两页。",
                "updatedAt": "2026-11-29T08:00:00Z",
                "work": {
                    "title": "看不见的城市",
                    "titlesI18n": {"zh-CN": ["看不见的城市"], "en": ["Invisible Cities"]},
                    "category": "book",
                    "creator": "伊塔洛·卡尔维诺",
                    "releaseYear": 1972,
                    "sources": [
                        {"namespace": "douban", "externalId": "1858513", "canonicalUrl": "https://book.douban.com/subject/1858513/"}
                    ],
                },
            }
        ],
        "posts": [],
    }

Open-Core 开源生态(MIT 协议)· 让人们在作品和文字之间相遇