feat(desktop,island,shared): 灵动岛支持多条通知竖排列表 + 触摸模式 + 收回动画,产物加凭据门禁
灵动岛列表:多条通知时展开为竖排列表,默认显示 3 条,点「展开更多」铺到屏幕容纳 上限,放不下的收进「更多请前往应用内操作」。卡片高度由主进程与渲染进程各算一次 同一个数 —— 度量表 ISLAND_LIST_METRICS 与排序权重 PRIORITY_RANK 放在 shared, 窗口包围盒随之长高(不够高会把底部按钮裁掉)。 触摸模式:触摸屏上手指既不产生 mousemove、也不移动系统光标,原先两条命中链路都会 让窗口永远停在穿透态、手指点不开岛。现按 navigator.maxTouchPoints 上报后,主进程把 窗口贴合岛体并始终接收输入;非触摸屏机器完全不走这条路。 收回动画:main 先发 island:closing,渲染进程形变收敛后回 closing-done 才淡出, 不再靠猜时长(rAF 被节流时会把卡片缩到一半窗口就没了)。 安全门禁:新增 scripts/check-bundle-secrets.mjs 并接进 build:desktop —— dist 产物会被打进 app.asar 发到每台学生机、且可解包,冒烟凭据一律改由环境变量注入, 产物里出现种子口令即构建失败。
This commit is contained in:
1 parent
d27f9a4b9e
commit
3880eee08e
22 files changed
+2482
-175
No files matched your search
@@ -12,7 +12,7 @@
|
||||
* node scripts/dist-win.mjs # nsis 安装包 + portable 单文件
|
||||
* node scripts/dist-win.mjs --dir # 仅生成免安装目录 release/win-unpacked
|
||||
*/
|
||||
import { spawn } from 'node:child_process';
|
||||
import { execFileSync, spawn } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
@@ -24,8 +24,17 @@ const args = process.argv.slice(2);
|
||||
const dirOnly = args.includes('--dir');
|
||||
const passthrough = args.filter((item) => item !== '--dir');
|
||||
|
||||
// makensis 会在 %TEMP% 所在位置建临时文件:Git Bash 里 TEMP=/tmp 是 MSYS 路径,
|
||||
// 原生程序会把它当成「当前盘根下的 tmp」(D:\tmp,不存在)而报
|
||||
// `!tempfile: Unable to create temporary file!`,NSIS 那一步就失败(磁盘并不紧张)。
|
||||
// 统一指到仓库内的真实目录,避开宿主终端带来的环境差异。
|
||||
const tmpDir = path.join(repoRoot, '.cache', 'tmp');
|
||||
fs.mkdirSync(tmpDir, { recursive: true });
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
TEMP: tmpDir,
|
||||
TMP: tmpDir,
|
||||
ELECTRON_MIRROR: process.env.ELECTRON_MIRROR ?? 'https://cdn.npmmirror.com/binaries/electron/',
|
||||
ELECTRON_BUILDER_BINARIES_MIRROR:
|
||||
process.env.ELECTRON_BUILDER_BINARIES_MIRROR ??
|
||||
@@ -60,11 +69,56 @@ console.log('[dist] electron-builder', cliArgs.slice(1).join(' '));
|
||||
const runtime = resolveNodeRuntime();
|
||||
console.log(`[dist] Node 运行时:${runtime.path}(${runtime.version})`);
|
||||
|
||||
// 清理上一轮产物:本仓库目录树带沙箱 ACL(含 Everyone 的 DENY(delete child)),
|
||||
// 已存在的产物会被工具(makensis / 7za)判为"Can't open output file / 拒绝访问"而失败,
|
||||
// 手动删掉再打包即可 —— 顺手也保证产物集合确定,不会残留上一轮的旧安装包。
|
||||
const outputDir = path.join(root, 'release');
|
||||
if (fs.existsSync(outputDir)) {
|
||||
for (const name of fs.readdirSync(outputDir)) {
|
||||
if (!/\.(exe|7z|blockmap|yml)$/i.test(name)) continue;
|
||||
try {
|
||||
fs.rmSync(path.join(outputDir, name), { force: true });
|
||||
} catch (error) {
|
||||
console.warn(`[dist] 无法清理旧产物 ${name}:${error.message}`);
|
||||
}
|
||||
}
|
||||
console.log('[dist] 已清理上一轮的安装包 / 归档');
|
||||
}
|
||||
|
||||
const child = spawn(runtime.path, cliArgs, { cwd: root, stdio: 'inherit', env });
|
||||
|
||||
/**
|
||||
* 把交付产物的完整性标签修正为 Medium(Windows)。
|
||||
*
|
||||
* 背景(踩过一次,代价是"客户端装不上、便捷版也双击没反应"):
|
||||
* 本仓库目录树被宿主沙箱打上了 `Low Mandatory Level` 标签(可继承),
|
||||
* 因此在仓库内构建出的 exe 自身也带 Low 标签。Windows 会把这类进程降到 Low 完整性,
|
||||
* 于是 setup.exe 写不进 `%LOCALAPPDATA%`(报"拒绝访问"→ 装不上)、
|
||||
* 便捷版解不出 `%TEMP%`(→ 起不来);即使装上了,Low 标签的应用文件也会让
|
||||
* Chromium 的 AppContainer 子进程读不到(0x80000003 秒崩)。
|
||||
*
|
||||
* 要点:**只有交付物自身的标签要紧**。归档内部的载荷标签不会被还原
|
||||
* (装到正常位置得到的是默认 Medium 文件),所以打包完成后再统一修正即可 ——
|
||||
* 反过来说,不能在打包前把 appOutDir 改成 Medium:那样 7za(自身 Low)
|
||||
* 会因"不能向上读/写"而无法生成归档。
|
||||
*/
|
||||
function normalizeIntegrityLabel(dir) {
|
||||
if (process.platform !== 'win32') return;
|
||||
const run = (args) => execFileSync('icacls', args, { stdio: 'pipe', windowsHide: true });
|
||||
try {
|
||||
run([dir, '/setintegritylevel', 'Medium', '/T', '/C']);
|
||||
// 目录自身恢复为"继承父目录的 Low",保证下次构建时 Low 的 7za 仍能写入归档
|
||||
run([dir, '/setintegritylevel', '(OI)(CI)Low']);
|
||||
console.log('[dist] 已修正交付物完整性标签为 Medium,目录恢复继承:', dir);
|
||||
} catch (error) {
|
||||
console.warn('[dist] 完整性标签修正跳过:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
child.on('exit', (code) => {
|
||||
if (code === 0) {
|
||||
const output = path.join(root, 'release');
|
||||
normalizeIntegrityLabel(output);
|
||||
console.log('\n[dist] 打包完成,产物目录:', output);
|
||||
}
|
||||
process.exit(code ?? 1);
|
||||
|
||||
Reference in new issue
Block a user