dsh-mpkg-wallpaper 3.5.2 → 3.5.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.
Files changed (2) hide show
  1. package/lib/index.js +13 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1074,7 +1074,19 @@ function apply(ctx) {
1074
1074
  const client = await fetchRaw('lib/client.js');
1075
1075
  const index = await fetchRaw('lib/index.js');
1076
1076
  if (!client.includes('dsh-mpkg-wallpaper') || !index.includes('dsh-mpkg-wallpaper')) { json(res, 400, { ok: false, error: 'invalid payload' }); return; }
1077
- writeFileSync(new URL('./client.js', dir), client, 'utf8');
1077
+ // ①(修正) id 适配:仓库 client.js 注册 id=dsh-mpkg-wallpaper;本地 @local 安装
1078
+ // 时 cordis 以 @local/dsh-mpkg-wallpaper 引用,DSH 期望注册同名 id——直接覆盖
1079
+ // 会导致 loaded without registering → dsh 启动崩溃(用户实测:点"从本插件更新"
1080
+ // 后崩溃)。写回前按**当前 client.js 的 id** 调整(本地是 @local 就替换成 @local)。
1081
+ let clientOut = client;
1082
+ try {
1083
+ const curSrc = readFileSync(new URL('./client.js', dir), 'utf8');
1084
+ const curId = /id:\s*"([^"]+)"/.exec(curSrc);
1085
+ if (curId && curId[1] && curId[1] !== 'dsh-mpkg-wallpaper') {
1086
+ clientOut = clientOut.replace(/id:\s*"dsh-mpkg-wallpaper"/, 'id: "' + curId[1] + '"');
1087
+ }
1088
+ } catch { /* 读当前 id 失败则保持仓库 id */ }
1089
+ writeFileSync(new URL('./client.js', dir), clientOut, 'utf8');
1078
1090
  writeFileSync(new URL('./index.js', dir), index, 'utf8');
1079
1091
  // 同步更新 package.json 版本号(让"更新到 vX"名副其实)
1080
1092
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mpkg-wallpaper",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "DSH Web 壁纸引擎 Wallpaper Engine mpkg 背景插件:浏览器内直接解析 .mpkg(preview.gif 动态背景/内嵌 mp4 视频/多时段切换),整屏统一虚化/对话框/弹层/遮罩独立虚化、镜头缩放平移、时钟、冲突检测。",
5
5
  "private": false,
6
6
  "type": "module",