Repository navigation
Releases: zlwzk/dsh-friends
Release list
v0.5.0 - reliable state sync: presence, signature and messages now actually arrive
修的都是「根本没同步」这类硬问题
你反馈:双方都看不到对方的在线状态、个性签名和消息。
根因(结构性,不是小 bug):状态用 QoS 0 发出且没有 retain,跑在三个谁都不负责的公共中继上。对方只要离线错过一拍,那条状态就永久蒸发;两边只有在那 8 秒心跳恰好重叠时才看得见彼此。签名也搭在同一批丢掉的包上,所以看起来是空的。
修法:用 MQTT 本来就为「最新状态」准备的机制。
| 改动 | 作用 |
|---|---|
状态保留槽 dshf/s/<对方>/<我> |
presence 写到每个好友专属的保留槽,中继替我保管最后一条。对方一订阅就立刻收到,不需要心跳重叠 |
| 自动订阅好友的状态槽 | 好友增删后自动补订阅 |
| 下线写离线标记 | 否则对方会一直读到你最后那条「在线」 |
| 待发队列 | 聊天/文件/留言发送失败的消息进队列,重连和每次心跳都自动重试,不再永久丢失 |
真机验证(不是理论推演)
两个新测试直接打真实公共中继:
- A 发状态 → A 断开 → B 之后才订阅 → B 立刻收到完整状态(昵称、签名、忙碌任务全在)✅
- 先写「在线」再写「离线标记」→ 订阅者读到的是离线标记,不是过期的「在线」✅
测试总数:23 个全过。
升级
dsh plugin --profile web add https://github.com/zlwzk/dsh-friends/releases/latest/download/dsh-friends.tgz
装完重启 DSH。
v0.4.0 - chat, file & plugin sharing, and three real-use bug fixes
新功能:和好友真正互动
- 💬 聊天:和好友 1v1 加密对话,未读数显示在好友行和标题栏,记录存本地
- 📎 文件分享:把文件发给好友。≤64KB 内联直传,对方点「保存到本机」就落盘;更大的文件会给明确提示(公共中继不适合传大二进制)
- 🧩 插件分享:从已安装插件里挑一个发给好友,他点「复制安装命令」贴进终端就能装
- 🤖 给 AI 留言:给好友的模型留一句话
修掉的三个真机问题
1. 收不到好友申请、没有弹窗
提示原本挂在面板 DOM 里且几秒就消失,面板没开就完全看不到。现在提示是独立一层带关闭按钮,同时申请会以高亮收件箱 + 标题栏徽章呈现,不会漏。
2. 明明在线却显示离线
心跳在 socket 瞬时断开时被跳过,门槛又只有 3 个心跳(26 秒),短暂抖动就被判离线。现在重连成功会立刻补发,门槛放宽到 40 秒。
3. 看不到好友的个性签名
签名原来只活在内存里,要等实时心跳到达才有。现在每个好友的签名会缓存到本地,重连/刷新后立刻能显示;空签名也不会再覆盖已知的签名。
安装 / 升级
dsh plugin --profile web add https://github.com/zlwzk/dsh-friends/releases/latest/download/dsh-friends.tgz
装完重启 DSH。
测试:20 个单测 + 模块契约 + 浏览器渲染回归(含聊天视图)。
v0.3.1 - fix: friend requests never reached the recipient
重要修复:好友申请收不到
根因:消息是用「收件人的好友码」加密的,但接收端只用「已知的好友 + 记得的申请」去解密。所以一个还没加过任何人的用户,候选码是空数组 —— 别人发给他的好友申请全部被静默丢弃,「同意」按钮自然不会出现。
修复
- 解密候选码现在从自己的码开始(发送方只知道你的码)
- 所有申请相关消息都带
fromCode,收件人解密后能知道是谁在加他 - 申请送达时弹提示 + 回执
friend_request_ack,发起方不再盲等 - 申请收件箱移到资料卡正下方,蓝色高亮边框 +「有人想加你」标题,同意/拒绝是大按钮
- 标题栏新增 ⟳ 刷新 按钮(推送丢失时手动拉取)
测试 +3(共 19):其中一个专门建模老 bug —— 零好友用户必须能解开寄给自己的申请。
安装 / 升级
dsh plugin --profile web add https://github.com/zlwzk/dsh-friends/releases/latest/download/dsh-friends.tgz
已是旧版的话重跑上面这条命令即可覆盖升级,然后重启 DSH。
v0.3.0 - friend requests, invite links, approval modes
The friend system now has a real request lifecycle instead of assuming both sides add each other by hand.
Friend requests
- Send a request with an optional 60-char note; the other side gets a header badge plus an inbox card with accept / reject
- Sent requests show as waiting and can be cancelled
- Accepting connects you both and notifies the other side
Two approval modes
- Needs my approval (default): requests wait in your inbox
- Auto-accept: anyone with your code becomes a friend instantly; you get a notification
- Your choice only affects how others add you; adding someone else still respects their setting
Invite links
- Copy
dsh-friends://add?code=K7M2QXfrom settings; pasting it into the add box extracts the code automatically (a bare 6-digit code works too)
Filled in around it
- Per-friend alias with inline pencil edit
- Stealth mode: stay connected, broadcast nothing (friends see you offline)
- Removing a friend notifies them, so deletion is symmetric; rejecting a request notifies nobody
- Offline / busy / error states each show a concrete label and time
Host
- profile.json gains acceptMode, stealth and requests{incoming,outgoing}; all sanitised and persisted
- New read-only
friend_inboxtool so the model can tell you who is waiting
Install
dsh plugin --profile web add https://github.com/zlwzk/dsh-friends/releases/latest/download/dsh-friends.tgz
(or github:zlwzk/dsh-friends). Not on npm yet.
Tests
16 unit tests (4 new host cases for modes/requests/aliases) + module-contract smoke + browser render check asserting the request UI and all three presence states render.
v0.2.0 - readable UI, prominent friend code
UI overhaul after real feedback: the panel was too plain, text was unreadable in places, and the friend code was easy to miss.
What changed
- Self-contained theme tokens on the panel root: dark (default) and light palettes, selected by
prefers-color-schemeand by the host's ownbody[data-ds-dark-theme]attribute. The old code guessed host CSS variables that DSH does not publish, so every colour fell back to a muddy value. - Solid text colours everywhere (no more opacity-based dimming).
- Your friend code is now its own labelled row with a large monospace value and a copy button that confirms, instead of a small badge.
- Task status as a badge with a coloured dot; friend count with an online summary; offline timestamps.
- Poke / delete / relay-switch buttons are inline SVG instead of emoji (the emoji rendered as tofu in some fonts).
- Fixed a harness bug that deleted the injected stylesheet immediately.
- Real screenshots for both themes +
screenshots.json.
Install
dsh plugin --profile web add dsh-friends
Tests: 12 unit tests + module-contract smoke + a browser render check (asserts the panel really renders and no render-time error fires).
v0.1.0 - first release
First public release of the DSH whale friends plugin.
- presence (online / busy / error / offline) with 8s heartbeat
- live task status shared with friends
- editable signature, mood emoji, AI-written signatures
- poke friends
- AES-GCM end-to-end encryption, key derived from your friend code
- zero server, zero signup, zero dependencies in the browser bundle
Install: dsh plugin --profile web add dsh-friends