Introduction

DSH’s web version runs in the browser. Apart from standard function loading, it is subject to network fluctuations, browser cache policies, and connection lifecycle. Common scenarios include silent disconnections when switching to the background on mobile devices, the browser failing to immediately sense a disconnection, and page reloads causing redundant transfers.

dsh-web-network-optimizer addresses these issues by providing connection status indicators, reconnection capabilities, response compression, and browser cache strategies. It is suitable for developers who require a stable DSH Web interface or need to use DSH in environments with weak network connectivity.

What is this

dsh-web-network-optimizer is a DSH plugin maintained by enterhalf and is released under the MIT license. It reduces the amount of data transferred on the web side through caching and compression techniques, while also providing network disconnection indicators and automatic reconnection capabilities.

The dependencies declared by the plugin are:

cordis >=4.0.0-rc <5

Core Features

Connection Guardian

When the page returns to the foreground and every 30 seconds via a heartbeat, the plugin actively probes the real status of the connection. If an old connection is found to be dead, it triggers an automatic recovery.

The small dot on the left of the session title is used to display the connection status:

  • Green: Connection Normal
  • Gray: Checking or Reconnecting
  • Red Pulse: Offline, Abnormal, or Recovering

Clicking the small dot allows for a manual forced reconnection.

Response Compression

The plugin serves Brotli for all compressible responses, using Gzip as a fallback. Behavior remains consistent between local loopback access and remote access.

Browser Cache

Cache policies are distinguished by resource type:

  • /assets/* and favicon use filenames as content hashes. After an update, the URL changes, and Cache-Control: immutable is sent.
  • The plugin client.js uses no-cache and the plugin sends an ETag; it returns 304 when unchanged and updates the content when changed.

The goal of this approach is to reduce redundant transfers while avoiding issues where long-term caching prevents following updates.

Per-Plugin Traffic Ledger

Open:

Settings → Web Network Optimizer Panel

You can view the current load and cumulative traffic, compression savings, and cache hit status for each plugin.

Cache Self-Check

When you suspect the browser cache is not keeping up with updates, the “Cache Self-Check” panel in the settings provides a one-click guide to copy the DevTools menu operation for manually clearing the cache.

Installation and Uninstallation

Install the plugin:

dsh plugin --profile web add dsh-web-network-optimizer@latest

Uninstall the plugin:

dsh plugin --profile web remove dsh-web-network-optimizer

When uninstalling, the route wrapper is fully restored; the ledger file is retained in:

~/.dsh/storages/dsh-web-network-optimizer/

Orphaned cache is automatically reclaimed by the browser quota.

For local development installation, you can use the directory path:

dsh plugin --profile web add /path/to/dsh-web-network-optimizer

Typical Usage

  1. After installation, open the DSH Web interface, check the small dot on the left of the session title to confirm the connection status.
  2. If you suspect the connection is stuck, click the small dot to perform a manual forced reconnection.
  3. Go to:
Settings → Web Network Optimizer Panel

View the traffic ledger to confirm current load, cumulative traffic, compression savings, and cache hits.
4. If the page content is not updated, open the “Cache Self-Check” panel, copy the DevTools menu operation, and execute it once in the browser.

Applicable Scenarios and Notes

This plugin is suitable for two types of scenarios:

  • Want to reduce redundant transfers on the DSH web side and lower page load overhead.
  • Use in environments with unstable networks where disconnections are common, such as when mobile devices switch to the background.

Pre-use notes:

  • The plugin runs with the permissions of the current dsh process; check the source code, dependencies, and MIT license before installing.
  • immutable is only used for /assets and favicon that include hashes in their filenames; client.js uses no-cache + ETag to prevent the browser from ceasing to make requests due to immutable.
  • In extreme scenarios, such as browser caching anomalies or proxy rewriting, old content may still remain, requiring manual clearing of the browser cache following the guidance in the panel.

Conclusion

dsh-web-network-optimizer addresses the two common issues of “invisibility of disconnection” and “redundant transfers” in the DSH web interface under a unified framework: connection status is visible, disconnection is recoverable, and cache and compression strategies are inspectable.

GitHub Repository:

https://github.com/enterhalf/dsh-web-network-optimizer

The directory page URL has not been confirmed in the verified materials; it is recommended to rely on the GitHub repository and plugin package information.