dsh-lan-loopback-compat: Keeping Browser Connections Available for LAN-Accessed DSH Instances

Introduction

When the DeepSeek Harness (DSH) client determines “whether to open locally,” it relies on connection.isLoopback. When a DSH instance is accessed through a reverse proxy or LAN forwarding, this flag evaluates to false, causing certain local-assumption checks at the connection layer to fail — manifesting as connection errors or rejections. This plugin forces the client to set that flag to true, provided the host has explicitly declared that it is operating under a LAN proxy.

What This Is

dsh-lan-loopback-compat is a DSH plugin maintained by jipika, categorized under admin-security. It does not modify the host side; instead, it alters the client-side isLoopback determination on dsh-client-connection, treating connections arriving via a LAN proxy as loopback, so that DSH instances accessed over the local network or a tunnel retain a working browser connection.

Core Functionality

The plugin is implemented in the client-side client.js:

// client.js — full logic
if (globalThis.__DSH_LAN_PROXY__ !== true || ctx.connection === undefined) return;
ctx.connection.isLoopback = true;
globalThis.__DSH_LAN_COMPAT_PLUGIN__ = true;
  • It only activates when globalThis.__DSH_LAN_PROXY__ === true; if the condition is not met, nothing is touched at all.
  • It listens to the connection/reset event and re-applies the flag after a connection is rebuilt (otherwise the mark would be lost on reconnect).
  • It sets globalThis.__DSH_LAN_COMPAT_PLUGIN__ = true as self-confirmation that the plugin is active.
  • The host-side index.js contains an empty apply(); it exists solely so that the cordis line can mount the client bundle.

Installation & Activation

Choose either of the two installation methods (both add an entry to the profile’s dependencies, followed by a single insert configuration):

# ① npm (via registry)
dsh plugin --profile <profile> add dsh-lan-loopback-compat

# ② GitHub (source install, tracks main branch)
dsh plugin --profile <profile> add github:jipika/dsh-lan-loopback-compat

Add the following to the profile’s cordis.patch.yml:

# ~/.dsh/profiles/<profile>/cordis.patch.yml
- insert:
    - id: dsh-lan-loopback-compat
      name: dsh-lan-loopback-compat

__DSH_LAN_PROXY__ is injected externally (by the proxy page or a startup script); this plugin does not set it. Modifying the client side requires an application restart.

Typical Usage

  1. Set the global flag in the proxy page or startup script:
   globalThis.__DSH_LAN_PROXY__ = true;
  1. Install and enable the plugin.

  2. Access the DSH instance via LAN or tunnel — the browser connection remains available.

Use Cases & Caveats

  • Ideal for scenarios where a DSH instance is accessed through a LAN proxy or tunnel.
  • The plugin directly rewrites the isLoopback property on the client-side service object, relying on this internal convention. If upstream changes the property to a getter or a protected attribute, this approach will silently stop working.
  • It depends on the connection/reset event name.
  • Security note: this plugin does not expose the instance to the LAN by itself — it only takes effect when an external declaration confirms the LAN proxy context. Actual access control remains the responsibility of DSH’s authentication layer.
  • The desktop profile is exclusively owned by Electron (CLI subcommands will be rejected); manual edits to package.json + pnpm install are required.

Conclusion

This plugin solves the problem of browser connection failures when accessing DSH instances over a LAN or tunnel by marking LAN-proxy connections as loopback on the client side. For further details, refer to the project homepage and source code.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye