build: 内网环境下跳过 Windows node-pty 补丁构建并关闭 GitHub 发布
Some checks failed
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
Star History / update (push) Has been cancelled

调整 electron-builder 配置,Windows 平台仅打包 zip 格式,注释掉 NSIS 和 portable 目标;
注释掉 Windows Hello helper 资源配置以避免路径不存在导致的打包失败;
将发布配置设为 null 以关闭 GitHub 发布请求;
修改 afterPack 脚本,跳过 Windows 下 node-pty ConPTY 补丁的重建和复制,因内网无 MSVC 工具链无法完成该操作。
This commit is contained in:
2026-10-15 15:30:31 +08:00
parent 2561001dca
commit 336c3afd47
7 changed files with 152 additions and 139 deletions

View File

@@ -19,7 +19,6 @@ const dailyReportStore = require("./dailyReportStore.cjs");
let _tickTimer = null;
let _dailyTimer = null;
let _lastDailyTriggerKey = null; // 用于 HH:MM 日报告每日只触发一次
let _deviceLastRun = new Map(); // deviceId → timestamp(用于 per-device interval)
/**
* 启动 reportScheduler
@@ -39,11 +38,19 @@ function start({ readStorage, writeStorage, runSnapshotFn, onDailyReportReady, g
const tick = async () => {
const cfg = reportScheduleStore.getSchedule(readFn);
// 临时验证:忽略 cfg.enabled
// if (!cfg.enabled) return;
if (!cfg.enabled) return;
const now = Date.now();
const dueTargets = [];
const intervalMs = (cfg.defaultIntervalHours || 1) * 3600 * 1000;
const lastRun = cfg.lastRunAt || 0;
const sinceLast = now - lastRun;
// 还没到间隔就跳过
if (lastRun > 0 && sinceLast < intervalMs) {
const remainingMin = ((intervalMs - sinceLast) / 60000).toFixed(1);
console.log(`[reportScheduler] tick: 未到间隔,还需 ${remainingMin} 分钟`);
return;
}
// null/undefined = 全部;空数组 = 不巡检;非空数组 = 指定设备
let deviceIds = cfg.enabledDeviceIds;
@@ -51,7 +58,6 @@ function start({ readStorage, writeStorage, runSnapshotFn, onDailyReportReady, g
// 全部设备 —— 通过回调拿(由调用方注入,避免依赖不存在的 deviceStore.listDevices)
if (typeof _getAllDeviceIds === "function") {
deviceIds = _getAllDeviceIds();
console.error("[reportScheduler] tick: enabledDeviceIds=null, _getAllDeviceIds →", deviceIds?.length || 0, "台");
} else {
console.error("[reportScheduler] ❌ 无 getAllDeviceIds 回调,跳过");
return;
@@ -59,37 +65,35 @@ function start({ readStorage, writeStorage, runSnapshotFn, onDailyReportReady, g
} else if (Array.isArray(deviceIds) && deviceIds.length === 0) {
console.log("[reportScheduler] tick: enabledDeviceIds=[], 跳过(不巡检任何设备)");
return;
} else {
console.log("[reportScheduler] tick: enabledDeviceIds 非空数组 →", JSON.stringify(deviceIds));
}
for (const deviceId of deviceIds || []) {
if (!reportScheduleStore.isDeviceEnabled(readFn, deviceId)) continue;
// 临时验证:强制 2 分钟间隔 + 首次立即触发
const intervalMs = 2 * 60 * 1000;
const lastRun = _deviceLastRun.get(deviceId) || 0;
if (now - lastRun >= intervalMs) {
dueTargets.push(deviceId);
}
// 过滤掉 isDeviceEnabled=false 的(disabled 状态)
const enabledDeviceIds = (deviceIds || []).filter(id =>
reportScheduleStore.isDeviceEnabled(readFn, id)
);
if (enabledDeviceIds.length === 0) {
console.log("[reportScheduler] tick: 0 台设备启用,跳过");
return;
}
console.log("[reportScheduler] tick: 总设备", deviceIds?.length || 0, "台, 到点", dueTargets.length, "台");
if (dueTargets.length === 0) return;
console.log(`[reportScheduler] tick: ${dueTargets.length} 台设备到点,interval=${cfg.defaultIntervalHours}h`);
console.log(`[reportScheduler] tick: 到点,${enabledDeviceIds.length} 台设备,interval=${cfg.defaultIntervalHours}h,距上次 ${(sinceLast/60000).toFixed(1)} 分钟`);
try {
await runSnapshotFn(dueTargets, "scheduled");
for (const id of dueTargets) _deviceLastRun.set(id, now);
await runSnapshotFn(enabledDeviceIds, "scheduled");
// 持久化 lastRunAt —— 重启 Electron 也知道上次什么时候跑的
const merged = { ...cfg, lastRunAt: now };
reportScheduleStore.saveSchedule(writeFn, merged);
console.log("[reportScheduler] ✅ 快照完成,lastRunAt 已持久化");
} catch (e) {
console.error("[reportScheduler] runSnapshot 失败:", e?.message || String(e));
}
};
// 临时验证:启动后立刻执行一次 tick(不等间隔)
console.log("[reportScheduler] 启动,立即执行首次 tick");
tick().catch(e => console.error("[reportScheduler] 首次 tick 异常:", e));
// 启动后等 60s tick 自动处理第一次(不立即触发,避免重启爆发)
console.log("[reportScheduler] 已启动,间隔", (cfg.defaultIntervalHours || 1), "h,下次 tick 检查在 60s 后");
// 临时验证:每 5 秒 tick 一次
_tickTimer = setInterval(() => { tick().catch(e => console.error("[reportScheduler] tick 异常:", e)); }, 5 * 1000);
// 每 60 秒 tick 一次
_tickTimer = setInterval(() => { tick().catch(e => console.error("[reportScheduler] tick 异常:", e)); }, 60 * 1000);
_tickTimer.unref?.();
// 每秒检查是否到 dailyReportTime(HH:MM 精确匹配,每日只触发一次)
@@ -117,8 +121,6 @@ function start({ readStorage, writeStorage, runSnapshotFn, onDailyReportReady, g
};
_dailyTimer = setInterval(dailyCheck, 30 * 1000);
_dailyTimer.unref?.();
console.log("[reportScheduler] 已启动");
}
function stop() {