@huanlin/dsh-plugin-anti-ads
v0.2.0 · 4 天前发布
DSH ad-suppression plugin: writes dsh-ads's own settings key to all-false, broadcasts its retire event, scrubs its portal from the DOM, and short-circuits its dynamic-tier fetch. Four layers, all client-side, all removable from a settings page of its own.
README
dsh-anti-ads
给 DSH Web UI 安装的广告拦截器——拦截对象只有 dsh-ads 一个。右下角一枚小徽章,广告没了,徽章记着拦掉了几个弹层。
它是怎么拦的
四层防御,独立工作、可单独开关:
| 层 | 机制 | 关什么 |
|----|------|--------|
| L1 设置写穿 | 通过 dsh-ads 自身的存储契约(localStorage['dsh-ads:settings'] + dsh-ads:persist-changed 事件)把所有广告位开关写成关闭,并监听 dsh-ads 的广播持续压制 | 两侧广告栏、对话内信息流、右下角弹窗、跑分、安全告警、贪玩蓝鲸海报 |
| L2 兜底清理 | MutationObserver 监听页面变化,按形状(position:fixed + dsh-ads 的 z-index 区间,或全屏穿透遮罩层)识别并移除漏网弹层 | dsh-ads 未来版本绕过设置新增的广告位、改版后的根浮层 |
| L3 屏蔽动态广告源 | 对 /dsh-ads/registry.json 的请求(含带 query 的变体)直接返回空列表 | 社区插件的自动横幅 |
| L4 深层拦截 | 广播 dsh-ads 自身的 dsh-ads:retired 事件——它的「关闭所有广告」是模块级一次性开关,广告层在渲染前就检查这个标志,广播后整层隐藏到刷新 | 无视自身设置开关、任何新加广告位的 dsh-ads 版本 |
四层都不依赖对方:L1 失效时 L2/L3/L4 还在;关掉 L4,L1/L2/L3 照常跑。
持久化:拦截状态默认开启,跨刷新持续生效。「启用拦截」开关在设置页和徽章
版本兼容矩阵
| DSH 版本 | 状态 | 说明 |
|---|---|---|
dsh@0.1.0-rc.6 | ✅ 兼容 | cordis patch ✅ |
dsh@0.1.0 | ✅ 兼容 | 标准 patch ✅ |
dsh@0.2.0 | ⚠️ 待验证 | 待实测(API 可能在变) |
dsh@0.3.0+ | ❓ 未知 | 尚未发布 |
💡 兼容矩阵每周末自动跑实测,欢迎 PR 修正
元数据
- License
- AGPL-3.0
- npm
- @huanlin/dsh-plugin-anti-ads
- Repo
- —
- Engines
{}- Weekly DL
- 0
- Monthly DL
- 0
- dsh.bundle
{"bundle":{"patch":"./cordis.patch.yml"},"client":{"inject":["@deepseek-ai/dsh-client-runtime"],"platform":"web"}}