dsh-client-ui-skin-tianlight 2.3.0 → 2.3.1
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 +3 -3
- package/build-info.json +3 -3
- package/lib/client.js +1 -1
- package/lib/index.js +1 -1
- package/lib/we-wallpaper/README.md +10 -1
- package/lib/we-wallpaper/host.mjs +257 -19
- package/package.json +1 -1
- package/skin.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# 天光(TIANLIGHT)— DSH Web 皮肤插件
|
|
2
2
|
|
|
3
|
-
新海诚式的天光配色,全屏循环动态壁纸置于界面之下,玻璃质感面板、可拖拽的薄荷小猫桌宠,以及一套自建的排版与壁纸控制面板。v0.5.1 起它是一套**可开关、可观测、可回滚**的工作台:模块开关、宿主设置同步、智能情境(含天气联动)、特效与氛围、系统音频、网页壁纸、导入导出包与配方分享;v0.5.2 是**自检修复版**(设置数据安全 / i18n 完整性 / 面板体验),v0.5.3 是**大修版**(快捷壁纸 / 点击链路 / 语言解耦 / 情境安全默认),v0.6.0 起**自动接入本机 Wallpaper Engine 库**(无需填写目录,点一张即应用),v0.7.0 新增**职责通道**(角色包/职责引擎 → 桌宠气泡与用户选择,只改浏览器半、无需重启 DSH)。v2.2.4–v2.2.8 连续修正液态玻璃:默认关闭、侧栏开关归位、实时玻璃只作用于输入框与小组件(壁纸保持清晰)、去掉所有描边白线,暗色侧栏/角色中枢改用烟熏底;**v2.2.9** 把大面板改成「宿主上色 + `::before` 真模糊 + `::after` 渐变边缘光」,并修掉开侧栏时整窗发暗/发糊;**v2.2.10** 是同一份最终代码的 npm 补发版;**v2.2.11** 修复天气自动轮询成功、但数值未变时「更新于」不前进的问题;**v2.2.12** 重做天气刷新(单飞、直连/宿主并发、宿主走系统代理、旧数据标 stale
|
|
3
|
+
新海诚式的天光配色,全屏循环动态壁纸置于界面之下,玻璃质感面板、可拖拽的薄荷小猫桌宠,以及一套自建的排版与壁纸控制面板。v0.5.1 起它是一套**可开关、可观测、可回滚**的工作台:模块开关、宿主设置同步、智能情境(含天气联动)、特效与氛围、系统音频、网页壁纸、导入导出包与配方分享;v0.5.2 是**自检修复版**(设置数据安全 / i18n 完整性 / 面板体验),v0.5.3 是**大修版**(快捷壁纸 / 点击链路 / 语言解耦 / 情境安全默认),v0.6.0 起**自动接入本机 Wallpaper Engine 库**(无需填写目录,点一张即应用),v0.7.0 新增**职责通道**(角色包/职责引擎 → 桌宠气泡与用户选择,只改浏览器半、无需重启 DSH)。v2.2.4–v2.2.8 连续修正液态玻璃:默认关闭、侧栏开关归位、实时玻璃只作用于输入框与小组件(壁纸保持清晰)、去掉所有描边白线,暗色侧栏/角色中枢改用烟熏底;**v2.2.9** 把大面板改成「宿主上色 + `::before` 真模糊 + `::after` 渐变边缘光」,并修掉开侧栏时整窗发暗/发糊;**v2.2.10** 是同一份最终代码的 npm 补发版;**v2.2.11** 修复天气自动轮询成功、但数值未变时「更新于」不前进的问题;**v2.2.12** 重做天气刷新(单飞、直连/宿主并发、宿主走系统代理、旧数据标 stale);**v2.3.0** 把「只有深色」拆成浅色/深色两套完整外观(跟随 DSH / 浅色 / 深色 / 随天光四模式,新增晴空晨雾、夜雾对称保护、圆形揭开动效、分模式壁纸与三个入口),并完成 DSH **0.2.2-rc.5** 的实测与适配。
|
|
4
4
|
|
|
5
5
|
> 这是一个 **DSH(DeepSeek Harness)Web GUI 皮肤插件**,不是独立应用。它是一个标准 DSH bundle:`dsh.bundle.patch` 负责插入 `ui-skin-tianlight` 行,`dsh.client` 提供浏览器半;Web GUI 与 DSH Desktop 共用同一前端。
|
|
6
6
|
>
|
|
7
7
|
> npm 包名 `dsh-client-ui-skin-tianlight`(v2.0.2 起;旧链接安装包名 `@dsh-external/dsh-client-ui-skin-tianlight`)· 布线行 `ui-skin-tianlight` · body 属性 `data-dsh-tianlight`
|
|
8
8
|
|
|
9
|
-
**当前版本:v2.3.0**(浅色/深色可切换 + DSH 0.2.2-rc.5
|
|
9
|
+
**当前版本:v2.3.0**(浅色/深色可切换 + DSH 0.2.2-rc.5 实测)。已发布:npm [`dsh-client-ui-skin-tianlight@2.3.0`](https://www.npmjs.com/package/dsh-client-ui-skin-tianlight)(`latest`)· [GitHub Release v2.3.0](https://github.com/MilkySnowWay123/dsh-client-ui-skin-tianlight/releases/tag/v2.3.0)。
|
|
10
10
|
|
|
11
11
|
## v2.3.0 · 浅色/深色可切换,适配 DSH 0.2.2-rc.5
|
|
12
12
|
|
|
@@ -530,7 +530,7 @@ v0.5.0 的 P0–P4 功能全部保留;这一版是增量补丁,同一份构
|
|
|
530
530
|
|
|
531
531
|
## 版本历史
|
|
532
532
|
|
|
533
|
-
> v2.0.0 之后的逐版说明以上方各节为准;`v2.2.9`、`v2.2.10`、`v2.2.11`、`v2.2.12` 已补齐。下面保留 v1.x 的旧记录。
|
|
533
|
+
> v2.0.0 之后的逐版说明以上方各节为准;`v2.2.9`、`v2.2.10`、`v2.2.11`、`v2.2.12`、`v2.3.0` 已补齐。下面保留 v1.x 的旧记录。
|
|
534
534
|
|
|
535
535
|
- **v1.6.4(2026-11-10)**:正式版(公开 v1.0.3)——桌宠「AI 对话」(输入条+气泡回复、识别图片/视频形象、顶部自动翻转、权限/配额不变);每个自定义形象一套动作名+回复(按 mediaId 生效、只提交改动项、切语言不冻结);中枢形象文件名常显列表 + 下拉选项可读性修复;全代码审查修复 H1/H2/M1/M2/M3/M4/M5。详见 [docs/RELEASE-1.6.4.md](docs/RELEASE-1.6.4.md) 与 [docs/REVIEW-1.6.4.md](docs/REVIEW-1.6.4.md)。
|
|
536
536
|
- **v1.6.3(2026-11-10)**:显示名统一为「天光」(`skin.json.name` + README 标题;skin id/包名/data 属性/设置键不变,无迁移成本);完成 DSH 0.2.0-rc.2 / 0.2.1-rc.5 / 0.2.2-rc.1 三线兼容性实证(bundles 72/77/86、三行 verdict COMPATIBLE、hook-scan 与 upgrade-check 全绿,桥分层发现无需版本分支);公开上传版本命名为 **v1.0.2**(内部构建 1.6.3)。详见 [docs/RELEASE-1.6.3.md](docs/RELEASE-1.6.3.md)。
|
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"product": "dsh-client-ui-skin-tianlight",
|
|
4
|
-
"version": "2.3.
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-11-
|
|
4
|
+
"version": "2.3.1",
|
|
5
|
+
"commit": "e1a7e149de666d1bb4a89152a7ba210d2c82e891",
|
|
6
|
+
"builtAt": "2026-11-25T18:14:00+08:00",
|
|
7
7
|
"source": "pack"
|
|
8
8
|
}
|
package/lib/client.js
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
* must equal `package.json` `version`; tools/test.mjs fails the chain when the
|
|
56
56
|
* two drift (the 2.1.0-2.1.3 builds printed a stale "2.0.4").
|
|
57
57
|
*/
|
|
58
|
-
const TL_BUILD_VERSION = "2.3.
|
|
58
|
+
const TL_BUILD_VERSION = "2.3.1";
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Host identity last reported by `_engines`: `build` is the host's
|
package/lib/index.js
CHANGED
|
@@ -69,7 +69,7 @@ const HOST_API = '3'
|
|
|
69
69
|
* manifest is stamped with it. The handshake no longer compares it, so a
|
|
70
70
|
* browser-half-only update can run against an unchanged host process.
|
|
71
71
|
*/
|
|
72
|
-
const BUILD = '2.3.
|
|
72
|
+
const BUILD = '2.3.1'
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Identity handed to the route modules that need it. `HOST_API`/`BUILD` stay in this
|
|
@@ -79,6 +79,15 @@ mounts the wallpaper itself.
|
|
|
79
79
|
|
|
80
80
|
`scene` cards use `/pkg/<id>` when a package is extractable, otherwise the
|
|
81
81
|
preview image; `audio`/unknown types degrade to the preview image.
|
|
82
|
+
9. **Scene-video integrity (v2.3.1)**: `captureSize()` caps the WE window and
|
|
83
|
+
the recording at 4K UHD (3840×2160, aspect preserved; a 4K monitor keeps its
|
|
84
|
+
native size, 5K/8K scales down), the recorder process is awaited before
|
|
85
|
+
anything is copied, and `inspectSceneMp4()` must find `ftyp`, `moov` and an
|
|
86
|
+
`mvhd` duration near `SCENE_VIDEO_SECONDS`. A truncated capture is deleted
|
|
87
|
+
and reported as `wcap-output-invalid:<reason>` instead of being cached as
|
|
88
|
+
ready; `readValidMeta()` re-checks the cached file with a size+mtime keyed
|
|
89
|
+
verdict, so a bad cache self-heals on the next status poll instead of
|
|
90
|
+
sticking.
|
|
82
91
|
|
|
83
92
|
## Routes (mounted at `/api/we-wallpaper`)
|
|
84
93
|
|
|
@@ -102,7 +111,7 @@ with 403; ids are resolved through the scan map (never used as raw paths).
|
|
|
102
111
|
|
|
103
112
|
| Condition | Behaviour |
|
|
104
113
|
|---|---|
|
|
105
|
-
| Windows + Wallpaper Engine + vendored `wcap` files | capture can be requested; WE opens the scene in a temporary borderless window, wcap records 12 s, cache is reused afterwards |
|
|
114
|
+
| Windows + Wallpaper Engine + vendored `wcap` files | capture can be requested; WE opens the scene in a temporary borderless window (capped at 4K UHD), wcap records 12 s, the container is validated before it is cached, cache is reused afterwards |
|
|
106
115
|
| `wcap` files missing / non-Windows / `TIANLIGHT_WE_DISABLE_SCENE_VIDEO=1` | `POST /scene-video/generate/<id>` → `503 scene-video-unsupported` with a reason; everything else keeps working |
|
|
107
116
|
| cap never requested | scenes are shown through the static HD `/pkg/<id>` image (the v0.6.0 default) |
|
|
108
117
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { spawn, spawnSync } from "node:child_process";
|
|
26
26
|
import { createHash } from "node:crypto";
|
|
27
|
-
import { copyFileSync, createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
27
|
+
import { closeSync, copyFileSync, createReadStream, existsSync, mkdirSync, openSync, readFileSync, readdirSync, readSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
28
28
|
import { readFile } from "node:fs/promises";
|
|
29
29
|
import { fileURLToPath } from "node:url";
|
|
30
30
|
import { basename, dirname, extname, isAbsolute, join, resolve, sep } from "node:path";
|
|
@@ -1118,6 +1118,44 @@ async function resolvePkgPreview(entry, workshopDirs, opts = {}) {
|
|
|
1118
1118
|
/** Fallback capture size when the physical monitor size cannot be probed. */
|
|
1119
1119
|
const SCENE_VIDEO_WIDTH = 1920;
|
|
1120
1120
|
const SCENE_VIDEO_HEIGHT = 1080;
|
|
1121
|
+
/**
|
|
1122
|
+
* TIANLIGHT v2.3.1: recorder contract and capture ceiling.
|
|
1123
|
+
*
|
|
1124
|
+
* The recorder is handed the window size, so the capture used to inherit the
|
|
1125
|
+
* desktop size with no ceiling at all (an 8K panel would encode 8K). Record up
|
|
1126
|
+
* to 4K UHD — a 4K monitor keeps its native 3840×2160 — and keep the monitor
|
|
1127
|
+
* aspect ratio; anything larger scales down until it fits. The container
|
|
1128
|
+
* structure is part of "ready" regardless of the size.
|
|
1129
|
+
*/
|
|
1130
|
+
const SCENE_VIDEO_SECONDS = 12;
|
|
1131
|
+
const SCENE_VIDEO_MIN_BYTES = 512 * 1024;
|
|
1132
|
+
const MAX_CAPTURE_WIDTH = 3840;
|
|
1133
|
+
const MAX_CAPTURE_HEIGHT = 2160;
|
|
1134
|
+
const MP4_BOX_SCAN_LIMIT = 64;
|
|
1135
|
+
const MP4_MOOV_HEAD_BYTES = 96 * 1024;
|
|
1136
|
+
/** Encoders require even pixel counts; keep the ratio without odd edges. */
|
|
1137
|
+
function evenPixels(value) {
|
|
1138
|
+
return Math.max(2, Math.round(value / 2) * 2);
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* TIANLIGHT v2.3.1: the size the WE window is opened at and recorded at.
|
|
1142
|
+
* A monitor up to 4K keeps its native size; anything larger (5K/8K) scales
|
|
1143
|
+
* down until it fits, preserving the aspect ratio.
|
|
1144
|
+
*/
|
|
1145
|
+
function captureSize(monitor) {
|
|
1146
|
+
const width = Number(monitor?.width);
|
|
1147
|
+
const height = Number(monitor?.height);
|
|
1148
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || width < 640 || height < 480) return {
|
|
1149
|
+
width: SCENE_VIDEO_WIDTH,
|
|
1150
|
+
height: SCENE_VIDEO_HEIGHT
|
|
1151
|
+
};
|
|
1152
|
+
const scale = Math.min(1, MAX_CAPTURE_WIDTH / width, MAX_CAPTURE_HEIGHT / height);
|
|
1153
|
+
return {
|
|
1154
|
+
width: evenPixels(width * scale),
|
|
1155
|
+
height: evenPixels(height * scale)
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1121
1159
|
let activeRecorder = null;
|
|
1122
1160
|
let activeLocation = null;
|
|
1123
1161
|
let activeInstall = null;
|
|
@@ -1142,7 +1180,9 @@ function readValidMeta(entry, home = "") {
|
|
|
1142
1180
|
const metaPath = sceneVideoMetaPath(entry.id, home);
|
|
1143
1181
|
try {
|
|
1144
1182
|
const stat = statSync(video);
|
|
1145
|
-
if (!stat.isFile() || stat.size <
|
|
1183
|
+
if (!stat.isFile() || stat.size < SCENE_VIDEO_MIN_BYTES) return null;
|
|
1184
|
+
// v2.3.1: a truncated recorder output is not a cache hit.
|
|
1185
|
+
if (!sceneVideoStructurallyValid(video, stat)) return null;
|
|
1146
1186
|
const raw = JSON.parse(readFileSync(metaPath, "utf8"));
|
|
1147
1187
|
if (raw.version !== 2 || raw.id !== entry.id || raw.projectMtimeMs !== projectMtime(entry) || typeof raw.width !== "number" || !Number.isInteger(raw.width) || raw.width < 640 || typeof raw.height !== "number" || !Number.isInteger(raw.height) || raw.height < 480 || typeof raw.createdAt !== "string") return null;
|
|
1148
1188
|
return raw;
|
|
@@ -1278,6 +1318,196 @@ function newestMp4(dir) {
|
|
|
1278
1318
|
return null;
|
|
1279
1319
|
}
|
|
1280
1320
|
}
|
|
1321
|
+
/** Wait (bounded) for the recorder process to exit after its last frame. */
|
|
1322
|
+
async function settleRecorder(recorder, timeoutMs) {
|
|
1323
|
+
if (recorder === null || recorder === void 0) return true;
|
|
1324
|
+
const deadline = Date.now() + timeoutMs;
|
|
1325
|
+
while (recorder.exitCode === null) {
|
|
1326
|
+
if (Date.now() >= deadline) return false;
|
|
1327
|
+
await delay(200);
|
|
1328
|
+
}
|
|
1329
|
+
return true;
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* TIANLIGHT v2.3.1: the newest mp4 in `dir` after its size stopped changing
|
|
1333
|
+
* across a full settle window. Null on timeout or when it never reaches the
|
|
1334
|
+
* minimum size.
|
|
1335
|
+
*/
|
|
1336
|
+
async function stableMp4(dir, timeoutMs) {
|
|
1337
|
+
const deadline = Date.now() + timeoutMs;
|
|
1338
|
+
let previous = null;
|
|
1339
|
+
while (Date.now() < deadline) {
|
|
1340
|
+
const candidate = newestMp4(dir);
|
|
1341
|
+
if (candidate !== null) {
|
|
1342
|
+
const size = statSync(candidate).size;
|
|
1343
|
+
if (size >= SCENE_VIDEO_MIN_BYTES) {
|
|
1344
|
+
if (previous !== null && previous.file === candidate && previous.size === size) return candidate;
|
|
1345
|
+
previous = {
|
|
1346
|
+
file: candidate,
|
|
1347
|
+
size
|
|
1348
|
+
};
|
|
1349
|
+
} else previous = null;
|
|
1350
|
+
}
|
|
1351
|
+
await delay(800);
|
|
1352
|
+
}
|
|
1353
|
+
return null;
|
|
1354
|
+
}
|
|
1355
|
+
/** One ISO-BMFF box header at `offset`; null when the header is invalid or overruns the file. */
|
|
1356
|
+
function readBoxHeader(fd, offset, fileSize) {
|
|
1357
|
+
const head = Buffer.alloc(16);
|
|
1358
|
+
const read = readSync(fd, head, 0, 16, offset);
|
|
1359
|
+
if (read < 8) return null;
|
|
1360
|
+
let size = head.readUInt32BE(0);
|
|
1361
|
+
const type = head.toString("latin1", 4, 8);
|
|
1362
|
+
let headerSize = 8;
|
|
1363
|
+
if (size === 1) {
|
|
1364
|
+
if (read < 16) return null;
|
|
1365
|
+
size = head.readUInt32BE(8) * 2 ** 32 + head.readUInt32BE(12);
|
|
1366
|
+
headerSize = 16;
|
|
1367
|
+
} else if (size === 0) size = fileSize - offset;
|
|
1368
|
+
if (!/^[\x20-\x7e]{4}$/.test(type) || size < headerSize || offset + size > fileSize) return null;
|
|
1369
|
+
return {
|
|
1370
|
+
type,
|
|
1371
|
+
size,
|
|
1372
|
+
headerSize
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
/** `mvhd` duration in seconds, read from a bounded head of the `moov` payload. */
|
|
1376
|
+
function readMovieDuration(fd, moov, fileSize) {
|
|
1377
|
+
const start = moov.offset + moov.headerSize;
|
|
1378
|
+
const end = Math.min(moov.offset + moov.size, fileSize);
|
|
1379
|
+
const limit = Math.min(end - start, MP4_MOOV_HEAD_BYTES);
|
|
1380
|
+
if (limit <= 0) return null;
|
|
1381
|
+
const buf = Buffer.alloc(limit);
|
|
1382
|
+
const read = readSync(fd, buf, 0, limit, start);
|
|
1383
|
+
if (read < 8) return null;
|
|
1384
|
+
let p = 0;
|
|
1385
|
+
for (let index = 0; index < MP4_BOX_SCAN_LIMIT && p + 8 <= read; index += 1) {
|
|
1386
|
+
let size = buf.readUInt32BE(p);
|
|
1387
|
+
const type = buf.toString("latin1", p + 4, p + 8);
|
|
1388
|
+
let header = 8;
|
|
1389
|
+
if (size === 1) {
|
|
1390
|
+
if (p + 16 > read) return null;
|
|
1391
|
+
size = buf.readUInt32BE(p + 8) * 2 ** 32 + buf.readUInt32BE(p + 12);
|
|
1392
|
+
header = 16;
|
|
1393
|
+
} else if (size === 0) size = read - p;
|
|
1394
|
+
if (!/^[\x20-\x7e]{4}$/.test(type) || size < header || p + size > read) return null;
|
|
1395
|
+
if (type === "mvhd") {
|
|
1396
|
+
const body = p + header;
|
|
1397
|
+
const version = buf.readUInt8(body);
|
|
1398
|
+
const timescaleAt = version === 1 ? body + 20 : body + 12;
|
|
1399
|
+
const durationAt = version === 1 ? body + 24 : body + 16;
|
|
1400
|
+
const end2 = version === 1 ? body + 32 : body + 20;
|
|
1401
|
+
if (end2 > read) return null;
|
|
1402
|
+
const timescale = buf.readUInt32BE(timescaleAt);
|
|
1403
|
+
const duration = version === 1 ? buf.readUInt32BE(durationAt) * 2 ** 32 + buf.readUInt32BE(durationAt + 4) : buf.readUInt32BE(durationAt);
|
|
1404
|
+
if (timescale === 0) return null;
|
|
1405
|
+
return duration / timescale;
|
|
1406
|
+
}
|
|
1407
|
+
p += size;
|
|
1408
|
+
}
|
|
1409
|
+
return null;
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* TIANLIGHT v2.3.1: structural check for a recorded scene video.
|
|
1413
|
+
*
|
|
1414
|
+
* The recorder finalizes the file after the last frame: a recorder killed or
|
|
1415
|
+
* copied mid-finalize leaves a file that is still large enough to pass a byte
|
|
1416
|
+
* count but has no usable index. This walks the top-level boxes and the
|
|
1417
|
+
* `moov` head, and returns a named reason instead of trusting the size.
|
|
1418
|
+
*/
|
|
1419
|
+
function inspectSceneMp4(file, expectedSeconds = SCENE_VIDEO_SECONDS) {
|
|
1420
|
+
let fd;
|
|
1421
|
+
try {
|
|
1422
|
+
const stat = statSync(file);
|
|
1423
|
+
if (!stat.isFile() || stat.size < SCENE_VIDEO_MIN_BYTES) return {
|
|
1424
|
+
ok: false,
|
|
1425
|
+
reason: "too-small",
|
|
1426
|
+
duration: null
|
|
1427
|
+
};
|
|
1428
|
+
fd = openSync(file, "r");
|
|
1429
|
+
let offset = 0;
|
|
1430
|
+
let sawFtyp = false;
|
|
1431
|
+
let sawMdat = false;
|
|
1432
|
+
let moov = null;
|
|
1433
|
+
for (let index = 0; index < MP4_BOX_SCAN_LIMIT && offset + 8 <= stat.size; index += 1) {
|
|
1434
|
+
const box = readBoxHeader(fd, offset, stat.size);
|
|
1435
|
+
if (box === null) return {
|
|
1436
|
+
ok: false,
|
|
1437
|
+
reason: "bad-box-header",
|
|
1438
|
+
duration: null
|
|
1439
|
+
};
|
|
1440
|
+
if (index === 0 && box.type !== "ftyp") return {
|
|
1441
|
+
ok: false,
|
|
1442
|
+
reason: "ftyp-missing",
|
|
1443
|
+
duration: null
|
|
1444
|
+
};
|
|
1445
|
+
if (box.type === "ftyp") sawFtyp = true;
|
|
1446
|
+
else if (box.type === "moov" && moov === null) moov = {
|
|
1447
|
+
offset,
|
|
1448
|
+
size: box.size,
|
|
1449
|
+
headerSize: box.headerSize
|
|
1450
|
+
};
|
|
1451
|
+
else if (box.type === "mdat") sawMdat = true;
|
|
1452
|
+
offset += box.size;
|
|
1453
|
+
}
|
|
1454
|
+
if (!sawFtyp) return {
|
|
1455
|
+
ok: false,
|
|
1456
|
+
reason: "ftyp-missing",
|
|
1457
|
+
duration: null
|
|
1458
|
+
};
|
|
1459
|
+
if (moov === null) return {
|
|
1460
|
+
ok: false,
|
|
1461
|
+
reason: "moov-missing",
|
|
1462
|
+
duration: null
|
|
1463
|
+
};
|
|
1464
|
+
if (!sawMdat) return {
|
|
1465
|
+
ok: false,
|
|
1466
|
+
reason: "mdat-missing",
|
|
1467
|
+
duration: null
|
|
1468
|
+
};
|
|
1469
|
+
const duration = readMovieDuration(fd, moov, stat.size);
|
|
1470
|
+
if (duration === null) return {
|
|
1471
|
+
ok: false,
|
|
1472
|
+
reason: "mvhd-missing",
|
|
1473
|
+
duration: null
|
|
1474
|
+
};
|
|
1475
|
+
if (!(duration >= Math.max(1, expectedSeconds * 0.5) && duration <= expectedSeconds * 2.5)) return {
|
|
1476
|
+
ok: false,
|
|
1477
|
+
reason: `duration-out-of-range:${duration.toFixed(2)}s`,
|
|
1478
|
+
duration
|
|
1479
|
+
};
|
|
1480
|
+
return {
|
|
1481
|
+
ok: true,
|
|
1482
|
+
reason: null,
|
|
1483
|
+
duration
|
|
1484
|
+
};
|
|
1485
|
+
} catch (error) {
|
|
1486
|
+
return {
|
|
1487
|
+
ok: false,
|
|
1488
|
+
reason: error instanceof Error ? error.message : "unreadable",
|
|
1489
|
+
duration: null
|
|
1490
|
+
};
|
|
1491
|
+
} finally {
|
|
1492
|
+
if (fd !== void 0) try {
|
|
1493
|
+
closeSync(fd);
|
|
1494
|
+
} catch {}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
/** Cached structural verdict per file, keyed by size+mtime so a rewrite is re-checked. */
|
|
1498
|
+
const sceneVideoVerdicts = new Map();
|
|
1499
|
+
function sceneVideoStructurallyValid(file, stat) {
|
|
1500
|
+
const cached = sceneVideoVerdicts.get(file);
|
|
1501
|
+
if (cached !== void 0 && cached.size === stat.size && cached.mtimeMs === stat.mtimeMs) return cached.ok;
|
|
1502
|
+
const probe = inspectSceneMp4(file);
|
|
1503
|
+
if (sceneVideoVerdicts.size > 32) sceneVideoVerdicts.clear();
|
|
1504
|
+
sceneVideoVerdicts.set(file, {
|
|
1505
|
+
size: stat.size,
|
|
1506
|
+
mtimeMs: stat.mtimeMs,
|
|
1507
|
+
ok: probe.ok
|
|
1508
|
+
});
|
|
1509
|
+
return probe.ok;
|
|
1510
|
+
}
|
|
1281
1511
|
function updateProgress(id, progress) {
|
|
1282
1512
|
const status = statuses.get(id);
|
|
1283
1513
|
if (status === void 0 || status.phase !== "capturing") return;
|
|
@@ -1322,6 +1552,7 @@ async function runCapture(entry, install) {
|
|
|
1322
1552
|
const hotkeyScript = bundledTool("send-window-capture-hotkey.ps1");
|
|
1323
1553
|
if (!existsSync(bundledWcap) || !existsSync(hotkeyScript)) throw new Error("wcap-tool-not-found");
|
|
1324
1554
|
const monitor = await probeMonitorSize();
|
|
1555
|
+
const capture = captureSize(monitor);
|
|
1325
1556
|
const cacheRoot = sceneVideoDir();
|
|
1326
1557
|
const runtimeDir = join(cacheRoot, "runtime");
|
|
1327
1558
|
const jobDir = join(cacheRoot, `.job-${entry.id}-${process.pid}-${Date.now()}`);
|
|
@@ -1329,7 +1560,7 @@ async function runCapture(entry, install) {
|
|
|
1329
1560
|
mkdirSync(jobDir, { recursive: true });
|
|
1330
1561
|
const runtimeWcap = join(runtimeDir, "wcap-x64.exe");
|
|
1331
1562
|
copyFileSync(bundledWcap, runtimeWcap);
|
|
1332
|
-
writeFileSync(join(runtimeDir, "wcap-x64.ini"), wcapIni(jobDir,
|
|
1563
|
+
writeFileSync(join(runtimeDir, "wcap-x64.ini"), wcapIni(jobDir, SCENE_VIDEO_SECONDS, capture.width, capture.height), "utf8");
|
|
1333
1564
|
const location = `DSH-WE-Record-${entry.id}`;
|
|
1334
1565
|
activeLocation = location;
|
|
1335
1566
|
activeInstall = install;
|
|
@@ -1350,9 +1581,9 @@ async function runCapture(entry, install) {
|
|
|
1350
1581
|
"-playInWindow",
|
|
1351
1582
|
location,
|
|
1352
1583
|
"-width",
|
|
1353
|
-
String(
|
|
1584
|
+
String(capture.width),
|
|
1354
1585
|
"-height",
|
|
1355
|
-
String(
|
|
1586
|
+
String(capture.height),
|
|
1356
1587
|
"-x",
|
|
1357
1588
|
"0",
|
|
1358
1589
|
"-y",
|
|
@@ -1368,7 +1599,7 @@ async function runCapture(entry, install) {
|
|
|
1368
1599
|
if (open.status !== 0) throw new Error(`wallpaper-engine-open-failed:${open.status ?? "unknown"}`);
|
|
1369
1600
|
await delay(2200);
|
|
1370
1601
|
updateProgress(entry.id, 10);
|
|
1371
|
-
const presented = runDesktopScript("present", location,
|
|
1602
|
+
const presented = runDesktopScript("present", location, capture.width, capture.height);
|
|
1372
1603
|
if (presented !== "ok") throw new Error(`scene-window-present-failed:${presented ?? "script-error"}`);
|
|
1373
1604
|
await delay(600);
|
|
1374
1605
|
updateProgress(entry.id, 15);
|
|
@@ -1390,16 +1621,23 @@ async function runCapture(entry, install) {
|
|
|
1390
1621
|
if (hotkey.status !== 0) throw new Error(`wcap-hotkey-failed:${hotkey.status ?? "unknown"}`);
|
|
1391
1622
|
for (let second = 0; second < 16; second += 1) {
|
|
1392
1623
|
await delay(1e3);
|
|
1393
|
-
updateProgress(entry.id, 15 + (second + 1) / 16 *
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1624
|
+
updateProgress(entry.id, 15 + (second + 1) / 16 * 70);
|
|
1625
|
+
if (second >= 12 && newestMp4(jobDir) !== null) break;
|
|
1626
|
+
}
|
|
1627
|
+
// TIANLIGHT v2.3.1: a plateauled file is not necessarily a finished file.
|
|
1628
|
+
// The recorder writes its index after the last frame, and a heavy scene can
|
|
1629
|
+
// take longer than the old 600 ms size plateau. Wait for the process to exit
|
|
1630
|
+
// (bounded), require the size to hold, then read the container structure
|
|
1631
|
+
// before anything is copied into the cache.
|
|
1632
|
+
await settleRecorder(activeRecorder, 12e3);
|
|
1633
|
+
const recorded = await stableMp4(jobDir, 8e3);
|
|
1634
|
+
if (recorded === null) throw new Error("wcap-output-not-found");
|
|
1635
|
+
const probe = inspectSceneMp4(recorded);
|
|
1636
|
+
if (!probe.ok) {
|
|
1637
|
+
rmSync(recorded, { force: true });
|
|
1638
|
+
throw new Error(`wcap-output-invalid:${probe.reason}`);
|
|
1400
1639
|
}
|
|
1401
|
-
|
|
1402
|
-
if (recorded === null || statSync(recorded).size < 512 * 1024) throw new Error("wcap-output-not-found");
|
|
1640
|
+
updateProgress(entry.id, 92);
|
|
1403
1641
|
const finalPath = sceneVideoCachePath(entry.id);
|
|
1404
1642
|
const tempPath = `${finalPath}.tmp-${process.pid}`;
|
|
1405
1643
|
copyFileSync(recorded, tempPath);
|
|
@@ -1409,9 +1647,9 @@ async function runCapture(entry, install) {
|
|
|
1409
1647
|
version: 2,
|
|
1410
1648
|
id: entry.id,
|
|
1411
1649
|
projectMtimeMs: projectMtime(entry),
|
|
1412
|
-
width:
|
|
1413
|
-
height:
|
|
1414
|
-
duration:
|
|
1650
|
+
width: capture.width,
|
|
1651
|
+
height: capture.height,
|
|
1652
|
+
duration: SCENE_VIDEO_SECONDS,
|
|
1415
1653
|
createdAt: now()
|
|
1416
1654
|
};
|
|
1417
1655
|
writeFileSync(sceneVideoMetaPath(entry.id), JSON.stringify(meta), "utf8");
|
|
@@ -2857,5 +3095,5 @@ const __we = {
|
|
|
2857
3095
|
listWeSkinItems,
|
|
2858
3096
|
weLibraryStatus,
|
|
2859
3097
|
};
|
|
2860
|
-
export { makeWeWallpaperRoutes, makeWeWallpaperHandler, WE_API_PREFIX, readState, writeState, normalizeRepkgPath, isAllowedLocalHost, disposeSceneVideoCapture, listWeSkinItems, weLibraryStatus };
|
|
3098
|
+
export { makeWeWallpaperRoutes, makeWeWallpaperHandler, WE_API_PREFIX, readState, writeState, normalizeRepkgPath, isAllowedLocalHost, disposeSceneVideoCapture, listWeSkinItems, weLibraryStatus, captureSize, inspectSceneMp4 };
|
|
2861
3099
|
export default __we;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-client-ui-skin-tianlight",
|
|
3
3
|
"description": "Tianlight skin for the dsh web GUI: Makoto Shinkai daylight skies, an 18.5s cinematic opening film / compact splash with a 0.4x low-end tier, delayed performance fallback, optional reduced-motion override and explicit hint/Esc skip, a looping video wallpaper, a wallpaper library with upload/rotation, optional WebWallGL scene support, and a draggable Mint chibi-cat desktop companion",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"bin": {
|
package/skin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "tianlight",
|
|
3
3
|
"name": "天光",
|
|
4
4
|
"nameEn": "TIANLIGHT",
|
|
5
|
-
"version": "2.3.
|
|
5
|
+
"version": "2.3.1",
|
|
6
6
|
"author": "local",
|
|
7
7
|
"tagline": "新海诚式天光 ・ 18.5 秒长片开机动画/简洁版(可选减少动态效果覆盖;仅提示/Esc 跳过) ・ 动态壁纸与可上传壁纸库 ・ 可选 WebWallGL 场景 ・ 薄荷小猫桌宠 ・ 职责通道(role pack → 桌宠气泡/选择) ・ 生活节奏与主动开口预算 ・ 可替换图片/≤32MiB 视频形象 ・ 液态玻璃三档 ・ 浅色/深色可切换(跟随 DSH / 随天光 / 揭开动效) ・ AI 桌宠(严格权限) ・ 接入 DSH Agent(受控) ・ 桌宠即入口 ・ 兼容 DSH 0.2.0–0.2.2",
|
|
8
8
|
"description": "天光是一套新海诚式日光天空主题:全屏循环视频壁纸与半透明天光玻璃面板,可选 18.5 秒长片或简洁版开机动画。壁纸库支持上传、轮播、标签与画面滤镜,并可接入 Wallpaper Engine 场景;桌宠「薄荷小猫」会陪你看时间、记事情、聊两句,角色中枢集中管理外观、生活节奏与权限。同一份构建适配 DSH 0.2.0 / 0.2.1 / 0.2.2。",
|