Introduction

In the DSH Web environment, restarting the service can often cause the connection to be interrupted, whether the restart is triggered by an Agent or performed manually. Users then need to initiate a new session to regain context. The dsh-restart-progress plugin solves this experience gap. It uses an in-page overlay, a detached restart script, and an automatic reporting mechanism to make the service restart process fully visible, automatic, and recoverable.

Core Features

This plugin includes the following core capabilities:
* Show overlay in advance: At the moment the restart script is executed (before the service disconnects), a full-screen loading overlay appears within 2 seconds and waits for the service to recover.
* Auto refresh: After the service recovers and the restart task completes its final steps, the page automatically refreshes back to DSH.
* Auto report: After the restart completes, the script automatically sends a “Restarted” message to the session that initiated the restart, waking up the Agent.
* Exit anytime: The top-right corner of the overlay provides an ✕ button, or you can press Esc, to immediately exit the overlay and stop auto refresh.
* Prevent infinite loop: The page refreshes only when both conditions are met: “service online + restart task finalization completed”.
* Detached execution: Uses Windows Task Scheduler to perform the actual kill-old and start-new actions, detached from the DSH process tree, preventing Agent scripts from being accidentally killed.

Installation and Enablement

First install the plugin using the official command, then restart DSH Web to verify the injection status.

dsh plugin --profile web add "github:SMWHff/dsh-restart-progress"

After installation, restart DSH Web. Check the browser console (F12) for the following message, indicating that the plugin has been injected:

[dsh-restart-progress] armed (poll every 2s)

Configuration

After installation, you need to copy the script locally and modify the hardcoded paths to match your environment.

  1. Copy scripts/restart-dsh-web.ps1 to the ~/.dsh/scripts/ directory.
  2. Open the script and modify the following variables:
    • $logDir: Directory for logs and flag files (default C:\Users\SMWHff\.dsh\logs).
    • $env:DSH_HOME: DSH data directory (default C:\Users\SMWHff\.dsh).
    • $node: Actual path to node.exe.
    • $bin: Actual path to dsh bin.js.
    • -WorkingDirectory: Working directory for startup.

Usage

The restart script supports two trigger methods: Agent-triggered and manual terminal-triggered.

  • Triggered by Agent within a session (recommended):
    The Agent executes the following command. The script will inherit DSH_SESSION_ID and automatically notify that session after the restart completes.
    & ~/.dsh/scripts/restart-dsh-web.ps1
  • Manually triggered from a terminal:
    Execute the same command in any terminal. In this case, if DSH_SESSION_ID is not present, it will only perform the restart and display the overlay, without sending a notification.

Notes

  • Platform limitation: Only Windows 10/11 is supported.
  • Path configuration: You must modify the hardcoded variables in the script according to your actual installation path; otherwise, the restart task cannot be executed.
  • Exit mechanism: Exiting with Esc or ✕ only affects the current round; the next restart will display the overlay normally.
  • Encoding issue: In Windows PowerShell 5.1, there are GBK encoding compatibility issues. The script handles Chinese text using base64; do not modify the script encoding arbitrarily.