|
|
@@ -19,6 +19,13 @@
|
|
|
.topbar { height:56px; background:#fff; border-bottom:1px solid #e4e7ed; display:flex; align-items:center; padding:0 20px; gap:14px; }
|
|
|
.topbar b { font-size:14px; }
|
|
|
.topbar .sub { color:#909399; font-size:12px; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
|
+ .upd-banner { display:none; align-items:center; gap:10px; background:#fff7ed; border-bottom:1px solid #fdba74;
|
|
|
+ color:#9a3412; padding:8px 20px; font-size:12.5px; }
|
|
|
+ .upd-banner.show { display:flex; }
|
|
|
+ .upd-banner b { color:#c2410c; }
|
|
|
+ .upd-banner .btn-ok { margin-left:auto; height:26px; padding:0 12px; line-height:24px; border-radius:4px;
|
|
|
+ border:1px solid #fdba74; background:#fff; color:#b45309; cursor:pointer; font-size:12px; white-space:nowrap; }
|
|
|
+ .upd-banner .btn-ok:hover { background:#fef3c7; }
|
|
|
.topbar input { height:32px; border:1px solid #dcdfe6; border-radius:4px; padding:0 10px; width:220px; outline:none; }
|
|
|
.topbar input:focus { border-color:#2563eb; }
|
|
|
.topbar a.btn, .topbar .btn { height:30px; padding:0 12px; line-height:28px; border-radius:4px; font-size:12px; cursor:pointer; text-decoration:none; border:1px solid #dcdfe6; color:#606266; background:#fff; white-space:nowrap; }
|
|
|
@@ -59,6 +66,10 @@
|
|
|
<div id="domains"></div>
|
|
|
</div>
|
|
|
<div class="mid">
|
|
|
+ <div class="upd-banner" id="updBanner">
|
|
|
+ 🔔 <b>原型有更新:</b><span id="updText"></span>
|
|
|
+ <button class="btn-ok" onclick="ackSync()">✔ 我已同步(proto_sync)</button>
|
|
|
+ </div>
|
|
|
<div class="topbar">
|
|
|
<b>原型门户</b>
|
|
|
<span class="sub" id="subTitle"></span>
|
|
|
@@ -145,6 +156,40 @@ function closePv() {
|
|
|
curPage = null; render();
|
|
|
}
|
|
|
render();
|
|
|
+/* ── 协同提醒:轮询 wedo-hub,他人有新改动时横幅提示(本页无法执行git,同步动作交给AI/MCP) ── */
|
|
|
+(function () {
|
|
|
+ var H = window.PROTO_META.hub;
|
|
|
+ if (!H || !H.url) return;
|
|
|
+ var LS = "wedo_lastSynced_" + (H.repo || "default");
|
|
|
+ function fetchAll() {
|
|
|
+ return fetch(H.url.replace(/\/$/, "") + "/events?repo=" + encodeURIComponent(H.repo || "") + "&since=0",
|
|
|
+ { headers: H.token ? { "x-wedo-token": H.token } : {} }).then(function (r) { return r.json(); });
|
|
|
+ }
|
|
|
+ function check() {
|
|
|
+ fetchAll().then(function (d) {
|
|
|
+ var evs = (d && d.events) || [];
|
|
|
+ if (!evs.length) return;
|
|
|
+ var last = evs[evs.length - 1];
|
|
|
+ var mine = localStorage.getItem(LS);
|
|
|
+ if (mine === null) { localStorage.setItem(LS, String(last.ts)); return; } /* 首访以最新为基线,不误报 */
|
|
|
+ if (last.ts > Number(mine)) {
|
|
|
+ var t = new Date(last.ts), hh = ("0" + t.getHours()).slice(-2) + ":" + ("0" + t.getMinutes()).slice(-2);
|
|
|
+ document.getElementById("updText").textContent =
|
|
|
+ last.user + " 于 " + hh + " " + last.message + " —— 请让 AI 执行 proto_sync {pull:true} 同步后刷新本页";
|
|
|
+ document.getElementById("updBanner").classList.add("show");
|
|
|
+ }
|
|
|
+ }).catch(function () { /* hub不可达:静默,不影响浏览 */ });
|
|
|
+ }
|
|
|
+ window.ackSync = function () {
|
|
|
+ document.getElementById("updBanner").classList.remove("show");
|
|
|
+ fetchAll().then(function (d) {
|
|
|
+ var evs = (d && d.events) || [];
|
|
|
+ if (evs.length) localStorage.setItem(LS, String(evs[evs.length - 1].ts));
|
|
|
+ }).catch(function () { });
|
|
|
+ };
|
|
|
+ check();
|
|
|
+ setInterval(check, 2 * 60 * 1000);
|
|
|
+})();
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|