在 dsh 页面添加一个国内金价悬浮窗

Preface

DSH’s philosophy is “Everything is a plugin.” When running tasks on the same dsh page daily, you often need to check gold prices: looking at domestic spot, checking deferred varieties, and comparing them with London Spot. The traditional approach is to switch to a financial website or another browser window, cross-reference back and forth, and then return to the page to continue working. eastbadman/dsh-gold-price turns this into a draggable floating window within the page: market data refreshes in real-time, the position can be fixed in a convenient spot, and there is no need to repeatedly switch windows.

Below introduces the positioning, features, installation method, and operation principles of this plugin.

What is this

eastbadman/dsh-gold-price is a DeepSeek Harness (dsh) plugin, maintained by eastbadman, belonging to the “Online Tools” category in the community directory. It solves the problem of directly displaying domestic gold market data within a dsh page, including Shanghai Gold Exchange Au99.99, Gold Deferred, Gold Bar 100g, and London Spot comparison.

The plugin is published with the package name dsh-gold-price, version 1.0.0, requires a Node engine >=20, and has a license of MIT.

Core Features

The plugin renders a floating window in the dsh page, with the main capabilities as follows:

  • Three Domestic Varieties: Shanghai Gold Exchange Au99.99 (SGE Au99.99 Spot), Gold Deferred (Au T+D), and Gold Bar 100g, in units of Yuan/gram, with gains/losses calculated based on yesterday’s settlement price.
  • London Spot Comparison: USD/oz.
  • Red Up, Green Down: According to domestic market conventions, red/green flashing indicators appear with every price change.
  • 30-Minute Trend Line: For Au99.99, accumulated data is plotted while the page is open.
  • 20-Second Auto-Refresh: Pauses when the page is hidden and refreshes immediately upon returning to the foreground.
  • Draggable, Memorable: Drag by the title bar, position is saved to localStorage, and it remains in the same place next time it opens; can be collapsed into a small bar.

Data comes from Sina Finance public interfaces (Shanghai Gold Exchange / London Spot) and is for reference only and does not constitute investment advice. During market closure, the last closing price is displayed, and the market time is annotated. If the interface adjusts, the panel will show a fetch failure and retain the last cached value.

Installation & Enablement

Installation is done via the dsh plugin command, requiring a specified profile:

dsh plugin --profile <profile> add dsh-gold-price

It can also be installed directly from GitHub:

dsh plugin --profile <profile> add https://github.com/eastbadman/dsh-gold-price

No need to restart after installation, HMR takes effect; if the floating window does not appear, refresh the page once.

Typical Usage

The plugin has no additional configuration items; the floating window appears on the dsh page after installation. The daily usage is simply to view it directly:

  1. Open the dsh page and confirm the floating window has appeared.
  2. Compare the Yuan/gram quotes for the three domestic varieties with the USD/oz quote for London Spot.
  3. Drag to a convenient position by holding the title bar when needed; the position will be remembered automatically.
  4. Collapse into a small bar when not in use, without affecting other page operations.

Behind the scenes, two parts are collaborating:

  • Host Side (Node) fetches public market data from hq.sinajs.cn on demand, with Referer, 15-second cache, and no background requests when idle; then exposes the same-origin route /gold-price/ticker.json via webServer.register().
  • Client Side registers to the shell.overlay slot to render the floating window, polls the same-origin route mentioned above, and produces no cross-origin requests; all styles use dsh host theme tokens.

The Sina market interface requires the Sina domain as Referer and does not return CORS headers, so direct browser connection is not feasible. Therefore, scraping is done on the Node side, and then passed to the frontend via the same-origin route. This is the main technical trade-off of this plugin.

Use Cases & Notes

Suitable for developers and individual users who need to frequently check domestic gold prices within the dsh page, especially in scenarios where they don’t want to switch windows or interrupt current tasks.

A few points to note:

  1. The plugin runs with the permissions of the current dsh process; please check the source code and license before installing (this plugin is MIT).
  2. Market data is for reference only and does not constitute investment advice.
  3. The data source depends on the Sina Finance public interface. If the interface adjusts, the panel will show a fetch failure and retain the last cached value.
  4. package.json declares dsh.bundle.patch pointing to ./cordis.patch.yml. The installation method follows the standard dsh plugin channel and does not involve manually modifying the host.

Conclusion

The value of this plugin lies in converging gold price queries within the dsh page, eliminating the need for separate windows, while using a same-origin route to bypass the Sina market interface’s CORS restrictions. The directory page is at https://www.skillhub.cn/plugins/eastbadman/dsh-gold-price, and the source code is at https://github.com/eastbadman/dsh-gold-price.

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

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

Xiaoye