dsh-deepseek-theme-studio 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -395,3 +395,48 @@ window.dshThemeStudio.formatSelfCheck()
395
395
 
396
396
  `verify-tokens.mjs` 刻意比参考实现更严格:抓不到宿主 CSS 或运行实例时**非零退出**,
397
397
  不会像 `mux9056-bot/dsh-theme` 的 `verify:live` 那样在抓取失败后仍然打印"校验通过"。
398
+
399
+
400
+ ---
401
+
402
+ ## 发布(维护者)
403
+
404
+ 发布不需要任何 token、不需要验证码。npm 侧的凭据是通过 **trusted publishing(OIDC)** 建立的:
405
+ `.github/workflows/publish.yml` 用一次性的、限定到本工作流的 OIDC 令牌换发布权,所以没有长期凭据可泄露、也没有东西需要轮换。
406
+
407
+ 流程就三步:
408
+
409
+ ```powershell
410
+ # 1. 改版本号(构建会把版本号注入 lib/client.js,所以必须重新构建)
411
+ node -e "const f='package.json',p=require('./'+f);p.version='0.1.2';require('fs').writeFileSync(f,JSON.stringify(p,null,2)+'\n')"
412
+ node scripts/build.mjs
413
+
414
+ # 2. 提交
415
+ git add -A; git commit -m "Release 0.1.2"
416
+
417
+ # 3. 打附注 tag 并推送(工作流由 tag 触发)
418
+ git tag -a v0.1.2 -m "v0.1.2"
419
+ git push origin main; git push origin v0.1.2
420
+ ```
421
+
422
+ 然后工作流会自动:校验 bundle 与 `src/` 同步 → 工厂冒烟测试 → 校验 tag 与 `package.json` 版本一致 → 发布并生成 SLSA provenance。
423
+
424
+ **两个容易踩的坑**(都实际踩过):
425
+
426
+ - **必须重新构建再提交。** `scripts/build.mjs` 会把版本号写进 bundle(头部注释和 `createPluginBody({ version })`),只改 `package.json` 不动 bundle 会导致工作流第一步就失败 —— 这是门禁在起作用,不是 bug。
427
+ - **必须用附注 tag(`git tag -a`),且显式推送 tag。** 轻量 tag 配 `git push --follow-tags` **不会**被推上去,工作流根本不会触发。
428
+
429
+ ### 首次发布为什么更麻烦
430
+
431
+ 新包没有包设置页,所以配不了 trusted publisher —— 得先有一次带 2FA 的发布把包建出来。当时用的是
432
+ `npm stage publish` + 网页批准(分阶段发布对尚未存在的包会先发一个 `0.0.0-stage` 占位版本)。
433
+ 包一旦存在,就可以用下面这条命令配置 trusted publisher:
434
+
435
+ ```sh
436
+ npm trust github <package> --file publish.yml --repository <owner>/<repo> --allow-publish -y
437
+ ```
438
+
439
+ 这条命令需要交互式 2FA:它会在浏览器里打开验证页(用安全密钥也行),**必须在真实终端里跑** ——
440
+ 管道或后台任务里没有 TTY,npm 会直接抛 `EOTP` 而不打开浏览器。
441
+
442
+ 配置好后用 `npm trust list <package>` 查看(同样需要 2FA)。
package/lib/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * dsh-deepseek-theme-studio v0.1.1 — client bundle (GENERATED by scripts/build.mjs; edit src/ instead).
2
+ * dsh-deepseek-theme-studio v0.1.3 — client bundle (GENERATED by scripts/build.mjs; edit src/ instead).
3
3
  *
4
4
  * DeepSeek 官网视觉语言的 DSH Web 主题:毛玻璃 / 液化(流体) / 量子化(Q1-Q4)。
5
5
  *
@@ -5087,7 +5087,7 @@ function createPluginBody(ctx, options = {}) {
5087
5087
  */
5088
5088
  function apply(ctx) {
5089
5089
  if (typeof document === 'undefined' || typeof window === 'undefined') return
5090
- var body = createPluginBody(ctx, { version: '0.1.1' })
5090
+ var body = createPluginBody(ctx, { version: '0.1.3' })
5091
5091
  if (ctx !== undefined && ctx !== null && typeof ctx.effect === 'function') {
5092
5092
  ctx.effect(() => {
5093
5093
  try {
package/lib/index.js CHANGED
@@ -50,6 +50,20 @@ export function statePath() {
50
50
  return join(home, STATE_FILENAME)
51
51
  }
52
52
 
53
+ /**
54
+ * Where the parameter file lives, in a form that is safe to put on the page.
55
+ *
56
+ * The absolute path embeds the local account name (`C:\Users\<name>\.dsh\…`),
57
+ * and this string is rendered in the settings row — from where it lands in
58
+ * every screenshot a user shares. `$DSH_HOME/…` says the same thing, is
59
+ * shorter, and carries nothing machine-specific. The real path is still used
60
+ * inside the process; it just never crosses the wire.
61
+ */
62
+ export function displayPath() {
63
+ const home = process.env.DSH_HOME && process.env.DSH_HOME.length > 0 ? process.env.DSH_HOME : null
64
+ return home === null ? `~/.dsh/${STATE_FILENAME}` : `$DSH_HOME/${STATE_FILENAME}`
65
+ }
66
+
53
67
  /**
54
68
  * Read the state object.
55
69
  *
@@ -258,7 +272,7 @@ async function handleApi(req, res, trustedHosts) {
258
272
  // GET is a convenience for humans and for `curl`; the client uses POST.
259
273
  if (req.method === 'GET') {
260
274
  const current = readState()
261
- writeJson(res, 200, { ok: true, value: current.value, fileError: current.error, revision, path: statePath() })
275
+ writeJson(res, 200, { ok: true, value: current.value, fileError: current.error, revision, path: displayPath() })
262
276
  return
263
277
  }
264
278
  if (req.method !== 'POST') {
@@ -284,7 +298,7 @@ async function handleApi(req, res, trustedHosts) {
284
298
 
285
299
  if (payload.method === 'get') {
286
300
  const current = readState()
287
- writeJson(res, 200, { ok: true, value: current.value, fileError: current.error, revision, path: statePath() })
301
+ writeJson(res, 200, { ok: true, value: current.value, fileError: current.error, revision, path: displayPath() })
288
302
  return
289
303
  }
290
304
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-deepseek-theme-studio",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "DeepSeek 官网视觉语言的 DSH Web 主题工作台:毛玻璃 / 液化(流体) / 量子化(Q1-Q4) 三类效果,全部参数可调、可持久化、可程序化调用。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "manifestVersion": 1,
38
38
  "compatibility": {
39
+ "dsh": ">=0.2.0-rc.2 <0.3.0-0",
39
40
  "dshReleases": {
40
41
  "0.2.0-rc.2": "compatible"
41
42
  }
@@ -54,7 +55,8 @@
54
55
  "verify": "node scripts/build.mjs --check && node scripts/verify-tokens.mjs"
55
56
  },
56
57
  "engines": {
57
- "node": ">=18"
58
+ "node": ">=18",
59
+ "dsh": ">=0.2.0-rc.2 <0.3.0-0"
58
60
  },
59
61
  "repository": {
60
62
  "type": "git",