dsh-remote-ui 0.6.4-beta.2 → 0.6.4-beta.3

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/lib/client.js CHANGED
@@ -142,6 +142,8 @@ window.__ModuleLoader__.load({
142
142
  ".dru-popup-foot button:hover{color:#0969da}",
143
143
  ".dru-popup .dru-msg{text-align:left}",
144
144
  ".dru-community-qr{display:block;width:220px;max-width:62vw;margin:0 auto;background:#ffffff;padding:10px;border-radius:10px;border:1px solid #d0d7de;box-sizing:content-box}",
145
+ ".dru-restart-auto{display:flex;align-items:center;gap:8px;margin-top:10px;font-size:12.5px;color:#1a7f37;background:#dafbe1;border-radius:8px;padding:8px 10px}",
146
+ ".dru-restart-auto.muted{color:#57606a;background:#f6f8fa}",
145
147
  ".dru-fb-community{margin-top:16px;padding-top:14px;border-top:1px dashed #d0d7de;text-align:center}",
146
148
  ".dru-fb-community .dru-community-qr{width:180px;max-width:56vw}",
147
149
  // ── 自管理:版本与更新(插件面板内提供在线更新/彻底卸载,市场无更新按钮) ──
@@ -1189,6 +1191,10 @@ window.__ModuleLoader__.load({
1189
1191
  // ── 💬 交流群(「加入交流群」按钮 + 弹窗):同样放在全部既有字段之后 ──
1190
1192
  var communityArr = useState(null); var community = communityArr[0]; var setCommunity = communityArr[1]; // {qrcode,wechat};null=未加载
1191
1193
  var commOpenArr = useState(false); var commOpen = commOpenArr[0]; var setCommOpen = commOpenArr[1];
1194
+ // 【自动化】重启倒计时 / 是否已被用户取消(初值按本次 pending 事件的持久化标记,跨刷新生效)
1195
+ var restartCancelArr = useState(function () { return autoRestartCancelled((st && st.restart && st.restart.at) || 0); });
1196
+ var restartCancelled = restartCancelArr[0]; var setRestartCancelled = restartCancelArr[1];
1197
+ var restartCountArr = useState(null); var restartCountdown = restartCountArr[0]; var setRestartCountdown = restartCountArr[1];
1192
1198
  // ── 🔗 登录后自动闭环:连接阶段(运行环境 → bridge 进程 → 设备已在中继注册=online) ──
1193
1199
  // conn 来自 GET /dsh-remote/bridge-status(node 半在返回前会自动补装/拉起/退避重试),
1194
1200
  // 面板据它显示「正在准备运行环境…/正在启动 Bridge…/正在连接中继…/已连接 ✅」,
@@ -1861,6 +1867,25 @@ window.__ModuleLoader__.load({
1861
1867
  });
1862
1868
  };
1863
1869
 
1870
+ /**
1871
+ * 【自动化】首次安装/在线更新后自动重启 DeepSeek harness —— 用户不需要点任何按钮。
1872
+ *
1873
+ * 为什么能自动:① 重启只是重启 dsh web(bridge 与手机端连接不受影响);② 重启后
1874
+ * waitHarnessBack 会轮询到它回来并**自动刷新页面**,面板与「连接中→已连接」流程继续跑完。
1875
+ * 安全阀:① 面板不可见(用户没在看)→ 不计时,回来再继续;② 15 秒倒计时内可一键取消,
1876
+ * 取消标记按本次 pending 事件(at 时间戳)持久化,同一事件不再自动重启(下次安装/更新会重新触发);
1877
+ * ③ 面板上有其他操作在跑(busy≠"")→ 暂停计时,避免打断用户正在做的事。
1878
+ */
1879
+ var AUTO_RESTART_DELAY_MS = 15000;
1880
+ var RESTART_CANCEL_KEY = "dsh-remote-auto-restart-cancelled";
1881
+
1882
+ function autoRestartCancelled(at) {
1883
+ try { return localStorage.getItem(RESTART_CANCEL_KEY) === String(at || ""); } catch (e) { return false; }
1884
+ }
1885
+ function markAutoRestartCancelled(at) {
1886
+ try { localStorage.setItem(RESTART_CANCEL_KEY, String(at || "")); } catch (e) { /* 忽略 */ }
1887
+ }
1888
+
1864
1889
  /** 轮询等待 harness 回来;观察到「断过又恢复」或等待足够久后自动刷新页面。 */
1865
1890
  var waitHarnessBack = function (tries, sawDown) {
1866
1891
  if (tries > 40) { setMsg("err", "重启后仍未就绪,请手动刷新页面或重启 DeepSeek harness。"); setBusy(""); return; }
@@ -2402,6 +2427,31 @@ window.__ModuleLoader__.load({
2402
2427
  );
2403
2428
  }
2404
2429
 
2430
+ // 【自动化】待重启时自动倒计时重启(见 autoRestartCancelled 说明);倒计时只在面板可见且无其他操作时推进
2431
+ useEffect(function () {
2432
+ if (!restartPending || busy !== "" || restartCancelled) { setRestartCountdown(null); return undefined; }
2433
+ var at = restartInfo.at || 0;
2434
+ if (autoRestartCancelled(at)) { setRestartCountdown(null); return undefined; }
2435
+ var left = Math.round(AUTO_RESTART_DELAY_MS / 1000);
2436
+ setRestartCountdown(left);
2437
+ var iv = setInterval(function () {
2438
+ if (document.hidden) return; // 用户没在看 → 暂停计时
2439
+ left -= 1;
2440
+ if (left > 0) { setRestartCountdown(left); return; }
2441
+ clearInterval(iv);
2442
+ setRestartCountdown(0);
2443
+ restartHarness(); // 已有实现:重启 + 轮询等它回来 + 自动刷新页面
2444
+ }, 1000);
2445
+ return function () { clearInterval(iv); };
2446
+ }, [restartPending, restartInfo.at, busy, restartCancelled]);
2447
+
2448
+ /** 取消本次自动重启(按事件持久化:同一 pending 事件不再自动重启)。 */
2449
+ var cancelAutoRestart = function () {
2450
+ markAutoRestartCancelled(restartInfo.at || 0);
2451
+ setRestartCancelled(true);
2452
+ setRestartCountdown(null);
2453
+ };
2454
+
2405
2455
  /** 交流群弹窗(复用满意度弹窗的 dru-popup 视觉;点遮罩/关闭即收起)。 */
2406
2456
  function renderCommunityModal() {
2407
2457
  if (!commOpen || !(community && community.qrcode)) return null;
@@ -2442,13 +2492,32 @@ window.__ModuleLoader__.load({
2442
2492
  restartInfo.kind === "update" ? "在线更新已完成,需要重启 DeepSeek harness" : "首次安装需要重启 DeepSeek harness"),
2443
2493
  h("div", { className: "dru-restart-alert-sub" },
2444
2494
  "插件本体与「远程访问」面板是在 DeepSeek harness 启动时装载的,重启之后即可正常使用(账号、二维码、bridge 全部生效)。"),
2495
+ // 【自动化】待重启时自动倒计时重启(用户零操作);倒计时期间可一键取消
2496
+ restartCountdown !== null && restartCountdown > 0
2497
+ ? h("div", { className: "dru-restart-auto", role: "status" },
2498
+ h("span", { className: "loading" }),
2499
+ h("span", null, "安装已完成,将在 " + restartCountdown + " 秒后自动重启 DeepSeek harness(页面会自动恢复,无需操作)"))
2500
+ : null,
2501
+ restartCountdown === 0
2502
+ ? h("div", { className: "dru-restart-auto", role: "status" }, h("span", { className: "loading" }), h("span", null, "正在自动重启…"))
2503
+ : null,
2504
+ restartCancelled && restartCountdown === null
2505
+ ? h("div", { className: "dru-restart-auto muted" }, "已取消自动重启 —— 你也可以随时点下面的按钮完成安装")
2506
+ : null,
2445
2507
  h("div", { className: "dru-actions", style: { marginTop: 10 } },
2446
2508
  h("button", {
2447
2509
  type: "button",
2448
2510
  className: "dru-btn dru-btn-primary",
2449
2511
  disabled: busy !== "",
2450
2512
  onClick: function () { restartHarness(); }
2451
- }, busy === "restart" ? "重启中…" : "重启 DeepSeek harness")
2513
+ }, busy === "restart" ? "重启中…" : (restartCountdown !== null && restartCountdown > 0 ? "立即重启(不用等)" : "重启 DeepSeek harness")),
2514
+ restartCountdown !== null && restartCountdown > 0
2515
+ ? h("button", {
2516
+ type: "button",
2517
+ className: "dru-btn dru-btn-ghost",
2518
+ onClick: cancelAutoRestart
2519
+ }, "取消自动重启")
2520
+ : null
2452
2521
  )
2453
2522
  )
2454
2523
  )
package/lib/index.js CHANGED
@@ -1723,7 +1723,7 @@ const PLUGIN_ID = "dsh-remote-ui";
1723
1723
  const PLUGIN_LEGACY_IDS = ["dsh-remote-web"];
1724
1724
  const PLUGIN_ALL_IDS = [PLUGIN_ID, ...PLUGIN_LEGACY_IDS];
1725
1725
  /** 插件自身发布版本(与 dsh-remote 根包同步递增)。 */
1726
- const PLUGIN_VERSION = "0.6.4-beta.2";
1726
+ const PLUGIN_VERSION = "0.6.4-beta.3";
1727
1727
  const UPDATE_LOG = ".dsh-update.log";
1728
1728
  const UPDATE_MARKER = ".dsh-update-running";
1729
1729
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-remote-ui",
3
- "version": "0.6.4-beta.2",
3
+ "version": "0.6.4-beta.3",
4
4
  "description": "【兼容别名包】dsh-remote 旧名 dsh-remote-ui 的别名,功能与 dsh-remote-web 完全一致(同一份代码同步生成)。 Legacy alias of dsh-remote-web — identical build, kept installable while the renamed entry is pending review. 公网远程控制 DeepSeek Harness(dsh web):安装即得专属加密地址,人在外面也能用手机访问电脑上的 dsh——无需同一局域网/WiFi、无需公网 IP 与内网穿透,全程加密;手机端 100% 还原电脑体验(对话/工具/审批/设置)。技术用户可选自建服务,流量走自己的服务器。Remote control DeepSeek Harness (dsh web) from anywhere over the public internet — install, get an encrypted URL, use it from your phone on any network (dual-half cordis plugin: Settings panel + same-origin /dsh-remote routes). (2026-09 由 dsh-remote-ui 更名 / renamed from dsh-remote-ui; dsh-remote 的 dsh web 插件半,不是纯 UI/皮肤插件)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",