dsh-mpkg-wallpaper 3.3.1 → 3.3.2
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/lib/client.js +145 -36
- package/lib/index.js +12 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1427,10 +1427,12 @@ window.__ModuleLoader__.load({
|
|
|
1427
1427
|
wrap.style.setProperty("--mpw-lensY", String(section.lensY !== void 0 ? section.lensY : 0) + "px");
|
|
1428
1428
|
wrap.classList.toggle("mpw-sharp", section.sharp !== void 0 ? !!section.sharp : DEFAULT_SHARP);
|
|
1429
1429
|
// ⑯ 磨砂模糊条 → 壁纸层 blur(0 = 完全清晰)。
|
|
1430
|
-
// ①(修正) 壁纸 blur
|
|
1431
|
-
// - 统一虚化开 + chatFollow 开 → unifyAmount
|
|
1432
|
-
//
|
|
1433
|
-
//
|
|
1430
|
+
// ①(修正) 壁纸 blur 归谁管(用户澄清:chatFollow=聊天区跟随整屏虚化):
|
|
1431
|
+
// - 统一虚化开 + chatFollow 开 → unifyAmount 接管**壁纸层 blur**
|
|
1432
|
+
// (聊天区也跟随整屏虚化)
|
|
1433
|
+
// - 统一虚化开 + chatFollow 关 → **壁纸层 blur 由磨砂条控制(聊天区
|
|
1434
|
+
// 不跟随)**;侧边栏/标题栏的虚化由 buildCss 的 backdrop blur
|
|
1435
|
+
// (unifyAmount) 单独提供(见 G 块)
|
|
1434
1436
|
// - 统一虚化关 → 磨砂条控制
|
|
1435
1437
|
const unifyTintApply = section.unifyTint !== void 0 ? !!section.unifyTint : DEFAULT_UNIFY_TINT;
|
|
1436
1438
|
const chatFollowApply = section.chatFollow !== void 0 ? !!section.chatFollow : DEFAULT_CHAT_FOLLOW;
|
|
@@ -1456,6 +1458,7 @@ window.__ModuleLoader__.load({
|
|
|
1456
1458
|
else document.body.removeAttribute("data-mpw-sblur");
|
|
1457
1459
|
} catch {}
|
|
1458
1460
|
try { setupSblurObserver(); } catch {}
|
|
1461
|
+
try { setupHeaderBlurWatch(); } catch {}
|
|
1459
1462
|
try { setupAquaThemeWatch(); } catch {}
|
|
1460
1463
|
// ①(新) 主题颜色:body 门控 + CSS 变量(控制侧边栏/标题栏/新会话/设置弹窗底色)
|
|
1461
1464
|
try {
|
|
@@ -1973,8 +1976,8 @@ window.__ModuleLoader__.load({
|
|
|
1973
1976
|
// ①(新) 侧边栏磨砂(Aqua 方案:sidebarCol 自身 backdrop-filter)
|
|
1974
1977
|
const sidebarBlur = section.sidebarBlur !== void 0 ? !!section.sidebarBlur : DEFAULT_SIDEBAR_BLUR;
|
|
1975
1978
|
const sidebarBlurAmount = section.sidebarBlurAmount !== void 0 ? section.sidebarBlurAmount : DEFAULT_SIDEBAR_BLUR_AMOUNT;
|
|
1976
|
-
// ②(修正) chatFollow
|
|
1977
|
-
//
|
|
1979
|
+
// ②(修正) chatFollow(统一虚化开时聊天区是否跟随整屏虚化):关 → 聊天区
|
|
1980
|
+
// 壁纸由磨砂条控制,侧边栏/标题栏虚化由 G 块 backdrop blur(unifyAmount) 提供
|
|
1978
1981
|
const chatFollowInCss = section.chatFollow !== void 0 ? !!section.chatFollow : DEFAULT_CHAT_FOLLOW;
|
|
1979
1982
|
// ②(新) 弹层虚化(菜单/提示/遮罩)独立于对话框虚化
|
|
1980
1983
|
const popoverBlur = section.popoverBlur !== void 0 ? !!section.popoverBlur : DEFAULT_POPOVER_BLUR;
|
|
@@ -2201,12 +2204,16 @@ ${frostedLayers}
|
|
|
2201
2204
|
// ①(修正) 标题栏磨砂。**绝不能给 header 本体加 backdrop-filter**——
|
|
2202
2205
|
// header 有 fixed 子元素(子代理展开面板/后台任务条),backdrop-filter 会成为
|
|
2203
2206
|
// 它们的 containing block,导致面板定位错乱(用户实测 bug)。
|
|
2204
|
-
// ①(修正)
|
|
2205
|
-
//
|
|
2206
|
-
//
|
|
2207
|
-
//
|
|
2207
|
+
// ①(修正) 标题栏雾底与**统一虚化联动**:unify 开 → 标题栏与侧边栏同款
|
|
2208
|
+
// 白雾厚度(U(panel)=sidebarAlpha「侧边栏/标题栏透明度」),两个条
|
|
2209
|
+
// (unifyAmount 壁纸模糊 + sidebarAlpha 白雾)同时作用于标题栏与侧边栏
|
|
2210
|
+
// (用户实测:统一虚化只能控侧边栏,标题栏不变——此前 headerBlurAmount
|
|
2211
|
+
// 与 unify 脱节)。unify 关 → 按「标题栏磨砂程度」条(headerBlurAmount,
|
|
2212
|
+
// 0=透明透出壁纸,拉高=白雾)。
|
|
2213
|
+
// 标题栏内部按钮/logo 白框在 unify 下保持透明(用户此前要求去白框,
|
|
2214
|
+
// 靠 hover 交互态保留可读性)。
|
|
2208
2215
|
const hblurAmt = section.headerBlurAmount !== void 0 ? section.headerBlurAmount : DEFAULT_HEADER_BLUR_AMOUNT;
|
|
2209
|
-
const hdrAlpha = unifyTint ?
|
|
2216
|
+
const hdrAlpha = unifyTint ? U(panel) : Math.max(0, Math.min(100, hblurAmt));
|
|
2210
2217
|
const hdrBg = `color-mix(in srgb, var(--dsw-static-neutral-bluish-950) ${hdrAlpha}%, transparent)`;
|
|
2211
2218
|
css += `
|
|
2212
2219
|
.wSkVaW_header {
|
|
@@ -2443,23 +2450,23 @@ html body[data-mpw-sblur][data-mpw-sblur-off] [class*="sidebarCol"] {
|
|
|
2443
2450
|
}
|
|
2444
2451
|
`;
|
|
2445
2452
|
}
|
|
2446
|
-
// ──
|
|
2447
|
-
// chatFollow 关 → 壁纸层 blur =
|
|
2448
|
-
//
|
|
2449
|
-
//
|
|
2450
|
-
//
|
|
2451
|
-
// backdrop
|
|
2452
|
-
//
|
|
2453
|
-
//
|
|
2454
|
-
//
|
|
2455
|
-
//
|
|
2456
|
-
// 子代理/后台任务名称叠到对话框文字下面)。header 无 backdrop-filter。
|
|
2453
|
+
// ── G. 统一虚化 + 聊天区不跟随:侧边栏/标题栏叠加整屏虚化度 ──
|
|
2454
|
+
// chatFollow 关 → 壁纸层 blur = 磨砂条(聊天区不跟随,用户澄清);
|
|
2455
|
+
// 侧边栏/标题栏的"虚化程度"由这里的 backdrop blur(unifyAmount) 提供——
|
|
2456
|
+
// 调「整屏虚化程度」即可改变它们背后的模糊(用户实测:chatFollow 关时
|
|
2457
|
+
// unifyAmount 只控侧边栏、标题栏不变 → 之前 F 块排除了 header)。
|
|
2458
|
+
// ①(修正) **标题栏 backdrop blur 只在无展开面板时生效**:header 内有
|
|
2459
|
+
// absolute 的子代理/后台任务展开面板(JObwrW_panel),backdrop-filter 会成为
|
|
2460
|
+
// 它们的 containing block → 面板定位错乱、z-index 失效。展开面板出现时
|
|
2461
|
+
// JS 打 data-mpw-header-blur-off 摘除(见 setupHeaderBlurWatch)。
|
|
2462
|
+
// 弹窗打开时 body[data-mpw-sblur-off] 同样摘除(复用侧边栏磨砂机制)。
|
|
2457
2463
|
if (unifyTint && !chatFollowInCss && unifyAmount > 0 && bdSupported) {
|
|
2458
2464
|
css += `
|
|
2459
|
-
/* ── 统一虚化 +
|
|
2460
|
-
|
|
2461
|
-
html body:not([data-mpw-sblur-off]) .pI_x6G_sidebarCol,
|
|
2462
|
-
html body:not([data-mpw-sblur-off]) [class*="sidebarCol"]
|
|
2465
|
+
/* ── 统一虚化 + 聊天区不跟随:侧边栏/标题栏背后叠加整屏虚化度(标题栏展开面板
|
|
2466
|
+
出现时由 data-mpw-header-blur-off 摘除,防困住面板) ── */
|
|
2467
|
+
html body:not([data-mpw-sblur-off]):not([data-mpw-header-blur-off]) .pI_x6G_sidebarCol,
|
|
2468
|
+
html body:not([data-mpw-sblur-off]):not([data-mpw-header-blur-off]) [class*="sidebarCol"],
|
|
2469
|
+
html body:not([data-mpw-sblur-off]):not([data-mpw-header-blur-off]) .wSkVaW_header {
|
|
2463
2470
|
backdrop-filter: blur(${unifyAmount}px) !important;
|
|
2464
2471
|
-webkit-backdrop-filter: blur(${unifyAmount}px) !important;
|
|
2465
2472
|
}
|
|
@@ -2538,10 +2545,21 @@ ${unifyTint ? `body:not([data-ds-dark-theme]) [data-cordis-panel] [class*="row"]
|
|
|
2538
2545
|
[data-sidebar-collapsed] .pI_x6G_sidebarCol { border-right-color: transparent !important; }
|
|
2539
2546
|
[data-sidebar-collapsed] [class*="sidebarCol"] { border-right-color: transparent !important; }
|
|
2540
2547
|
/* 区域5b: 收起后 rail 内部面(logoRow/newSession/footArea)透出模糊壁纸:
|
|
2541
|
-
同样不加 backdrop-filter(root 是弹层祖先,会困住 fixed
|
|
2542
|
-
|
|
2548
|
+
同样不加 backdrop-filter(root 是弹层祖先,会困住 fixed 弹层)。
|
|
2549
|
+
①(修正) 必须限定在 sidebarCol 内——data-sidebar-collapsed 挂在 frame 上,
|
|
2550
|
+
原写法 [class*="root"] 会命中**全应用**所有 class 含 root 的元素
|
|
2551
|
+
(聊天区 todo 卡片等),侧边栏收起时把它们背景强制透明
|
|
2552
|
+
(用户实测:收起时 todo list 变透明,展开恢复)。 */
|
|
2553
|
+
[data-sidebar-collapsed] [class*="sidebarCol"] [class*="root"],
|
|
2554
|
+
[data-sidebar-collapsed] .pI_x6G_sidebarCol [class*="root"] {
|
|
2543
2555
|
background-color: transparent !important;
|
|
2544
2556
|
}
|
|
2557
|
+
/* ②(修正) 收起态悬浮外壳**绝不设 position/z-index**:设置面板(sidebar.settings
|
|
2558
|
+
的 full-viewport fixed overlay,z-index:1000)渲染在 sidebarCol 内,一旦给
|
|
2559
|
+
sidebarCol 设 position:relative + z-index,就创建包含块/层叠上下文 → overlay
|
|
2560
|
+
的 fixed 定位被侧边栏困住,对话框叠在设置上、位置错乱(用户实测:悬浮开 +
|
|
2561
|
+
侧边栏收起时点设置,对话框盖在设置面板上方)。悬浮只做 margin/圆角/边框,
|
|
2562
|
+
层叠交给 DSH 自己(overlay z-index:1000 恒在 rail 内容之上)。 */
|
|
2545
2563
|
`;
|
|
2546
2564
|
}
|
|
2547
2565
|
// ①(修正) 遮罩虚化无条件生效(不依赖是否有壁纸——无壁纸时弹窗遮罩也要模糊,
|
|
@@ -3011,13 +3029,27 @@ body[data-mpw-float] [data-sidebar-collapsed] [class*="sidebarCol"] {
|
|
|
3011
3029
|
border-radius: 12px;
|
|
3012
3030
|
border: 1px solid rgba(19,45,83,0.26);
|
|
3013
3031
|
overflow: visible;
|
|
3014
|
-
position
|
|
3015
|
-
|
|
3032
|
+
/* ②(修正) 不设 position/z-index:设置面板 fixed overlay 在 sidebarCol 内,
|
|
3033
|
+
设了会被困住叠在设置上(见区域5b 注释) */
|
|
3016
3034
|
transition: margin 0.18s ease, padding 0.18s ease, border-radius 0.18s ease, border-color 0.18s ease;
|
|
3017
3035
|
}
|
|
3018
3036
|
body[data-mpw-float] body[data-ds-dark-theme] [data-sidebar-collapsed] .pI_x6G_sidebarCol,
|
|
3019
3037
|
body[data-mpw-float] body[data-ds-dark-theme] [data-sidebar-collapsed] [class*="sidebarCol"] {
|
|
3020
3038
|
border-color: rgba(148,180,220,0.32);
|
|
3039
|
+
}
|
|
3040
|
+
/* ②(修正) 设置面板打开时(data-mpw-float-off,见 setupSblurObserver):悬浮外壳
|
|
3041
|
+
完全让位——sidebarCol 回到 DSH 默认布局(无 margin/padding/圆角/overflow),
|
|
3042
|
+
设置面板 full-viewport fixed overlay 正常全屏,输入框/todo 不再浮到设置面上。
|
|
3043
|
+
悬浮只影响外观,设置面板打开期间不叠加任何布局干扰。 */
|
|
3044
|
+
body[data-mpw-float-off] body[data-mpw-float] .pI_x6G_sidebarCol,
|
|
3045
|
+
body[data-mpw-float-off] body[data-mpw-float] [class*="sidebarCol"] {
|
|
3046
|
+
margin: 0; padding: 0; border: none; border-radius: 0; overflow: visible;
|
|
3047
|
+
}
|
|
3048
|
+
body[data-mpw-float-off] body[data-mpw-float] .wSkVaW_header {
|
|
3049
|
+
margin: 0; padding: 0; border: none; border-radius: 0;
|
|
3050
|
+
}
|
|
3051
|
+
body[data-mpw-float-off] body[data-mpw-float] [data-mpw-sidebar-root] {
|
|
3052
|
+
width: auto !important; background: transparent !important; border-radius: 0;
|
|
3021
3053
|
}` : ""}
|
|
3022
3054
|
/* ③(修正) 弹窗打开时:背后的设置面板只去掉 backdrop-filter(不再让字晕染),
|
|
3023
3055
|
背景保持原来的半透明(透出壁纸)——绝不整体改成深色(会导致设置界面变黑)。
|
|
@@ -3618,12 +3650,17 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
3618
3650
|
setUpdState(d.ok ? d : { error: String(d.error || "fail") });
|
|
3619
3651
|
} catch (err) { setUpdState({ error: String(err && err.message || err) }); }
|
|
3620
3652
|
};
|
|
3621
|
-
// ①(新) 一键热更新(host 从 GitHub
|
|
3653
|
+
// ①(新) 一键热更新(host 从 GitHub 下载最新代码写回;仅限本地开发/可写安装)
|
|
3622
3654
|
const applyUpdate = async () => {
|
|
3623
3655
|
setUpdState({ applying: true });
|
|
3624
3656
|
try {
|
|
3625
3657
|
const r = await fetch(HOST_BASE + "/update-apply", { method: "POST" });
|
|
3626
3658
|
const d = await r.json();
|
|
3659
|
+
// ①(修正) 市场安装(pnpm store 只读)→ host 返回 readonly → 提示走市场更新
|
|
3660
|
+
if (d && d.readonly) {
|
|
3661
|
+
setUpdState({ error: t("update.readonly") });
|
|
3662
|
+
return;
|
|
3663
|
+
}
|
|
3627
3664
|
setUpdState(d.ok ? { applied: true } : { error: String(d.error || "fail") });
|
|
3628
3665
|
} catch (err) { setUpdState({ error: String(err && err.message || err) }); }
|
|
3629
3666
|
};
|
|
@@ -5909,7 +5946,7 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
5909
5946
|
"sec.blur": "界面虚化",
|
|
5910
5947
|
"sec.blur.desc": "各类弹层/面板打开时的背景虚化:对话框(通用居中窗口+聊天输入框)、设置面板、下载确认弹窗各自独立;弹层=菜单/下拉/提示;遮罩=弹层背后的全屏背景;侧边栏磨砂=侧边栏自身玻璃化",
|
|
5911
5948
|
"sec.unify": "统一虚化",
|
|
5912
|
-
"sec.unify.desc": "
|
|
5949
|
+
"sec.unify.desc": "整屏所有控件的模糊感由一组设置统一管理:虚化程度=壁纸模糊度,透明度=侧边栏/标题栏白雾厚度(标题栏也跟随,不再单独调节);开启后「界面虚化」里的侧边栏磨砂被接管。关闭则各区域单独调节",
|
|
5913
5950
|
"sec.show": "透出壁纸",
|
|
5914
5951
|
"sec.show.desc": "控制对应区域是否显示壁纸:关=纯色不透明",
|
|
5915
5952
|
"sec.other": "其他",
|
|
@@ -6023,6 +6060,7 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
6023
6060
|
"update.fail": "检查失败:",
|
|
6024
6061
|
"update.market": "去插件市场更新",
|
|
6025
6062
|
"update.gotoMarket": "已提示:请到插件市场(dshmarket)更新此插件(推荐,避免与市场版本检测冲突)",
|
|
6063
|
+
"update.readonly": "当前为市场安装(插件目录只读),无法内置更新——请到插件市场或 dsh plugin update 更新",
|
|
6026
6064
|
"update.chooseTitle": "更新方式确认",
|
|
6027
6065
|
"update.chooseBody": "推荐先到插件市场更新(semver 检测与市场一致)。确认仍用本插件的直接更新(拉取 GitHub 代码写回本地)吗?版本 ",
|
|
6028
6066
|
"roundCompat.desc": "给其他插件注入界面的矩形容器补圆角(不覆盖插件自己的样式);如与某插件冲突可关闭",
|
|
@@ -6237,7 +6275,7 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
6237
6275
|
"sec.blur": "UI blur",
|
|
6238
6276
|
"sec.blur.desc": "Backdrop blur when each popup layer opens: dialogs (generic center windows + chat input), the settings panel, and download/confirm popups each have their own switch; popovers = menus/dropdowns/tooltips; mask = the full-screen dim behind popups; sidebar frost = the sidebar itself becomes glass",
|
|
6239
6277
|
"sec.unify": "Unified blur",
|
|
6240
|
-
"sec.unify.desc": "One set of controls rules the frosted feel of every surface
|
|
6278
|
+
"sec.unify.desc": "One set of controls rules the frosted feel of every surface: blur degree = wallpaper blur, transparency = sidebar/title-bar fog thickness (the title bar follows it too). When on, the sidebar frost below is taken over. Off = each area adjusts separately",
|
|
6241
6279
|
"sec.show": "Show wallpaper",
|
|
6242
6280
|
"sec.show.desc": "Whether the corresponding area shows the wallpaper: off = solid color, opaque",
|
|
6243
6281
|
"sec.other": "Other",
|
|
@@ -6343,6 +6381,7 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
6343
6381
|
"update.fail": "Check failed: ",
|
|
6344
6382
|
"update.market": "Update from plugin market",
|
|
6345
6383
|
"update.gotoMarket": "Go update it in the plugin market (dshmarket) instead (recommended, matches the market version check)",
|
|
6384
|
+
"update.readonly": "Installed via the market (plugin dir is read-only), so in-place update is unavailable — update from the plugin market or via dsh plugin update",
|
|
6346
6385
|
"update.chooseTitle": "Choose update method",
|
|
6347
6386
|
"update.chooseBody": "Prefer updating from the plugin market (semver check matches the market). Still update directly via this plugin (pull GitHub code and write it back locally)? v",
|
|
6348
6387
|
"roundCompat.desc": "Adds border-radius to rectangular containers injected by other plugins (does not override their own styles); turn off if it conflicts",
|
|
@@ -6446,7 +6485,11 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
6446
6485
|
|
|
6447
6486
|
let styleEl = null;
|
|
6448
6487
|
function getStyleEl() {
|
|
6449
|
-
|
|
6488
|
+
// ①(修正) 同源 web 壁纸 iframe 的 JS 可能操作父页面 document.head(星野类壁纸
|
|
6489
|
+
// 假设独占页面),把我们的 <style> 清掉 → 插件 UI 全部失去样式(开关文字堆叠、
|
|
6490
|
+
// 导航图标错位显示默认图标——用户实测:导入 web 地址后出现,Chrome/Firefox 都有)。
|
|
6491
|
+
// 每次取用时检查 isConnected,脱离 DOM 就重建重挂,样式自愈。
|
|
6492
|
+
if (!styleEl || !styleEl.isConnected) {
|
|
6450
6493
|
styleEl = document.createElement("style");
|
|
6451
6494
|
styleEl.setAttribute("data-plugin", "dsh-mpkg-wallpaper");
|
|
6452
6495
|
(document.head || document.documentElement).appendChild(styleEl);
|
|
@@ -6479,8 +6522,18 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
6479
6522
|
const hasDlg = !!document.querySelector(
|
|
6480
6523
|
'[class*="sidebarCol"] [role="dialog"], [class*="sidebarCol"] [role="alertdialog"]'
|
|
6481
6524
|
);
|
|
6482
|
-
if (hasDlg)
|
|
6483
|
-
|
|
6525
|
+
if (hasDlg) {
|
|
6526
|
+
document.body.setAttribute("data-mpw-sblur-off", "");
|
|
6527
|
+
// ②(修正) 设置面板打开时悬浮外壳一并让位:悬浮给 sidebarCol 加
|
|
6528
|
+
// margin/圆角/overflow,设置面板(full-viewport fixed overlay)渲染在
|
|
6529
|
+
// sidebarCol 内,悬浮外壳会让 overlay 布局错乱 → 输入框/todo 浮到
|
|
6530
|
+
// 设置面上(用户实测:侧边栏收起 + 设置页开关悬浮后出现)。打
|
|
6531
|
+
// data-mpw-float-off,悬浮 CSS 让位(见 buildUiCss float-off 规则)。
|
|
6532
|
+
document.body.setAttribute("data-mpw-float-off", "");
|
|
6533
|
+
} else {
|
|
6534
|
+
document.body.removeAttribute("data-mpw-sblur-off");
|
|
6535
|
+
document.body.removeAttribute("data-mpw-float-off");
|
|
6536
|
+
}
|
|
6484
6537
|
} catch {}
|
|
6485
6538
|
};
|
|
6486
6539
|
try {
|
|
@@ -6490,6 +6543,31 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
6490
6543
|
check();
|
|
6491
6544
|
}
|
|
6492
6545
|
|
|
6546
|
+
// ①(新) 标题栏 backdrop blur 摘除:G 块给 header 加 blur(unifyAmount)(聊天区
|
|
6547
|
+
// 不跟随时的标题栏虚化),但 header 内有 absolute 展开面板(子代理/后台任务,
|
|
6548
|
+
// JObwrW_panel),backdrop-filter 会变成它们的 containing block → 面板定位错乱
|
|
6549
|
+
//(之前用户实测 bug)。展开面板出现在 header 内时打 data-mpw-header-blur-off
|
|
6550
|
+
// 摘除 header 的 backdrop-filter,面板关闭即恢复。只作用于 header 内面板,
|
|
6551
|
+
// 不动侧边栏(sidebarCol 无此问题)。
|
|
6552
|
+
let headerBlurWatch = null;
|
|
6553
|
+
function setupHeaderBlurWatch() {
|
|
6554
|
+
if (headerBlurWatch !== null) return;
|
|
6555
|
+
const check = () => {
|
|
6556
|
+
try {
|
|
6557
|
+
const hasPanel = !!document.querySelector(
|
|
6558
|
+
'[class*="wSkVaW_header"] [class*="panel"], [class*="wSkVaW_header"] [class*="menu"], [class*="wSkVaW_header"] [role="menu"], [class*="wSkVaW_header"] [data-surface]'
|
|
6559
|
+
);
|
|
6560
|
+
if (hasPanel) document.body.setAttribute("data-mpw-header-blur-off", "");
|
|
6561
|
+
else document.body.removeAttribute("data-mpw-header-blur-off");
|
|
6562
|
+
} catch {}
|
|
6563
|
+
};
|
|
6564
|
+
try {
|
|
6565
|
+
headerBlurWatch = new MutationObserver(check);
|
|
6566
|
+
headerBlurWatch.observe(document.body, { childList: true, subtree: true });
|
|
6567
|
+
} catch { headerBlurWatch = null; }
|
|
6568
|
+
check();
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6493
6571
|
// ⑲(修正) Aqua 主题切换监听:深色/浅色切换时重算遮罩色与自适应文字色
|
|
6494
6572
|
//(用户实测:aquaInk 开时切换主题,文字色卡在旧主题——黑字黑底/白字白底看不清)。
|
|
6495
6573
|
let aquaThemeWatch = null;
|
|
@@ -6537,6 +6615,37 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
6537
6615
|
// 不该丢 webUrl。故让 webUrl 持久(刷新后正常恢复,卡了手动刷新即可)。
|
|
6538
6616
|
// 若确需"刷新后不自动重载",可改成只标记、不清 persisted webUrl。(此处保持持久)
|
|
6539
6617
|
try { applyFromStorage(); } catch (err) { console.warn("[dsh-mpkg-wallpaper] boot 应用背景失败:", err); }
|
|
6618
|
+
// ①(修正) 样式自愈:同源 web 壁纸 iframe 的 JS 可能清掉父页面 <head> 里的
|
|
6619
|
+
// 本插件 <style>(星野类壁纸假设独占页面)→ 插件 UI 全部失样式(开关文字堆叠、
|
|
6620
|
+
// 导航图标错位)。监听 head 子节点移除:检测到我们的 style 消失立即重建并重写。
|
|
6621
|
+
try {
|
|
6622
|
+
if (!window.__mpwStyleWatch) {
|
|
6623
|
+
window.__mpwStyleWatch = new MutationObserver((muts) => {
|
|
6624
|
+
try {
|
|
6625
|
+
// 只看 removedNodes 是否含我们的 style(或整个 head 被清空重建)
|
|
6626
|
+
let oursGone = false;
|
|
6627
|
+
for (const m of muts) {
|
|
6628
|
+
const rn = m.removedNodes || [];
|
|
6629
|
+
for (let i = 0; i < rn.length; i++) {
|
|
6630
|
+
const n = rn[i];
|
|
6631
|
+
if (!n || n.nodeType !== 1) continue;
|
|
6632
|
+
if (n.getAttribute && n.getAttribute("data-plugin") === "dsh-mpkg-wallpaper") { oursGone = true; break; }
|
|
6633
|
+
if (n.querySelector && n.querySelector('[data-plugin="dsh-mpkg-wallpaper"]')) { oursGone = true; break; }
|
|
6634
|
+
}
|
|
6635
|
+
if (oursGone) break;
|
|
6636
|
+
}
|
|
6637
|
+
if (!oursGone) return; // 其他 style 增删不重写(避免无谓全量重建)
|
|
6638
|
+
const el = getStyleEl(); // isConnected 检查:脱离则重建重挂
|
|
6639
|
+
if (el) {
|
|
6640
|
+
const s = readSection();
|
|
6641
|
+
el.textContent = buildCss(s.enabled === false ? Object.assign({}, s, { image: "" }) : s);
|
|
6642
|
+
}
|
|
6643
|
+
} catch {}
|
|
6644
|
+
});
|
|
6645
|
+
const head = document.head || document.documentElement;
|
|
6646
|
+
if (head) window.__mpwStyleWatch.observe(head, { childList: true, subtree: true });
|
|
6647
|
+
}
|
|
6648
|
+
} catch {}
|
|
6540
6649
|
// ⑤(新) 宿主端设置持久化:异步拉取 host /settings(优先于 localStorage),
|
|
6541
6650
|
// 拉到后重应用(配置跨端口/清浏览器数据不丢;host 不可用时回退 localStorage)。
|
|
6542
6651
|
try { initHostSettings(); } catch {}
|
package/lib/index.js
CHANGED
|
@@ -979,6 +979,18 @@ function apply(ctx) {
|
|
|
979
979
|
handler: async (req, res) => {
|
|
980
980
|
try {
|
|
981
981
|
const dir = new URL('./', import.meta.url);
|
|
982
|
+
// ①(修正) 市场安装(pnpm store/全局/容器)包目录只读 → 写回必失败(EACCES),
|
|
983
|
+
// 且写回后 DSH 客户端 bundle 元数据不热更、npm 重装即还原——对市场用户无效甚至有害。
|
|
984
|
+
// 写前探测可写性:失败直接返回明确提示,引导走 `dsh plugin update` / 插件市场,
|
|
985
|
+
// 不再让用户看到笼统的 500「更新失败」。
|
|
986
|
+
try {
|
|
987
|
+
const probe = new URL('./.update-write-test', dir);
|
|
988
|
+
writeFileSync(probe, 'ok', 'utf8');
|
|
989
|
+
unlinkSync(probe);
|
|
990
|
+
} catch (writeErr) {
|
|
991
|
+
json(res, 200, { ok: false, readonly: true, error: String(writeErr && writeErr.code || 'EACCES') });
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
982
994
|
const client = await fetchRaw('lib/client.js');
|
|
983
995
|
const index = await fetchRaw('lib/index.js');
|
|
984
996
|
if (!client.includes('dsh-mpkg-wallpaper') || !index.includes('dsh-mpkg-wallpaper')) { json(res, 400, { ok: false, error: 'invalid payload' }); return; }
|
package/package.json
CHANGED