在任意 DSH 上启用话题同步

插件从本 Worker 分发,不再依赖 git 或仓库克隆。装完后任何设备的会话都会经过这里中继。

方式一 · 一条命令(推荐)

curl -fsSL -H "X-Hub-Key: $DSH_HUB_KEY" \
  https://dsh-hub.rainman-ray.workers.dev/install.sh | sh

脚本会下载插件、登记到当前 profile,并把 store 指到本地目录。之后重启 DSH 即可。

方式二 · 手动

插件文件本身就是全部内容,放到任意目录即可:

mkdir -p ~/.dsh/hub-plugins/dsh-session-sync
cd ~/.dsh/hub-plugins/dsh-session-sync
for f in package.json index.js cordis.patch.yml sync-core.mjs zstdframes.mjs hub-transport.mjs; do
  curl -fsSL -H "X-Hub-Key: $DSH_HUB_KEY" \
    https://dsh-hub.rainman-ray.workers.dev/plugin/$f -o $f
done

方式三 · 只做文件同步(不要插件)

在没有 DSH 的机器上,或者想手工控制时机时,直接用 CLI:

dsh-sync hub-pull     # 取回其他设备的会话
dsh-sync hub-push     # 发布本机的会话
dsh-sync hub-sync     # 先取后发

配置

在 profile 自己的 cordis.patch.yml 里覆盖(别改插件目录里的那份):

- id: dsh-session-sync
  config:
    storePath: ~/.dsh/dsh-store
    hubUrl: https://dsh-hub.rainman-ray.workers.dev
    hubKey: <你的 hub key>
    useHub: true      # 走 Worker 中继
    remote: ''        # 留空即不用 git

也可以完全不写进配置文件,改用环境变量:DSH_HUB_URL / DSH_HUB_KEY。

插件文件

GET /plugin/manifest.json   # 清单
GET /plugin/<file>          # 单个文件

凭据

脚本想直接取用凭据时:
export $(curl -fsS -H "X-Hub-Key: $DSH_HUB_KEY" https://dsh-hub.rainman-ray.workers.dev/creds/env)
浏览器里看和改请用 保险箱。