@luosuqwq/dsh-ui-appearance 0.1.8 → 0.1.12

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/host/index.js CHANGED
@@ -42,6 +42,20 @@ const safeConfig = (value) => {
42
42
  }
43
43
  const send = (res, status, data, type = 'application/json') => { res.statusCode = status; if (res.setHeader) res.setHeader('content-type', type); if (type === 'application/json') data = JSON.stringify(data); res.end(data) }
44
44
 
45
+ /**
46
+ * Host 的准入检查:Host/Origin 围栏 + 已认证会话。拿不到这个服务就一律
47
+ * 拒绝(503)——宁可这条路不可用,也不能在服务缺席时静默放行。
48
+ */
49
+ const rejectionOf = (ctx, req) => {
50
+ const connection = ctx.get?.('connection')
51
+ if (typeof connection?.requestRejection !== 'function') return 503
52
+ try {
53
+ return connection.requestRejection(req)
54
+ } catch {
55
+ return 403
56
+ }
57
+ }
58
+
45
59
  export const name = NS
46
60
  export const inject = ['webServer', 'workspaceRegistry']
47
61
  const resolveWorkspaceRoot = (ctx) => {
@@ -85,6 +99,10 @@ export function apply(ctx) {
85
99
  const load = async () => { try { return safeConfig(JSON.parse(await fs.readFile(configFile, 'utf8'))) } catch { return null } }
86
100
  const save = async (value) => { await fs.mkdir(userRoot, { recursive: true }); await fs.writeFile(configFile, JSON.stringify(safeConfig(value), null, 2), 'utf8') }
87
101
  const route = async (req, res) => {
102
+ // 先过准入:没有这道检查,用户浏览器里任意网页都能 POST /bg/upload 往工作区
103
+ // 写文件、POST /bg/reveal 弹文件管理器、改 /bg/config 改掉整套外观设置。
104
+ const rejection = rejectionOf(ctx, req)
105
+ if (rejection !== undefined) return send(res, rejection, { error: 'unauthorized' })
88
106
  await ready
89
107
  const url = new URL(req.url || '/', 'http://localhost')
90
108
  if (url.pathname === '/bg/list') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luosuqwq/dsh-ui-appearance",
3
- "version": "0.1.8",
3
+ "version": "0.1.12",
4
4
  "description": "Wallpapers with parallax, frosted-glass panels, sidebar auto-hide and chat styling, all adjustable from a Settings section.",
5
5
  "author": "LuoSu <2681153600@qq.com>",
6
6
  "keywords": [
@@ -217,6 +217,19 @@ if (hostDefaults && clientDefaults) {
217
217
  check("默认壁纸在两份 defaults 里都是 version2", hostDefaults.bgImage.includes("DEFAULT_WALLPAPER") && clientDefaults.bgImage.includes("DEFAULT_WALLPAPER"))
218
218
  }
219
219
 
220
+ // 2026-11-23 反馈:「+」点开后菜单看不见。原因是输入框上的 contain:paint 会裁剪
221
+ // 子元素并新建层叠上下文,把弹出的菜单压到会话滚动层下面(paint containment
222
+ // 无法用 overflow:visible 覆盖)。这里静态盯住,别再写回去。
223
+ {
224
+ const style = templateOf("const STYLE =")
225
+ check("输入框不用 contain:paint(会裁掉弹出菜单)", !/\[data-dsh-appearance-composer\][^}]*contain:paint/.test(style))
226
+ check("会话卡片也不用 contain:paint", !/\[data-phase="active"\][^}]*contain:paint/.test(style))
227
+ }
228
+
229
+ // 2026-11-23 反馈:弹层是半透明材质,壁纸透上来正文看不清。修法是把
230
+ // [data-menu-material] 的材质层改成不透明并去掉 backdrop-filter。
231
+ check("弹层材质改成不透明", source.includes("data-menu-material") && source.includes("backdrop-filter:none!important"))
232
+
220
233
  if (failed > 0) {
221
234
  console.log(`\n${failed} check(s) failed`)
222
235
  process.exit(1)