Skip to content

Releases: faith372/dsh-account-glance

v1.5.0 — holiday-aware billing clock (v4-pro keeps its own price row)

Choose a tag to compare

@faith372 faith372 released this 25 Oct 01:43

1.5.0 — holiday-aware billing clock, and v4-pro keeps its own row

Statutory holidays bill as whole off-peak days

DeepSeek's off-peak schedule treats every Chinese public holiday as an off-peak day. The clock now
carries that calendar, and the card's badge / countdown and the ledger's cost column read the same
table, so they can never disagree.

  • 2026 is quoted from the State Council notice (国办发明电〔2025〕7号).
  • 2027 is derived — the statutory dates follow the lunar calendar (除夕 02-06, 正月初一 02-07,
    端午 06-09, 中秋 09-15) and the bridge days follow the 2025/2026 pattern. It is a provisional set and
    will be replaced when the official notice lands (the 2026 one arrived 2025-11-04).

The countdown also skips holidays when it looks for the next peak window.

Per-profile holiday override — a new year needs no release

Drop a file at <DSH_HOME>/account-glance/holidays.json:

{ "holidays": ["2027-01-01", "2027-02-05"] }
  • additive by default (merged into the built-in table when the row starts);
  • { "replace": true, "holidays": [...] } swaps the built-in table out — the file then has to list every
    date you still need, including years the package already ships;
  • an unreadable or malformed file is ignored, so a bad calendar can only fall back to the weekday rule —
    it never breaks the clock.

The host serves the effective calendar to the browser (billing.holidays in the overview), which is how
the badge and the priced ledger stay in step even with an override in play.

v4-pro keeps its own price row

deepseek-v4-pro used to fold into the flash row after the retirement instant. It now bills on its own
published row whenever it actually runs. The flash and pro tables themselves are unchanged.

Packaging

  • assets/ now ships with the package, so the README screenshot resolves on npm too.
  • react is declared an optional peer (peerDependenciesMeta), matching the fact that DSH serves it
    from the frozen platform module table.

Upgrading

The clock and price book live in the host half, so restart DSH (or toggle this row off and on in the
Plugins page) and refresh the page once. Coming from 1.3.x is the same step — 1.4.0 introduced the host
half.

Tests

npm test

The client suite now runs 8 clock cases (holidays and the shipped calendar included); the host suite
adds the holiday calendar, the derived 2027 dates, the override in merge / replace / malformed form, and
the pro price row.

v1.4.0 — self-contained host half (own balance probe + usage ledger)

Choose a tag to compare

@faith372 faith372 released this 10 Oct 02:26

1.4.0 — the card now carries its own host half

Before: the balance probe and today's usage totals both came from
@linxin666/dsh-usage. A profile that installed only this plugin showed
"today's usage unavailable" on line 3 and had no probe for line 1.

Now: the needed parts are folded into this plugin's own host half, so nothing
else has to be installed.

Host half (new)

  • lib/host/probe.js — probes DeepSeek's official GET /user/balance with the key
    resolved from the DSH credential store (pi-ai record → configured env reference →
    ambient env). Keeps the foreign-origin guard (a route pointed at a reseller is
    reported as unsupported rather than probed with the official endpoint), forces
    accept-encoding: identity for the host's undici quirk, 10 s deadline, and turns
    401 / empty / malformed answers into a flagged row instead of a crash.
  • lib/host/ledger.js — folds session/event usage reports into a persistent
    per-day ledger keyed by Beijing date, with retention pruning, untrusted-JSON
    revival and the prototype-key guard.
  • lib/host/pricing.js — the published CNY peak / off-peak price book and the
    Beijing billing clock. Only DeepSeek official routes are priced; every other
    route counts tokens and calls at cost 0.
  • lib/host/service.js — poll loop (60 s), session subscription, atomic
    persistence at <DSH_HOME>/account-glance/ledger.json, 180-day retention.
  • lib/host/routes.js — api/dsh-account-glance/overview and .../refresh behind
    the loopback / paired-device fence.
  • lib/client.js — reads its own route first, falls back to dsh-usage's overview on
    404, and the "usage unavailable" line now explains itself on hover.

Requirements

@linxin666/dsh-usage is now optional: install it and nothing breaks — this card
still prefers its own route, dsh-usage's glance card stays hidden, and its settings
and usage pages keep working. No new dependencies, still no build step.

Upgrading

The host half is new, so the plugin row must remount once: restart DSH (or toggle
the row off/on in the Plugins page), then refresh the page.

Tests

npm test    # node test/verify.mjs && node test/host-verify.mjs

Both suites run offline. The new host suite covers the clock and price book, the
ledger, credential resolution and probe shapes, the foreign-origin guard, session
folding, the route fence, persistence across a restart, and the entry point.

Attribution

lib/host/* and lib/index.js are adapted from @linxin666/dsh-usage v0.4.4
(Apache-2.0). See THIRD-PARTY-NOTICES.md
and LICENSE-APACHE.