Skip to content

HuanLinOTO/dsh-plugin-anti-ads

70Last commit Aug 15, 2026

dsh-plugin-anti-ads DSH plugin

dsh-anti-ads is a plugin that intercepts advertisements from the dsh-ads plugin in DSH Web UI. It employs four independent layers of defense (L1-L4) to block ads via settings override, DOM mutation observation, request interception, and event broadcasting. A shield badge shows the number of blocked pop-ups and provides quick access to settings.

How to install the dsh-plugin-anti-ads DSH plugin

dsh plugin --profile web add @huanlin/dsh-plugin-anti-ads

Copying does not run this command. Review the repository and version before installing the dsh-plugin-anti-ads DSH plugin.

dsh-plugin-anti-ads DSH plugin data source

dsh-plugin-anti-ads DSH plugin snapshot date: Aug 16, 2026

discovered

What the dsh-plugin-anti-ads DSH plugin can do

  • L1: Overrides dsh-ads settings via localStorage to disable all ad slots and listens for persist-changed events to maintain suppression.
  • L2: Uses MutationObserver to detect and remove leaked pop-ups based on shape (position:fixed + z-index range or full-screen overlay).
  • L3: Intercepts requests to /dsh-ads/registry.json (including query variants) and returns an empty list, blocking dynamic ad sources.
  • L4: Broadcasts the dsh-ads:retired event to hide the entire ad layer until page refresh, acting as a master switch independent of other layers.
  • Persistent: Ad blocking is enabled by default across refreshes; can be toggled via settings or badge panel, which restores default ad settings when disabled.

Where the dsh-plugin-anti-ads DSH plugin fits

  • Block all ad pop-ups, banners, and in-stream ads from dsh-ads in DSH Web UI.
  • Prevent community plugins from injecting automatic banners via dsh-ads registry.
  • Clean up leaked ad elements that bypass dsh-ads settings due to future updates.
  • Provide a single toggle to instantly hide all ads (including those not yet rendered) via L4 broadcast.
  • Monitor ad blocking activity with a visible shield badge that counts intercepted pop-ups.

Who the dsh-plugin-anti-ads DSH plugin is for

  • DSH Web UI users who have installed the dsh-ads plugin and want to remove its advertisements.
  • Users who prefer a non-intrusive, configurable ad blocker that works solely within the DSH ecosystem.

dsh-plugin-anti-ads DSH plugin limitations

  • Only targets the dsh-ads plugin; has no effect on other ad sources or if dsh-ads is not installed.
  • L1 may temporarily fail to suppress manually re-enabled ad slots until the next page refresh; L2/L4 handle most cases except in-stream ads without DOM features.
  • L4's retired broadcast is irreversible; if triggered, the ad layer only returns after a page refresh.
  • dsh-ads updates may change protocols or shapes, potentially reducing L2/L3 effectiveness, though L1 and L4 provide fallback.

dsh-plugin-anti-ads DSH plugin: from the repository README

Quoted from the HuanLinOTO/dsh-plugin-anti-ads README, the upstream source of the dsh-plugin-anti-ads DSH plugin. Copyright remains with the original authors.

> 📌 本插件已收录于 [dshfind](https://dshfind.com/zh) 插件超市,点击上方徽章直达主页。 # dsh-anti-ads [![npm version](https://img.shields.io/npm/v/@huanlin/dsh-plugin-anti-ads)](https://www.npmjs.com/package/@huanlin/dsh-plugin-anti-ads) 给 DSH Web UI 安装的广告拦截器——拦截对象只有 [dsh-ads](https://github.com/dsh-external/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-ads 的设置恢复为默认。注意:L4 广播的「本次关闭」是 dsh-ads 刻意做成不可撤销的,若已广播过,广告层要刷新页面才会回来。 **一个已知边界**:dsh-ads 的持久化层有内存镜像,用户若在 dsh-ads 自己的设置页手动打开过某个广告位,L1 要到下次刷新才重新生效;期间由 L2 兜底清理浮层,L4 的广播也能把整个层压下

Read the full READMERepository license: NOASSERTION

dsh-plugin-anti-ads DSH plugin questions

Why does the shield badge not appear after installing dsh-anti-ads?

The shield badge only appears when dsh-ads is also installed and active. dsh-anti-ads is designed exclusively to block ads from dsh-ads; without dsh-ads, the plugin has no effect and the badge remains hidden. Ensure you have installed dsh-ads first (install via its own dsh plugin command) and then refresh the page.

How do I temporarily disable ad blocking without uninstalling the plugin?

You can toggle ad blocking off via the settings page (in the settings dialog) or by clicking the shield badge and using the panel switch. Turning off the main switch will restore dsh-ads to its default ad settings and stop all four layers of defense. Note that L4's retired broadcast is irreversible; if you disable blocking after it has been triggered, you may need to refresh the page to see ads again.

Will dsh-anti-ads block ads from other plugins or external sources?

No. dsh-anti-ads is specifically designed to block only the dsh-ads plugin's advertisements. It does not interfere with any other DSH plugins, external ads, or website content. Its scope is limited to the dsh-ads ecosystem, including its registry requests and DOM elements.

What happens if dsh-ads updates and changes its internal structure?

The plugin uses four independent layers of defense. If dsh-ads changes its settings keys or event names, L1 may become less effective, but L2 (MutationObserver) and L3 (request interception) will still catch most new ad elements. L4 (retired broadcast) is a broad stroke that can hide the entire ad layer regardless of structure. The plugin is designed to be resilient, but in extreme cases, a refresh may be needed to restore full functionality.

Can I manually re-enable a specific ad slot that I want to see?

If you manually open a specific ad slot via dsh-ads' own settings, L1 will not be able to re-suppress it until the next page refresh. However, L2 will still clean up any pop-ups that appear, and L4 can hide the entire layer. The in-stream ad (without DOM features) might briefly show. To avoid this, it's recommended to use the dsh-anti-ads main switch to control blocking globally rather than toggling individual slots.