Files
Scoreboard/console/renderer/index.html
T
AskaEth 1b78c38bb8 feat(console): 开机自启默认关闭,服务管理窗口加手动开关
- DEFAULTS.startup.openAtLogin 与随包 config.json 默认改为 false;
  applyOpenAtLogin 只有显式 true 才注册登录项(缺省/null/false 都不注册)
- config.js 新增 updateConfig():只写回文件里已有的键 + 目标键,不把 DEFAULTS 落盘
- 主进程 setOpenAtLogin():改内存 → 写回 config.json → setLoginItemSettings,
  任一失败都回滚,返回 {ok, openAtLogin};状态快照新增 openAtLogin / openAtLoginSupported
- 渲染层:服务端状态卡片新增「开机自启」滑块(纯 CSS,无依赖),
  切换即时生效并有本地意图守卫,避免被随后到达的陈旧快照冲掉
- 文档:console/README.md 与 docs/部署指南.md 同步

注意:旧包 config.json 里已显式写 true 的用户升级后仍会自启(不悄悄改既有行为),
在窗口里关一次即可;全新安装默认不注册。
2026-09-10 00:06:59 +08:00

178 lines
6.7 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'none'"
/>
<title>赛事积分榜 · 服务管理</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<!-- 窗口是无边框的,标题栏和最小化/最大化/关闭三键都在这条上自绘 -->
<header id="titlebar" class="topbar">
<div class="brand">
<img class="brand-mark" src="scoreboard.png" alt="" width="30" height="30" />
<div>
<h1>赛事积分榜 · 服务管理</h1>
<p class="brand-sub">服务端守护 · 大屏投放</p>
</div>
</div>
<div class="topbar-right">
<span id="app-version" class="muted"></span>
<div class="win-controls">
<button id="win-min" class="win-btn" type="button" title="最小化" aria-label="最小化">
<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true">
<path d="M5 12h14" />
</svg>
</button>
<button id="win-max" class="win-btn" type="button" title="最大化" aria-label="最大化">
<svg class="icon-max" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true">
<rect x="5" y="5" width="14" height="14" rx="2" />
</svg>
<svg class="icon-restore" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true">
<rect x="4" y="8" width="12" height="12" rx="2" />
<path d="M8 8V6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2" />
</svg>
</button>
<button id="win-close" class="win-btn win-btn-close" type="button" title="关闭" aria-label="关闭">
<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true">
<path d="M6 6l12 12M18 6 6 18" />
</svg>
</button>
</div>
</div>
</header>
<main>
<section class="card">
<div class="card-head">
<h2>服务端状态</h2>
<div class="actions">
<button id="btn-start" class="btn primary" type="button">启动服务</button>
<button id="btn-stop" class="btn" type="button">停止服务</button>
<button id="btn-restart" class="btn" type="button">重启服务</button>
</div>
</div>
<div class="status-row">
<span id="state-dot" class="dot"></span>
<strong id="state-label">已停止</strong>
<span id="state-detail" class="muted"></span>
</div>
<dl class="kv">
<div>
<dt>服务地址</dt>
<dd id="k-url">—</dd>
</div>
<div>
<dt>进程 PID</dt>
<dd id="k-pid">—</dd>
</div>
<div>
<dt>自动重启</dt>
<dd id="k-restarts">—</dd>
</div>
<div>
<dt>防熄屏</dt>
<dd id="k-power">—</dd>
</div>
<div>
<dt>开机自启</dt>
<dd>
<label class="switch">
<input id="sw-open-at-login" type="checkbox" />
<span id="sw-open-at-login-label" class="muted">—</span>
</label>
</dd>
</div>
<div class="wide">
<dt>服务端程序</dt>
<dd id="k-exe" class="mono">—</dd>
</div>
<div class="wide">
<dt>配置文件</dt>
<dd id="k-config" class="mono">—</dd>
</div>
</dl>
<p id="config-warning" class="warning" hidden></p>
</section>
<section class="card">
<div class="card-head">
<h2>大屏窗口</h2>
<div class="actions">
<button id="btn-relayout" class="btn" type="button">重新排布</button>
<button id="btn-open-admin" class="btn" type="button">打开服务端管理面板</button>
</div>
</div>
<p class="hint">
单屏时窗口化、按 F11 切换全屏;多屏时除内置屏外(无内置屏时除主屏外)每块屏一个 kiosk 窗口,各锁一页。
</p>
<ul id="display-list" class="display-list">
<li class="muted">尚未打开大屏窗口</li>
</ul>
</section>
<section class="card">
<div class="card-head">
<h2>已连接的大屏实例</h2>
<span id="instances-summary" class="muted"></span>
</div>
<p class="hint">
来自服务端 <span class="mono">GET /api/display/instances</span>,每 5 秒刷新一次;
沿用服务端管理面板的登录态,需要记录员及以上权限。
</p>
<ul id="instance-list" class="display-list">
<li class="muted">正在读取…</li>
</ul>
</section>
<section class="card">
<div class="card-head">
<h2>管理员账号</h2>
<div class="actions">
<button id="btn-reset-account" class="btn" type="button">重置账号</button>
</div>
</div>
<p class="hint">
本机直接调用同目录的 <span class="mono">scoreboard.exe passwd</span>,无需登录验证。
重置会作废该用户的全部登录会话,已在用的管理面板会被强制退出。
</p>
<div class="form-row">
<label class="field">
<span>当前用户名</span>
<input id="acct-user" class="input" type="text" value="admin" autocomplete="off" spellcheck="false" />
</label>
<label class="field">
<span>新用户名(留空 = 不改)</span>
<input id="acct-new-user" class="input" type="text" autocomplete="off" spellcheck="false" />
</label>
<label class="field">
<span>新密码(留空 = 随机生成)</span>
<input id="acct-password" class="input" type="password" autocomplete="new-password" spellcheck="false" />
</label>
</div>
<p id="acct-status" class="hint" hidden></p>
<pre id="acct-output" class="log account-output" hidden></pre>
</section>
<section class="card log-card">
<div class="card-head">
<h2>运行日志</h2>
<div class="actions">
<label class="check"><input id="autoscroll" type="checkbox" checked /> 自动滚动</label>
<button id="btn-clear-log" class="btn" type="button">清空</button>
</div>
</div>
<pre id="log" class="log"></pre>
</section>
</main>
<script src="app.js"></script>
</body>
</html>