feat(1.0.3): 隐藏设置页「授权与统计」内部信息,版本接口不再下发机器码/安装编号,关闭上报改走 HUB_DISABLED

This commit is contained in:
jinghui committed 2026-10-27 15:05:05 +08:00
1 parent b0680ddda6
commit 596b8c6a27
7 files changed
+14 -47

No files matched your search

+4 -8
View File
@@ -16,6 +16,7 @@ const HEARTBEAT_MS = Number(process.env.HUB_HEARTBEAT_MS || 30 * 60 * 1000);
const CHECK_MS = Number(process.env.HUB_CHECK_MS || 6 * 60 * 60 * 1000);
const ANN_MS = Number(process.env.HUB_ANN_MS || 10 * 60 * 1000);
const TIMEOUT_MS = Number(process.env.HUB_TIMEOUT_MS || 8000);
const HUB_DISABLED = /^(1|true|yes)$/i.test(process.env.HUB_DISABLED || '');
const state = {
machine_id: '',
@@ -165,7 +166,7 @@ async function loadAnnouncements(force = false) {
async function refresh(force = false) {
const s = getSettings() || {};
snapshot.enabled = s.telemetry !== false;
snapshot.enabled = !HUB_DISABLED && s.telemetry !== false;
snapshot.current = appVersion;
try {
await loadAnnouncements(force); // 公告只读,不受统计开关影响
@@ -202,13 +203,8 @@ function stop() { if (timer) clearInterval(timer); }
function getSnapshot() {
snapshot.current = appVersion;
return {
...snapshot,
machine_id: state.machine_id,
install_id: state.install_id,
installed_at: state.installed_at,
last_heartbeat: state.last_heartbeat || null,
};
// 注意:机器码 / 安装编号只留在服务端与授权中心,不下发到浏览器
return { ...snapshot };
}
module.exports = { start, stop, refresh, getSnapshot, checkUpdate, loadAnnouncements, state };