dsh-browser-cdp 1.7.11 → 1.9.6
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/CHANGELOG.de.md +350 -0
- package/CHANGELOG.es.md +350 -0
- package/CHANGELOG.fr.md +350 -0
- package/CHANGELOG.it.md +350 -0
- package/CHANGELOG.md +966 -0
- package/CHANGELOG.ru.md +350 -0
- package/README.md +56 -19
- package/bin/cdp-cast-worker.mjs +223 -2
- package/bin/cdp-render-worker.mjs +57 -4
- package/dsh-plugin.json +2 -2
- package/lib/client.js +936 -36
- package/lib/index.js +1747 -386
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/it.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/ko.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +26 -12
- package/runtime/ego-linux/src/chrome.mjs +66 -6
- package/runtime/ego-linux/src/paths.mjs +14 -6
package/lib/client.js
CHANGED
|
@@ -577,10 +577,13 @@ var watchEn = {
|
|
|
577
577
|
historyShow: "Show history",
|
|
578
578
|
noHistory: "No browsing history",
|
|
579
579
|
current: "current",
|
|
580
|
+
atQuote: "Quote whole page as an anchor report (@)",
|
|
581
|
+
atQuoted: "✓ Page anchor report quoted",
|
|
582
|
+
atQuoteFailed: "Anchor report failed",
|
|
580
583
|
refresh: "Refresh",
|
|
581
584
|
backToLive: "← Back to live",
|
|
582
585
|
dragHint: "Drag to move panel",
|
|
583
|
-
loginTitle: "
|
|
586
|
+
loginTitle: "If the page asks you to sign in, log in in the {where} on your desktop.",
|
|
584
587
|
loginBtn: "Logged in, save",
|
|
585
588
|
loginSaving: "Saving…",
|
|
586
589
|
loginSaved: "Saved {n} sessions",
|
|
@@ -588,7 +591,14 @@ var watchEn = {
|
|
|
588
591
|
loginFailed: "Save failed",
|
|
589
592
|
loginDismiss: "Dismiss",
|
|
590
593
|
captchaTitle: "⚠️ CAPTCHA detected",
|
|
591
|
-
captchaHint: "Complete verification in the
|
|
594
|
+
captchaHint: "Complete the verification manually in the {where}; the agent will continue after that.",
|
|
595
|
+
whereCdp: "“{label}” browser window",
|
|
596
|
+
whereEgo: "ego browser window",
|
|
597
|
+
whereTabbit: "Tabbit browser window",
|
|
598
|
+
whereLocal: "managed Chrome window",
|
|
599
|
+
whereGeneric: "agent browser window",
|
|
600
|
+
loginHeadless: "The active target is Lightpanda (headless) — there is no window to sign in or verify in. Switch to a headed target (CDP endpoint / local Chrome / ego CLI / Tabbit).",
|
|
601
|
+
loginSelfPersist: "This browser keeps the login in its own profile — nothing to save here.",
|
|
592
602
|
captchaDismiss: "Dismiss",
|
|
593
603
|
hintReset: "Reset · scroll to pan · Ctrl+scroll to zoom · double-click to reset",
|
|
594
604
|
hintPan: "Ctrl+scroll to zoom · Ctrl+drag to pan · double-click to reset",
|
|
@@ -643,7 +653,30 @@ var watchEn = {
|
|
|
643
653
|
linksLocalEnableHint: "Checked = auto mode may fall back to the managed local browser when the activated target is unreachable",
|
|
644
654
|
pickCardTitle: "Browser picks",
|
|
645
655
|
pickCardElements: "{n} element(s) picked",
|
|
646
|
-
pickCardRemove: "Remove these picks"
|
|
656
|
+
pickCardRemove: "Remove these picks",
|
|
657
|
+
pickCardSnapshotTag: "(capture-time snapshot)",
|
|
658
|
+
pickCardRecapture: "Recapture",
|
|
659
|
+
pickCardRecaptureHint: "Re-read this tab and overwrite the quoted report (same @ token)",
|
|
660
|
+
pickCardLive: "live",
|
|
661
|
+
trackAllOn: "全模式 · 全部 tab",
|
|
662
|
+
trackAllOff: "仅激活 tab",
|
|
663
|
+
trackAllHintOn: "全模式:space 内每个 tab 都单独报图,外框标出当前激活的那个。点一下回到仅激活。",
|
|
664
|
+
trackAllHintOff: "仅激活:只报激活 tab 的图。点一下切到全模式(track every tab)。",
|
|
665
|
+
pageRefresh: "Reload page",
|
|
666
|
+
pageRefreshHint: "Reload the agent page itself (Page.reload)",
|
|
667
|
+
openUrl: "Open URL",
|
|
668
|
+
openUrlHint: "Navigate the agent page to a URL",
|
|
669
|
+
openUrlPrompt: "URL to open in the agent browser",
|
|
670
|
+
sizeSyncOff: "🔒 Size lock",
|
|
671
|
+
sizeSyncOn: "🔓 Size sync",
|
|
672
|
+
sizeSyncHint: "Unlocked: dragging this panel resizes the REAL agent browser window. Click again to lock.",
|
|
673
|
+
sizePresets: "Presets",
|
|
674
|
+
sizePresetsHint: "Resize the agent browser window to a fixed aspect ratio",
|
|
675
|
+
maximizeWindow: "Maximize",
|
|
676
|
+
maximizeHint: "Maximize the real agent browser window",
|
|
677
|
+
resizeHint: "Drag to resize the real agent browser window",
|
|
678
|
+
sizeApiOutdated: "Size API not ready — restart DSH to load the new host build",
|
|
679
|
+
actionFailed: "Action failed"
|
|
647
680
|
};
|
|
648
681
|
var watchDict = {
|
|
649
682
|
en: watchEn,
|
|
@@ -676,10 +709,13 @@ var watchDict = {
|
|
|
676
709
|
historyShow: "历史浏览轨迹",
|
|
677
710
|
noHistory: "暂无浏览记录",
|
|
678
711
|
current: "当前",
|
|
712
|
+
atQuote: "将整页引用为锚点报告(@)",
|
|
713
|
+
atQuoted: "✓ 整页锚点报告已引用",
|
|
714
|
+
atQuoteFailed: "锚点报告失败",
|
|
679
715
|
refresh: "刷新",
|
|
680
716
|
backToLive: "← 返回实时",
|
|
681
717
|
dragHint: "拖动移动面板",
|
|
682
|
-
loginTitle: "需要账号登录时,请到桌面上那个
|
|
718
|
+
loginTitle: "需要账号登录时,请到桌面上那个 {where} 完成登录。",
|
|
683
719
|
loginBtn: "已登录,保存",
|
|
684
720
|
loginSaving: "保存中…",
|
|
685
721
|
loginSaved: "已保存 {n} 条会话",
|
|
@@ -687,7 +723,14 @@ var watchDict = {
|
|
|
687
723
|
loginFailed: "保存失败",
|
|
688
724
|
loginDismiss: "关闭提示",
|
|
689
725
|
captchaTitle: "⚠️ 检测到人机验证",
|
|
690
|
-
captchaHint: "请在桌面那个
|
|
726
|
+
captchaHint: "请在桌面那个 {where} 手动完成验证,agent 会继续。",
|
|
727
|
+
whereCdp: "「{label}」浏览器窗口",
|
|
728
|
+
whereEgo: "ego 浏览器窗口",
|
|
729
|
+
whereTabbit: "Tabbit 浏览器窗口",
|
|
730
|
+
whereLocal: "本机 Chrome 窗口(受管启动)",
|
|
731
|
+
whereGeneric: "agent 浏览器窗口",
|
|
732
|
+
loginHeadless: "当前激活的是 Lightpanda(无头引擎),没有可登录/验证的窗口;请切换到有头目标(CDP 端点 / 本机 Chrome / ego CLI / Tabbit)。",
|
|
733
|
+
loginSelfPersist: "登录态保存在该浏览器自己的 profile 里,无需手动落盘。",
|
|
691
734
|
captchaDismiss: "关闭提示",
|
|
692
735
|
hintReset: "已复位 · 滚轮滚动页面 · Ctrl+滚轮缩放 · 双击复位",
|
|
693
736
|
hintPan: "Ctrl+滚轮缩放 · Ctrl+拖动平移 · 双击复位",
|
|
@@ -742,7 +785,30 @@ var watchDict = {
|
|
|
742
785
|
linksLocalEnableHint: "勾选 = 允许 auto 模式在激活目标不可达时回落本机启动",
|
|
743
786
|
pickCardTitle: "浏览器点选内容",
|
|
744
787
|
pickCardElements: "已选 {n} 个元素",
|
|
745
|
-
pickCardRemove: "移除这段点选"
|
|
788
|
+
pickCardRemove: "移除这段点选",
|
|
789
|
+
pickCardSnapshotTag: "(点击时快照)",
|
|
790
|
+
pickCardRecapture: "重抓快照",
|
|
791
|
+
pickCardRecaptureHint: "重新读取这个 tab 并覆盖引用的报告(@ token 不变)",
|
|
792
|
+
pickCardLive: "实时",
|
|
793
|
+
trackAllOn: "全模式 · 全部 tab",
|
|
794
|
+
trackAllOff: "仅激活 tab",
|
|
795
|
+
trackAllHintOn: "全模式:space 内每个 tab 都单独出图,外框标出当前激活的那个;再点一下回到仅激活。",
|
|
796
|
+
trackAllHintOff: "仅激活:只出激活 tab 的图;点一下切到全模式(所有 tab 都跟踪)。",
|
|
797
|
+
pageRefresh: "刷新页面",
|
|
798
|
+
pageRefreshHint: "重新加载 agent 当前页面(Page.reload)",
|
|
799
|
+
openUrl: "打开网址",
|
|
800
|
+
openUrlHint: "让 agent 页面跳转到指定网址",
|
|
801
|
+
openUrlPrompt: "要在 agent 浏览器里打开的网址",
|
|
802
|
+
sizeSyncOff: "🔒 锁定尺寸",
|
|
803
|
+
sizeSyncOn: "🔓 尺寸同步",
|
|
804
|
+
sizeSyncHint: "解锁后拖动面板会直接改变 agent 浏览器真实窗口大小;再点一下锁定。",
|
|
805
|
+
sizePresets: "尺寸预设",
|
|
806
|
+
sizePresetsHint: "按固定比例设置 agent 浏览器窗口",
|
|
807
|
+
maximizeWindow: "最大化",
|
|
808
|
+
maximizeHint: "最大化真实 agent 浏览器窗口",
|
|
809
|
+
resizeHint: "拖动调整 agent 浏览器窗口大小",
|
|
810
|
+
sizeApiOutdated: "尺寸接口未就绪:请重启 DSH 以加载最新 host 构建",
|
|
811
|
+
actionFailed: "操作失败"
|
|
746
812
|
}
|
|
747
813
|
};
|
|
748
814
|
function wt(key, params = void 0) {
|
|
@@ -750,7 +816,31 @@ function wt(key, params = void 0) {
|
|
|
750
816
|
if (params) for (var k in params) text = text.replace(new RegExp("{" + k + "}", "g"), String(params[k]));
|
|
751
817
|
return text;
|
|
752
818
|
}
|
|
819
|
+
function linkWhere(link) {
|
|
820
|
+
var kind = link && link.kind || "";
|
|
821
|
+
var label = link && link.label || "";
|
|
822
|
+
if (kind === "lightpanda") return "";
|
|
823
|
+
if (kind === "ego-cli") return wt("whereEgo");
|
|
824
|
+
if (kind === "tabbit-cli") return wt("whereTabbit");
|
|
825
|
+
if (kind === "localhost" || kind === "local") return wt("whereLocal");
|
|
826
|
+
if (label) return wt("whereCdp", { label });
|
|
827
|
+
return wt("whereGeneric");
|
|
828
|
+
}
|
|
829
|
+
function linkLoginLine(link) {
|
|
830
|
+
if ((link && link.kind) === "lightpanda") return wt("loginHeadless");
|
|
831
|
+
return wt("loginTitle", { where: linkWhere(link) });
|
|
832
|
+
}
|
|
833
|
+
function linkCaptchaLine(link) {
|
|
834
|
+
if ((link && link.kind) === "lightpanda") return wt("loginHeadless");
|
|
835
|
+
return wt("captchaHint", { where: linkWhere(link) });
|
|
836
|
+
}
|
|
837
|
+
function linkFlushable(link) {
|
|
838
|
+
var kind = link && link.kind || "";
|
|
839
|
+
return kind !== "ego-cli" && kind !== "tabbit-cli" && kind !== "lightpanda";
|
|
840
|
+
}
|
|
753
841
|
const SPACES_ROUTE = "/api/bcdp/spaces";
|
|
842
|
+
const TRACKING_ROUTE = "/api/bcdp/tracking";
|
|
843
|
+
const SWITCH_TAB_ROUTE = "/api/bcdp/switch-tab";
|
|
754
844
|
const EGO_CLOSE_ROUTE = "/api/bcdp/close";
|
|
755
845
|
const WATCH_START_ROUTE = "/api/bcdp/watch/start";
|
|
756
846
|
const WATCH_SWITCH_ROUTE = "/api/bcdp/watch/switch";
|
|
@@ -770,6 +860,19 @@ function postJson(path, body) {
|
|
|
770
860
|
});
|
|
771
861
|
});
|
|
772
862
|
}
|
|
863
|
+
/** Make one tab the browser's active target (panel click = "show me that tab"). */
|
|
864
|
+
function switchTabRemote(targetId) {
|
|
865
|
+
if (targetId === void 0 || targetId === null || targetId === "") return Promise.resolve(null);
|
|
866
|
+
return postJson(SWITCH_TAB_ROUTE, { targetId: String(targetId) }).catch(function() {
|
|
867
|
+
return null;
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
/** 全模式 switch: GET returns the current value, POST flips it. */
|
|
871
|
+
function setTrackAllRemote(all) {
|
|
872
|
+
return postJson(TRACKING_ROUTE, { all }).catch(function() {
|
|
873
|
+
return null;
|
|
874
|
+
});
|
|
875
|
+
}
|
|
773
876
|
function createKeyboardProxy(send) {
|
|
774
877
|
var input = document.createElement("textarea");
|
|
775
878
|
input.className = "dsh-ego-keyboard-proxy";
|
|
@@ -1225,6 +1328,22 @@ const PANEL_CSS = `
|
|
|
1225
1328
|
}
|
|
1226
1329
|
.dsh-ego-back:hover { background: rgba(255,255,255,.2); }
|
|
1227
1330
|
.dsh-ego-back.dsh-ego-pick-on { background: rgba(56,189,248,.3); color: #7dd3fc; }
|
|
1331
|
+
.dsh-ego-back.on { background: rgba(217,119,87,.45); border-color: rgba(217,119,87,.7); }
|
|
1332
|
+
.dsh-ego-presets {
|
|
1333
|
+
display:inline-flex; gap:3px; padding:3px; border-radius:7px;
|
|
1334
|
+
background: rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.12);
|
|
1335
|
+
}
|
|
1336
|
+
.dsh-ego-preset-item {
|
|
1337
|
+
background:transparent; border:none; color:#f5f5f7; cursor:pointer;
|
|
1338
|
+
font-size:11px; padding:2px 7px; border-radius:5px;
|
|
1339
|
+
}
|
|
1340
|
+
.dsh-ego-preset-item:hover { background: rgba(255,255,255,.2); }
|
|
1341
|
+
/* live/active indication: the picture that belongs to the browser's ACTIVE tab
|
|
1342
|
+
gets a green frame (全模式 makes this the only way to tell them apart). */
|
|
1343
|
+
.dsh-ego-liveview.is-live img, .dsh-ego-liveview.is-live video {
|
|
1344
|
+
box-shadow: 0 0 0 2px #30d158, 0 0 14px rgba(48,209,88,.3);
|
|
1345
|
+
}
|
|
1346
|
+
.dsh-ego-tab.is-live .dsh-ego-tabdot { background:#30d158; box-shadow:0 0 6px #30d15888; }
|
|
1228
1347
|
.dsh-ego-liveimg {
|
|
1229
1348
|
width:100%; border-radius:11px; display:block;
|
|
1230
1349
|
max-height:50vh; object-fit:contain;
|
|
@@ -1253,9 +1372,17 @@ const PANEL_CSS = `
|
|
|
1253
1372
|
.dsh-ego-hitem { display:flex; gap:8px; align-items:center; padding:6px; border-radius:9px; cursor:pointer;
|
|
1254
1373
|
transition: background .15s ease; }
|
|
1255
1374
|
.dsh-ego-hitem:hover { background: rgba(255,255,255,.1); }
|
|
1375
|
+
.dsh-ego-hinfo { min-width:0; flex:1; }
|
|
1376
|
+
.dsh-ego-hat { flex:none; width:24px; height:24px; border-radius:7px; border:1px solid rgba(255,255,255,.16);
|
|
1377
|
+
background: rgba(0,0,0,.22); color:#f5f5f7; font-size:13px; line-height:1; cursor:pointer; opacity:0;
|
|
1378
|
+
transition: opacity .15s ease, background .15s ease; }
|
|
1379
|
+
.dsh-ego-hitem:hover .dsh-ego-hat { opacity:.85; }
|
|
1380
|
+
.dsh-ego-hat:hover { opacity:1 !important; background: rgba(10,132,255,.5); }
|
|
1381
|
+
.dsh-ego-hat.busy { opacity:1 !important; color:#86868b; }
|
|
1382
|
+
.dsh-ego-hat.done { opacity:1 !important; background:#30d158; color:#000; }
|
|
1383
|
+
.dsh-ego-hat.err { opacity:1 !important; background:#ff453a; color:#fff; }
|
|
1256
1384
|
.dsh-ego-hthumb { width:58px; height:42px; border-radius:6px; object-fit:cover; background:#000;
|
|
1257
1385
|
flex-shrink:0; border:1px solid rgba(255,255,255,.14); }
|
|
1258
|
-
.dsh-ego-hinfo { min-width:0; }
|
|
1259
1386
|
.dsh-ego-hurl { font-size:10.5px; color:#86868b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
1260
1387
|
.dsh-ego-htitle { font-size:10.5px; font-weight:500; color:#f5f5f7; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
1261
1388
|
.dsh-ego-hactive { color:#30d158; font-size:10.5px; }
|
|
@@ -1269,6 +1396,13 @@ const ICON_REFRESH = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none
|
|
|
1269
1396
|
const ICON_CLOCK = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><circle cx="12" cy="12" r="9"/><path d="M12 7.5V12l3 2"/></svg>`;
|
|
1270
1397
|
const ICON_CLOSE = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>`;
|
|
1271
1398
|
const ICON_GRIP = `<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="8" cy="6" r="1.8"/><circle cx="16" cy="6" r="1.8"/><circle cx="8" cy="12" r="1.8"/><circle cx="16" cy="12" r="1.8"/><circle cx="8" cy="18" r="1.8"/><circle cx="16" cy="18" r="1.8"/></svg>`;
|
|
1399
|
+
const ICON_LOCK = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><rect x="4.5" y="10.5" width="15" height="10" rx="2"/><path d="M8 10.5V7.5a4 4 0 0 1 8 0v3"/></svg>`;
|
|
1400
|
+
const ICON_UNLOCK = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><rect x="4.5" y="10.5" width="15" height="10" rx="2"/><path d="M8 10.5V7.5a4 4 0 0 1 7.2-2.4"/></svg>`;
|
|
1401
|
+
const ICON_ASPECT = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2.2"/><path d="M3 10h18"/><path d="M8 5v5"/></svg>`;
|
|
1402
|
+
const ICON_MAXIMIZE = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H3v5"/><path d="M16 3h5v5"/><path d="M8 21H3v-5"/><path d="M16 21h5v-5"/></svg>`;
|
|
1403
|
+
const ICON_LINK = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><path d="M10 13.5a4 4 0 0 0 5.7 0l2.8-2.8a4 4 0 0 0-5.7-5.7L11.5 6.3"/><path d="M14 10.5a4 4 0 0 0-5.7 0l-2.8 2.8a4 4 0 0 0 5.7 5.7l1.3-1.3"/></svg>`;
|
|
1404
|
+
const ICON_GRID = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"><rect x="3.5" y="3.5" width="7" height="7" rx="1.6"/><rect x="13.5" y="3.5" width="7" height="7" rx="1.6"/><rect x="3.5" y="13.5" width="7" height="7" rx="1.6"/><rect x="13.5" y="13.5" width="7" height="7" rx="1.6"/></svg>`;
|
|
1405
|
+
const ICON_SQUARE = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"><rect x="5" y="5" width="14" height="14" rx="2.4"/></svg>`;
|
|
1272
1406
|
var BRIDGE_ROUTES = {
|
|
1273
1407
|
describe: "/api/dsh-browser-cdp/settings/describe",
|
|
1274
1408
|
mutate: "/api/dsh-browser-cdp/settings/mutate"
|
|
@@ -1723,6 +1857,13 @@ var FAM_FIELD_GROUPS = [
|
|
|
1723
1857
|
kind: "bool",
|
|
1724
1858
|
en: ["ego-cli fallback frames (5s)", "With no CDP screencast (local ego-cli link active), capture one screenshot every 5s through the CLI so the watch panel still fills. Off = panel shows a placeholder and no screenshot subprocess is spawned"],
|
|
1725
1859
|
zh: ["ego-cli 降级帧(5s 一刷)", "无 CDP screencast(本机 ego-cli 激活)时,每 5s 走一次 CLI 截图填充观察窗画面区。关 = 面板显示占位提示、不拉截图子进程"]
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
k: "tabTracking",
|
|
1863
|
+
kind: "sel",
|
|
1864
|
+
options: ["active", "all"],
|
|
1865
|
+
en: ["Tab tracking (CLI routes)", "active = capture only the browser-active tab; all = capture every tab in the space (one picture each), the active one outlined green"],
|
|
1866
|
+
zh: ["tab 跟踪模式(CLI 路线)", "仅激活 = 只抓浏览器激活的那个 tab;全模式 = space 内每个 tab 各出一张图,激活那个用绿框标出"]
|
|
1726
1867
|
}
|
|
1727
1868
|
]
|
|
1728
1869
|
},
|
|
@@ -2677,13 +2818,13 @@ function mountFloatingWatch(ctx) {
|
|
|
2677
2818
|
</div>
|
|
2678
2819
|
<div id="dsh-ego-tabs"></div>
|
|
2679
2820
|
<div id="dsh-ego-login">
|
|
2680
|
-
<span class="dsh-ego-login-txt">${wt("loginTitle")}</span>
|
|
2821
|
+
<span class="dsh-ego-login-txt" id="dsh-ego-login-txt">${wt("loginTitle", { where: wt("whereGeneric") })}</span>
|
|
2681
2822
|
<button id="dsh-ego-login-btn" class="dsh-ego-login-btn" type="button">${wt("loginBtn")}</button>
|
|
2682
2823
|
<span class="dsh-ego-login-note" id="dsh-ego-login-note"></span>
|
|
2683
2824
|
<button class="dsh-ego-dismiss" type="button" title="${wt("loginDismiss")}" data-dismiss="login">×</button>
|
|
2684
2825
|
</div>
|
|
2685
2826
|
<div id="dsh-ego-captcha">
|
|
2686
|
-
<span class="dsh-ego-captcha-txt"><b>${wt("captchaTitle")}</b> —
|
|
2827
|
+
<span class="dsh-ego-captcha-txt"><b>${wt("captchaTitle")}</b> — <span id="dsh-ego-captcha-hint">${wt("captchaHint", { where: wt("whereGeneric") })}</span></span>
|
|
2687
2828
|
<span class="dsh-ego-captcha-kind" id="dsh-ego-captcha-kind"></span>
|
|
2688
2829
|
<button class="dsh-ego-dismiss" type="button" title="${wt("captchaDismiss")}" data-dismiss="captcha">×</button>
|
|
2689
2830
|
</div>
|
|
@@ -2713,10 +2854,12 @@ function mountFloatingWatch(ctx) {
|
|
|
2713
2854
|
const historyList = panel.querySelector("#dsh-ego-historylist");
|
|
2714
2855
|
const tabsEl = panel.querySelector("#dsh-ego-tabs");
|
|
2715
2856
|
const loginEl = panel.querySelector("#dsh-ego-login");
|
|
2857
|
+
const loginTxt = panel.querySelector("#dsh-ego-login-txt");
|
|
2716
2858
|
const loginBtn = panel.querySelector("#dsh-ego-login-btn");
|
|
2717
2859
|
const loginNote = panel.querySelector("#dsh-ego-login-note");
|
|
2718
2860
|
const captchaEl = panel.querySelector("#dsh-ego-captcha");
|
|
2719
2861
|
const captchaKindEl = panel.querySelector("#dsh-ego-captcha-kind");
|
|
2862
|
+
const captchaHintEl = panel.querySelector("#dsh-ego-captcha-hint");
|
|
2720
2863
|
const FLUSH_ROUTE$1 = "/api/bcdp/flush";
|
|
2721
2864
|
const dismissedGuides = {
|
|
2722
2865
|
login: false,
|
|
@@ -2739,6 +2882,8 @@ function mountFloatingWatch(ctx) {
|
|
|
2739
2882
|
let disposed = false;
|
|
2740
2883
|
let historyOpen = false;
|
|
2741
2884
|
let lastList = [];
|
|
2885
|
+
let panelLink = null;
|
|
2886
|
+
let trackAll = false;
|
|
2742
2887
|
const setHistory = (open) => {
|
|
2743
2888
|
historyOpen = open;
|
|
2744
2889
|
historyEl.classList.toggle("open", open);
|
|
@@ -2765,8 +2910,27 @@ function mountFloatingWatch(ctx) {
|
|
|
2765
2910
|
<div class="dsh-ego-htitle">${escapeHtml(s.title || s.url || wt("newTab"))}</div>
|
|
2766
2911
|
<div class="dsh-ego-hurl">${escapeHtml(s.url || "(about:blank)")}</div>
|
|
2767
2912
|
${active ? "<div class=\"dsh-ego-hactive\">● " + wt("current") + "</div>" : ""}
|
|
2768
|
-
</div
|
|
2913
|
+
</div>
|
|
2914
|
+
<button class="dsh-ego-hat" type="button" title="${escapeHtml(wt("atQuote"))}">@</button>`;
|
|
2769
2915
|
item.addEventListener("click", () => openPreview(s));
|
|
2916
|
+
const hatBtn = item.querySelector(".dsh-ego-hat");
|
|
2917
|
+
if (hatBtn) hatBtn.addEventListener("click", (ev) => {
|
|
2918
|
+
ev.stopPropagation();
|
|
2919
|
+
hatBtn.classList.add("busy");
|
|
2920
|
+
deliverTabReport(ctx, s).then((r) => {
|
|
2921
|
+
hatBtn.classList.remove("busy");
|
|
2922
|
+
if (r && r.ok) {
|
|
2923
|
+
hatBtn.classList.add("done");
|
|
2924
|
+
setTimeout(() => hatBtn.classList.remove("done"), 1200);
|
|
2925
|
+
} else {
|
|
2926
|
+
hatBtn.classList.add("err");
|
|
2927
|
+
setTimeout(() => hatBtn.classList.remove("err"), 1500);
|
|
2928
|
+
console.warn("dsh-browser-cdp: tab anchor report failed", r && r.code);
|
|
2929
|
+
}
|
|
2930
|
+
}).catch(() => {
|
|
2931
|
+
hatBtn.classList.remove("busy");
|
|
2932
|
+
});
|
|
2933
|
+
});
|
|
2770
2934
|
historyList.appendChild(item);
|
|
2771
2935
|
}
|
|
2772
2936
|
};
|
|
@@ -3161,6 +3325,7 @@ function mountFloatingWatch(ctx) {
|
|
|
3161
3325
|
});
|
|
3162
3326
|
tab.appendChild(closeBtn$1);
|
|
3163
3327
|
if (s.targetId === selectedTabId || selectedTabId === null && s.targetId === currentActiveId) tab.classList.add("active");
|
|
3328
|
+
if (s.active === true) tab.classList.add("is-live");
|
|
3164
3329
|
tab.addEventListener("click", () => {
|
|
3165
3330
|
if (selectedTabId === s.targetId) {
|
|
3166
3331
|
selectedTabId = null;
|
|
@@ -3168,6 +3333,7 @@ function mountFloatingWatch(ctx) {
|
|
|
3168
3333
|
renderSpaces(lastList);
|
|
3169
3334
|
return;
|
|
3170
3335
|
}
|
|
3336
|
+
if (s.targetId !== currentActiveId) switchTabRemote(s.targetId).then(() => refresh());
|
|
3171
3337
|
selectedTabId = s.targetId;
|
|
3172
3338
|
pinned = null;
|
|
3173
3339
|
renderLiveMain(s, true);
|
|
@@ -3229,7 +3395,9 @@ function mountFloatingWatch(ctx) {
|
|
|
3229
3395
|
};
|
|
3230
3396
|
const renderSpaces = (spaces) => {
|
|
3231
3397
|
if (disposed) return;
|
|
3232
|
-
|
|
3398
|
+
const incoming = Array.isArray(spaces) ? spaces : [];
|
|
3399
|
+
lastList = trackAll ? incoming : incoming.filter((s) => s && s.active === true).slice(0, 1);
|
|
3400
|
+
if (lastList.length === 0 && incoming.length === 1) lastList = incoming.slice(0, 1);
|
|
3233
3401
|
for (const s of lastList) {
|
|
3234
3402
|
const prev = pageMeta.get(s.targetId) || { targetId: s.targetId };
|
|
3235
3403
|
pageMeta.set(s.targetId, {
|
|
@@ -3283,7 +3451,7 @@ function mountFloatingWatch(ctx) {
|
|
|
3283
3451
|
const renderLiveMain = (current, isPinned) => {
|
|
3284
3452
|
body.innerHTML = "";
|
|
3285
3453
|
const view = document.createElement("div");
|
|
3286
|
-
view.className = "dsh-ego-liveview";
|
|
3454
|
+
view.className = "dsh-ego-liveview" + (isPinned ? "" : " is-live");
|
|
3287
3455
|
const badge = document.createElement("div");
|
|
3288
3456
|
badge.className = "dsh-ego-livebadge";
|
|
3289
3457
|
badge.innerHTML = isPinned ? `<span class="dsh-ego-state-dot pin"></span> ${wt("pinned")}` : `<span class="dsh-ego-state-dot${fab.classList.contains("dsh-ego-busy") ? " busy" : ""}"></span> ${wt("realtime")}`;
|
|
@@ -3329,6 +3497,90 @@ function mountFloatingWatch(ctx) {
|
|
|
3329
3497
|
}).then((r) => r.json().catch(() => null)).catch(() => null);
|
|
3330
3498
|
});
|
|
3331
3499
|
badge.appendChild(raiseBtn);
|
|
3500
|
+
const liveNotice = (text) => {
|
|
3501
|
+
if (!text) return;
|
|
3502
|
+
u.textContent = String(text);
|
|
3503
|
+
u.classList.add("dsh-ego-hint");
|
|
3504
|
+
};
|
|
3505
|
+
const runPanelAction = (btn, promise, onOk) => {
|
|
3506
|
+
btn.disabled = true;
|
|
3507
|
+
promise.then((res) => {
|
|
3508
|
+
if (res && res.ok === true) {
|
|
3509
|
+
if (onOk) onOk(res);
|
|
3510
|
+
} else liveNotice(res && res.error || wt("actionFailed"));
|
|
3511
|
+
}).catch(() => {
|
|
3512
|
+
liveNotice(wt("actionFailed"));
|
|
3513
|
+
}).then(() => {
|
|
3514
|
+
btn.disabled = false;
|
|
3515
|
+
});
|
|
3516
|
+
};
|
|
3517
|
+
const pageRefreshBtn = document.createElement("button");
|
|
3518
|
+
pageRefreshBtn.type = "button";
|
|
3519
|
+
pageRefreshBtn.className = "dsh-ego-back";
|
|
3520
|
+
pageRefreshBtn.title = wt("pageRefreshHint");
|
|
3521
|
+
pageRefreshBtn.textContent = wt("pageRefresh");
|
|
3522
|
+
pageRefreshBtn.addEventListener("click", () => {
|
|
3523
|
+
runPanelAction(pageRefreshBtn, panelNavigate("", true), () => refresh());
|
|
3524
|
+
});
|
|
3525
|
+
badge.appendChild(pageRefreshBtn);
|
|
3526
|
+
const openUrlBtn = document.createElement("button");
|
|
3527
|
+
openUrlBtn.type = "button";
|
|
3528
|
+
openUrlBtn.className = "dsh-ego-back";
|
|
3529
|
+
openUrlBtn.title = wt("openUrlHint");
|
|
3530
|
+
openUrlBtn.textContent = wt("openUrl");
|
|
3531
|
+
openUrlBtn.addEventListener("click", () => {
|
|
3532
|
+
const entered = window.prompt(wt("openUrlPrompt"), current.url || "https://");
|
|
3533
|
+
if (entered === null) return;
|
|
3534
|
+
const url = normalizeUrlInput(entered);
|
|
3535
|
+
if (url === "") return;
|
|
3536
|
+
runPanelAction(openUrlBtn, panelNavigate(url, false), () => refresh());
|
|
3537
|
+
});
|
|
3538
|
+
badge.appendChild(openUrlBtn);
|
|
3539
|
+
const maximizeBtn = document.createElement("button");
|
|
3540
|
+
maximizeBtn.type = "button";
|
|
3541
|
+
maximizeBtn.className = "dsh-ego-back";
|
|
3542
|
+
maximizeBtn.title = wt("maximizeHint");
|
|
3543
|
+
maximizeBtn.innerHTML = `${ICON_MAXIMIZE}<span style="margin-left:4px">${wt("maximizeWindow")}</span>`;
|
|
3544
|
+
maximizeBtn.addEventListener("click", () => {
|
|
3545
|
+
runPanelAction(maximizeBtn, panelWindowSize({ maximize: true }), () => refresh());
|
|
3546
|
+
});
|
|
3547
|
+
badge.appendChild(maximizeBtn);
|
|
3548
|
+
const presetBtn = document.createElement("button");
|
|
3549
|
+
presetBtn.type = "button";
|
|
3550
|
+
presetBtn.className = "dsh-ego-back";
|
|
3551
|
+
presetBtn.title = wt("sizePresetsHint");
|
|
3552
|
+
presetBtn.innerHTML = `${ICON_ASPECT}<span style="margin-left:4px">${wt("sizePresets")}</span>`;
|
|
3553
|
+
const presetRow = document.createElement("div");
|
|
3554
|
+
presetRow.className = "dsh-ego-presets";
|
|
3555
|
+
presetRow.hidden = true;
|
|
3556
|
+
for (const preset of SIZE_PRESETS || []) {
|
|
3557
|
+
const item = document.createElement("button");
|
|
3558
|
+
item.type = "button";
|
|
3559
|
+
item.className = "dsh-ego-preset-item";
|
|
3560
|
+
item.textContent = preset.label;
|
|
3561
|
+
item.addEventListener("click", () => {
|
|
3562
|
+
presetRow.hidden = true;
|
|
3563
|
+
presetBtn.classList.remove("on");
|
|
3564
|
+
runPanelAction(presetBtn, panelWindowSize({ aspect: preset.ratio }), () => refresh());
|
|
3565
|
+
});
|
|
3566
|
+
presetRow.appendChild(item);
|
|
3567
|
+
}
|
|
3568
|
+
presetBtn.addEventListener("click", () => {
|
|
3569
|
+
presetRow.hidden = !presetRow.hidden;
|
|
3570
|
+
presetBtn.classList.toggle("on", !presetRow.hidden);
|
|
3571
|
+
});
|
|
3572
|
+
badge.appendChild(presetBtn);
|
|
3573
|
+
badge.appendChild(presetRow);
|
|
3574
|
+
const trackBtn = document.createElement("button");
|
|
3575
|
+
trackBtn.type = "button";
|
|
3576
|
+
trackBtn.className = "dsh-ego-back" + (trackAll ? " on" : "");
|
|
3577
|
+
trackBtn.title = trackAll ? wt("trackAllHintOn") : wt("trackAllHintOff");
|
|
3578
|
+
trackBtn.innerHTML = `${trackAll ? ICON_GRID : ICON_SQUARE}<span style="margin-left:4px">${trackAll ? wt("trackAllOn") : wt("trackAllOff")}</span>`;
|
|
3579
|
+
trackBtn.addEventListener("click", () => {
|
|
3580
|
+
trackAll = !trackAll;
|
|
3581
|
+
setTrackAllRemote(trackAll).then(() => refresh());
|
|
3582
|
+
});
|
|
3583
|
+
badge.appendChild(trackBtn);
|
|
3332
3584
|
const cached = frameCache.get(current.targetId);
|
|
3333
3585
|
if (captureBackend === "ffmpeg" || cached) {
|
|
3334
3586
|
const img = makeZoomImage(u, captureBackend === "ffmpeg" ? "video" : "img");
|
|
@@ -3363,10 +3615,11 @@ function mountFloatingWatch(ctx) {
|
|
|
3363
3615
|
renderEmpty();
|
|
3364
3616
|
return;
|
|
3365
3617
|
}
|
|
3618
|
+
if (data.link) panelLink = data.link;
|
|
3366
3619
|
applyCaptureStatus(data.capture);
|
|
3367
3620
|
if (data.cliFrameMode === true && Array.isArray(data.spaces)) {
|
|
3368
|
-
const
|
|
3369
|
-
if (
|
|
3621
|
+
const cliActive = data.spaces.find((s) => s && (s.targetId === data.cliFrameTargetId || s.active === true)) || data.spaces[0];
|
|
3622
|
+
if (cliActive) frameCache.set(cliActive.targetId || CLI_FRAME_TARGET_ID, `${CLI_FRAME_ROUTE}?t=${cliActive.lastActive || Date.now()}`);
|
|
3370
3623
|
renderSpaces(data.spaces);
|
|
3371
3624
|
return;
|
|
3372
3625
|
}
|
|
@@ -3628,6 +3881,12 @@ function mountFloatingWatch(ctx) {
|
|
|
3628
3881
|
panel.offsetHeight;
|
|
3629
3882
|
panel.classList.add("dsh-ego-panel-open");
|
|
3630
3883
|
fab.classList.add("on");
|
|
3884
|
+
fetch(TRACKING_ROUTE, { cache: "no-store" }).then((r) => r.json().catch(() => null)).then((data) => {
|
|
3885
|
+
if (data && typeof data.all === "boolean" && data.all !== trackAll) {
|
|
3886
|
+
trackAll = data.all;
|
|
3887
|
+
refresh();
|
|
3888
|
+
}
|
|
3889
|
+
}).catch(() => {});
|
|
3631
3890
|
refresh();
|
|
3632
3891
|
openStream();
|
|
3633
3892
|
if (currentActiveId) syncWatch(selectedTabId || currentActiveId);
|
|
@@ -3669,6 +3928,10 @@ function mountFloatingWatch(ctx) {
|
|
|
3669
3928
|
const show = lastList.some((s) => s.url && !s.url.startsWith("about:")) && !captchaEl.classList.contains("show");
|
|
3670
3929
|
loginEl.classList.toggle("show", show);
|
|
3671
3930
|
loginNote.textContent = "";
|
|
3931
|
+
if (loginTxt) loginTxt.textContent = linkLoginLine(panelLink);
|
|
3932
|
+
const canFlush = linkFlushable(panelLink);
|
|
3933
|
+
if (loginBtn instanceof HTMLElement) loginBtn.hidden = !canFlush;
|
|
3934
|
+
if (!canFlush) loginNote.textContent = wt("loginSelfPersist");
|
|
3672
3935
|
};
|
|
3673
3936
|
const maybeShowCaptchaGuide = () => {
|
|
3674
3937
|
if (disposed || dismissedGuides.captcha) return;
|
|
@@ -3676,6 +3939,7 @@ function mountFloatingWatch(ctx) {
|
|
|
3676
3939
|
const show = !!hit;
|
|
3677
3940
|
captchaEl.classList.toggle("show", show);
|
|
3678
3941
|
if (show && captchaKindEl) captchaKindEl.textContent = hit.humanCheck.kind || "captcha";
|
|
3942
|
+
if (captchaHintEl) captchaHintEl.textContent = linkCaptchaLine(panelLink);
|
|
3679
3943
|
};
|
|
3680
3944
|
loginBtn.addEventListener("click", () => {
|
|
3681
3945
|
(async () => {
|
|
@@ -3738,7 +4002,174 @@ function mountFloatingWatch(ctx) {
|
|
|
3738
4002
|
}
|
|
3739
4003
|
var INPUT_ROUTE = "/api/bcdp/input";
|
|
3740
4004
|
var FLUSH_ROUTE = "/api/bcdp/flush";
|
|
4005
|
+
var WINDOW_SIZE_ROUTE = "/api/bcdp/window-size";
|
|
4006
|
+
var PANEL_NAVIGATE_ROUTE = "/api/bcdp/navigate";
|
|
3741
4007
|
var FRAME_FOLLOW_MIN_MS = 350;
|
|
4008
|
+
var SIZE_SYNC_KEY = "dsh-browser-cdp:size-sync";
|
|
4009
|
+
function sizeSyncStored() {
|
|
4010
|
+
try {
|
|
4011
|
+
return window.localStorage.getItem(SIZE_SYNC_KEY) === "1";
|
|
4012
|
+
} catch (e) {
|
|
4013
|
+
return false;
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
4016
|
+
function sizeSyncStore(enabled) {
|
|
4017
|
+
try {
|
|
4018
|
+
window.localStorage.setItem(SIZE_SYNC_KEY, enabled ? "1" : "0");
|
|
4019
|
+
} catch (e) {}
|
|
4020
|
+
}
|
|
4021
|
+
function createWindowSizeSync() {
|
|
4022
|
+
var enabled = false;
|
|
4023
|
+
var element = null;
|
|
4024
|
+
var observer = null;
|
|
4025
|
+
var timer = null;
|
|
4026
|
+
var inFlight = false;
|
|
4027
|
+
var baseWidth = 0;
|
|
4028
|
+
var pointerDown = false;
|
|
4029
|
+
var dragUntil = 0;
|
|
4030
|
+
var lastAt = 0;
|
|
4031
|
+
function onPointerDown() {
|
|
4032
|
+
pointerDown = true;
|
|
4033
|
+
}
|
|
4034
|
+
function onPointerUp() {
|
|
4035
|
+
if (!pointerDown) return;
|
|
4036
|
+
pointerDown = false;
|
|
4037
|
+
dragUntil = Date.now() + 350;
|
|
4038
|
+
if (enabled) schedule();
|
|
4039
|
+
}
|
|
4040
|
+
function stageWidth() {
|
|
4041
|
+
return Math.round(element && element.clientWidth || 0);
|
|
4042
|
+
}
|
|
4043
|
+
function schedule() {
|
|
4044
|
+
if (timer !== null) return;
|
|
4045
|
+
timer = setTimeout(send, 180);
|
|
4046
|
+
}
|
|
4047
|
+
function send() {
|
|
4048
|
+
timer = null;
|
|
4049
|
+
if (!enabled || !element) return;
|
|
4050
|
+
var w = stageWidth();
|
|
4051
|
+
if (w < 120) return;
|
|
4052
|
+
var now = Date.now();
|
|
4053
|
+
if (!pointerDown && now > dragUntil) {
|
|
4054
|
+
baseWidth = w;
|
|
4055
|
+
return;
|
|
4056
|
+
}
|
|
4057
|
+
var delta = w - baseWidth;
|
|
4058
|
+
if (Math.abs(delta) < 12) return;
|
|
4059
|
+
if (now - lastAt < 200) {
|
|
4060
|
+
schedule();
|
|
4061
|
+
return;
|
|
4062
|
+
}
|
|
4063
|
+
if (inFlight) {
|
|
4064
|
+
schedule();
|
|
4065
|
+
return;
|
|
4066
|
+
}
|
|
4067
|
+
inFlight = true;
|
|
4068
|
+
lastAt = now;
|
|
4069
|
+
var sentBase = w;
|
|
4070
|
+
postJson(WINDOW_SIZE_ROUTE, { delta }).then(function(parsed) {
|
|
4071
|
+
if (parsed && parsed.ok === true) baseWidth = sentBase;
|
|
4072
|
+
}).catch(function() {
|
|
4073
|
+
return null;
|
|
4074
|
+
}).then(function() {
|
|
4075
|
+
inFlight = false;
|
|
4076
|
+
});
|
|
4077
|
+
}
|
|
4078
|
+
function attach(el) {
|
|
4079
|
+
element = el || null;
|
|
4080
|
+
if (!enabled) return;
|
|
4081
|
+
if (observer !== null) {
|
|
4082
|
+
observer.disconnect();
|
|
4083
|
+
observer = null;
|
|
4084
|
+
}
|
|
4085
|
+
if (element && typeof ResizeObserver !== "undefined") try {
|
|
4086
|
+
observer = new ResizeObserver(function() {
|
|
4087
|
+
if (enabled) schedule();
|
|
4088
|
+
});
|
|
4089
|
+
observer.observe(element);
|
|
4090
|
+
} catch (e) {
|
|
4091
|
+
observer = null;
|
|
4092
|
+
}
|
|
4093
|
+
if (baseWidth === 0) baseWidth = stageWidth();
|
|
4094
|
+
}
|
|
4095
|
+
function setEnabled(next) {
|
|
4096
|
+
enabled = next === true;
|
|
4097
|
+
sizeSyncStore(enabled);
|
|
4098
|
+
if (!enabled) {
|
|
4099
|
+
if (timer !== null) {
|
|
4100
|
+
clearTimeout(timer);
|
|
4101
|
+
timer = null;
|
|
4102
|
+
}
|
|
4103
|
+
if (observer !== null) {
|
|
4104
|
+
observer.disconnect();
|
|
4105
|
+
observer = null;
|
|
4106
|
+
}
|
|
4107
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
4108
|
+
document.removeEventListener("pointerup", onPointerUp, true);
|
|
4109
|
+
return;
|
|
4110
|
+
}
|
|
4111
|
+
baseWidth = stageWidth();
|
|
4112
|
+
lastAt = 0;
|
|
4113
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
4114
|
+
document.addEventListener("pointerup", onPointerUp, true);
|
|
4115
|
+
if (element) attach(element);
|
|
4116
|
+
}
|
|
4117
|
+
function dispose() {
|
|
4118
|
+
if (timer !== null) timer = null;
|
|
4119
|
+
if (observer !== null) {
|
|
4120
|
+
observer.disconnect();
|
|
4121
|
+
observer = null;
|
|
4122
|
+
}
|
|
4123
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
4124
|
+
document.removeEventListener("pointerup", onPointerUp, true);
|
|
4125
|
+
element = null;
|
|
4126
|
+
}
|
|
4127
|
+
return {
|
|
4128
|
+
isEnabled: function() {
|
|
4129
|
+
return enabled;
|
|
4130
|
+
},
|
|
4131
|
+
setEnabled,
|
|
4132
|
+
attach,
|
|
4133
|
+
dispose
|
|
4134
|
+
};
|
|
4135
|
+
}
|
|
4136
|
+
var SIZE_PRESETS = [
|
|
4137
|
+
{
|
|
4138
|
+
label: "16:9",
|
|
4139
|
+
ratio: "16:9"
|
|
4140
|
+
},
|
|
4141
|
+
{
|
|
4142
|
+
label: "4:3",
|
|
4143
|
+
ratio: "4:3"
|
|
4144
|
+
},
|
|
4145
|
+
{
|
|
4146
|
+
label: "21:9",
|
|
4147
|
+
ratio: "21:9"
|
|
4148
|
+
},
|
|
4149
|
+
{
|
|
4150
|
+
label: "1:1",
|
|
4151
|
+
ratio: "1:1"
|
|
4152
|
+
},
|
|
4153
|
+
{
|
|
4154
|
+
label: "9:16",
|
|
4155
|
+
ratio: "9:16"
|
|
4156
|
+
}
|
|
4157
|
+
];
|
|
4158
|
+
/** Panel refresh / URL: ONE body shape for both host routes. */
|
|
4159
|
+
function panelNavigate(url, reload) {
|
|
4160
|
+
return postJson(PANEL_NAVIGATE_ROUTE, reload ? { reload: true } : { url: String(url || "") });
|
|
4161
|
+
}
|
|
4162
|
+
/** Size sync / presets / maximize. */
|
|
4163
|
+
function panelWindowSize(body) {
|
|
4164
|
+
return postJson(WINDOW_SIZE_ROUTE, body || {});
|
|
4165
|
+
}
|
|
4166
|
+
/** Normalize whatever the user typed into an absolute URL. */
|
|
4167
|
+
function normalizeUrlInput(entered) {
|
|
4168
|
+
var url = String(entered || "").trim();
|
|
4169
|
+
if (url === "") return "";
|
|
4170
|
+
if (!/^[a-z][a-z0-9+.-]*:/i.test(url)) url = "https://" + url;
|
|
4171
|
+
return url;
|
|
4172
|
+
}
|
|
3742
4173
|
var TAB_CSS = `
|
|
3743
4174
|
.dsh-ego-side-root {
|
|
3744
4175
|
display: flex; flex-direction: column; height: 100%; min-height: 0;
|
|
@@ -3853,6 +4284,34 @@ var TAB_CSS = `
|
|
|
3853
4284
|
}
|
|
3854
4285
|
.dsh-ego-side-back:hover { background: rgba(128,128,128,.3); }
|
|
3855
4286
|
.dsh-ego-side-back.dsh-ego-pick-on { background: rgba(56,189,248,.28); color: #0ea5e9; }
|
|
4287
|
+
.dsh-ego-side-back.on { background: rgba(217,119,87,.35); border-color: rgba(217,119,87,.6); }
|
|
4288
|
+
.dsh-ego-side-presets {
|
|
4289
|
+
display: inline-flex; gap: 3px; padding: 3px; border-radius: 7px;
|
|
4290
|
+
background: rgba(128,128,128,.12); border: 1px solid rgba(128,128,128,.18);
|
|
4291
|
+
}
|
|
4292
|
+
.dsh-ego-side-preset-item {
|
|
4293
|
+
background: transparent; border: none; color: inherit; cursor: pointer;
|
|
4294
|
+
font-size: 10.5px; padding: 2px 7px; border-radius: 5px; opacity: .8;
|
|
4295
|
+
}
|
|
4296
|
+
.dsh-ego-side-preset-item:hover { background: rgba(128,128,128,.24); opacity: 1; }
|
|
4297
|
+
/* size-sync stage: the live image sits in a positioned box so the edge/
|
|
4298
|
+
corner handles can overlay it. */
|
|
4299
|
+
.dsh-ego-side-stage { position: relative; display: flex; min-width: 0; }
|
|
4300
|
+
.dsh-ego-side-resize { position: absolute; z-index: 6; background: transparent; }
|
|
4301
|
+
.dsh-ego-side-resize-right { top: 0; bottom: 0; right: 0; width: 10px; cursor: col-resize; }
|
|
4302
|
+
.dsh-ego-side-resize-bottom { left: 0; right: 0; bottom: 0; height: 10px; cursor: row-resize; }
|
|
4303
|
+
.dsh-ego-side-resize-corner { right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; }
|
|
4304
|
+
.dsh-ego-size-unlocked .dsh-ego-side-resize-right,
|
|
4305
|
+
.dsh-ego-size-unlocked .dsh-ego-side-resize-bottom { background: rgba(217,119,87,.14); }
|
|
4306
|
+
.dsh-ego-size-unlocked .dsh-ego-side-resize-corner {
|
|
4307
|
+
background: rgba(217,119,87,.3); border-bottom-right-radius: 9px;
|
|
4308
|
+
}
|
|
4309
|
+
/* Green frame = this image belongs to the browser's ACTIVE tab. In 全模式 every
|
|
4310
|
+
tab has its own picture, so the outline is what marks the live one. */
|
|
4311
|
+
.dsh-ego-side-stage.is-live { box-shadow: 0 0 0 2px #30d158, 0 0 12px rgba(48,209,88,.3); border-radius: 11px; }
|
|
4312
|
+
.dsh-ego-side-tab.is-live .dsh-ego-side-tabdot { background: #30d158; box-shadow: 0 0 6px #30d158; }
|
|
4313
|
+
.dsh-ego-side-tab.is-live .dsh-ego-side-tabtxt { font-weight: 600; }
|
|
4314
|
+
.dsh-ego-side-resize:hover { background: rgba(217,119,87,.5) !important; }
|
|
3856
4315
|
.dsh-ego-side-liveimg {
|
|
3857
4316
|
width: 100%; border-radius: 9px; display: block;
|
|
3858
4317
|
max-height: 50vh; object-fit: contain;
|
|
@@ -3884,6 +4343,14 @@ var TAB_CSS = `
|
|
|
3884
4343
|
}
|
|
3885
4344
|
.dsh-ego-side-hitem:hover { background: rgba(128,128,128,.15); }
|
|
3886
4345
|
.dsh-ego-side-hitem.active { background: rgba(10,132,255,.15); }
|
|
4346
|
+
.dsh-ego-side-hat { flex: none; width: 22px; height: 22px; border-radius: 6px; font: inherit; font-size: 12px;
|
|
4347
|
+
line-height: 1; cursor: pointer; border: 1px solid rgba(128,128,128,.28); background: transparent; opacity: 0;
|
|
4348
|
+
transition: opacity .15s ease, background .15s ease; color: inherit; }
|
|
4349
|
+
.dsh-ego-side-hitem:hover .dsh-ego-side-hat { opacity: .8; }
|
|
4350
|
+
.dsh-ego-side-hat:hover { opacity: 1; background: rgba(10,132,255,.4); color: #fff; }
|
|
4351
|
+
.dsh-ego-side-hat.busy { opacity: 1; color: rgba(128,128,128,.6); }
|
|
4352
|
+
.dsh-ego-side-hat.done { opacity: 1; background: #30d158; color: #000; border-color: transparent; }
|
|
4353
|
+
.dsh-ego-side-hat.err { opacity: 1; background: #ff453a; color: #fff; border-color: transparent; }
|
|
3887
4354
|
.dsh-ego-side-hthumb {
|
|
3888
4355
|
width: 52px; height: 38px; border-radius: 5px; object-fit: cover; background: #000;
|
|
3889
4356
|
flex-shrink: 0; border: 1px solid rgba(128,128,128,.2);
|
|
@@ -3959,6 +4426,35 @@ function CdpPicksDockCard(props) {
|
|
|
3959
4426
|
var filesKey = refs.map(function(r) {
|
|
3960
4427
|
return r.file;
|
|
3961
4428
|
}).join("|");
|
|
4429
|
+
var reloadState = React.useState(0);
|
|
4430
|
+
var reloadKey = reloadState[0];
|
|
4431
|
+
var setReloadKey = reloadState[1];
|
|
4432
|
+
var liveState = React.useState({});
|
|
4433
|
+
var liveMeta = liveState[0];
|
|
4434
|
+
var setLiveMeta = liveState[1];
|
|
4435
|
+
React.useEffect(function() {
|
|
4436
|
+
var cancelled = false;
|
|
4437
|
+
fetch(SPACES_ROUTE, { cache: "no-store" }).then(function(res) {
|
|
4438
|
+
return res.json().catch(function() {
|
|
4439
|
+
return null;
|
|
4440
|
+
});
|
|
4441
|
+
}).then(function(data) {
|
|
4442
|
+
if (cancelled || !data || !Array.isArray(data.spaces)) return;
|
|
4443
|
+
var map = {};
|
|
4444
|
+
for (var i = 0; i < data.spaces.length; i++) {
|
|
4445
|
+
var s = data.spaces[i];
|
|
4446
|
+
if (s && s.targetId != null) map[String(s.targetId)] = {
|
|
4447
|
+
url: s.url || "",
|
|
4448
|
+
title: s.title || "",
|
|
4449
|
+
active: s.active === true
|
|
4450
|
+
};
|
|
4451
|
+
}
|
|
4452
|
+
setLiveMeta(map);
|
|
4453
|
+
}).catch(function() {});
|
|
4454
|
+
return function() {
|
|
4455
|
+
cancelled = true;
|
|
4456
|
+
};
|
|
4457
|
+
}, [Math.floor(tick[0] / 3)]);
|
|
3962
4458
|
React.useEffect(function() {
|
|
3963
4459
|
var cancelled = false;
|
|
3964
4460
|
refs.forEach(function(r) {
|
|
@@ -4010,7 +4506,11 @@ function CdpPicksDockCard(props) {
|
|
|
4010
4506
|
return function() {
|
|
4011
4507
|
cancelled = true;
|
|
4012
4508
|
};
|
|
4013
|
-
}, [
|
|
4509
|
+
}, [
|
|
4510
|
+
filesKey,
|
|
4511
|
+
reloadKey,
|
|
4512
|
+
Math.floor(tick[0] / 5)
|
|
4513
|
+
]);
|
|
4014
4514
|
if (refs.length === 0) return null;
|
|
4015
4515
|
function removeRef(line) {
|
|
4016
4516
|
var cur = readDraftText(input);
|
|
@@ -4020,6 +4520,20 @@ function CdpPicksDockCard(props) {
|
|
|
4020
4520
|
next = next.replace(/^\s*\n+/, "").replace(/\n+\s*$/, "");
|
|
4021
4521
|
input.setDraft(next);
|
|
4022
4522
|
}
|
|
4523
|
+
function recapture(r, targetId, live) {
|
|
4524
|
+
if (targetId === "") return;
|
|
4525
|
+
postJson("/bcdp/api/tab-anchor-report", {
|
|
4526
|
+
targetId,
|
|
4527
|
+
session: sid,
|
|
4528
|
+
file: r.file.slice(6),
|
|
4529
|
+
...live && live.url ? { url: live.url } : {},
|
|
4530
|
+
...live && live.title ? { title: live.title } : {}
|
|
4531
|
+
}).then(function(res) {
|
|
4532
|
+
if (res && res.ok !== false) setReloadKey(function(n) {
|
|
4533
|
+
return n + 1;
|
|
4534
|
+
});
|
|
4535
|
+
}).catch(function() {});
|
|
4536
|
+
}
|
|
4023
4537
|
return h("div", { style: {
|
|
4024
4538
|
display: "grid",
|
|
4025
4539
|
gap: "6px"
|
|
@@ -4027,17 +4541,43 @@ function CdpPicksDockCard(props) {
|
|
|
4027
4541
|
var content = contents[r.file];
|
|
4028
4542
|
var elements = [];
|
|
4029
4543
|
var pageTitle = "";
|
|
4544
|
+
var pageUrl = "";
|
|
4545
|
+
var isTabReport = false;
|
|
4546
|
+
var truncated = false;
|
|
4547
|
+
var degraded = "";
|
|
4548
|
+
var targetId = "";
|
|
4549
|
+
var reportSource = "";
|
|
4030
4550
|
if (typeof content === "string" && content !== "") try {
|
|
4031
4551
|
var obj = JSON.parse(content);
|
|
4032
4552
|
elements = obj && obj.elements || [];
|
|
4033
4553
|
pageTitle = obj && obj.pageTitle || "";
|
|
4554
|
+
pageUrl = obj && obj.pageUrl || "";
|
|
4555
|
+
isTabReport = !!(obj && obj.type === "tab-anchor-report");
|
|
4556
|
+
truncated = !!(obj && obj.truncated);
|
|
4557
|
+
degraded = obj && obj.degraded || "";
|
|
4558
|
+
targetId = obj && obj.targetId ? String(obj.targetId) : "";
|
|
4559
|
+
reportSource = obj && obj.source ? String(obj.source) : "";
|
|
4034
4560
|
} catch (e) {
|
|
4035
4561
|
pageTitle = "";
|
|
4036
4562
|
}
|
|
4563
|
+
var live = targetId !== "" ? liveMeta[targetId] : null;
|
|
4564
|
+
var liveTitle = live && live.title || "";
|
|
4565
|
+
var liveUrl = live && live.url || "";
|
|
4037
4566
|
var countText;
|
|
4038
4567
|
if (typeof content !== "string" || content === "") countText = errs[r.file] ? "⚠ " + errs[r.file] : "…";
|
|
4039
|
-
else countText = wt("pickCardElements", { n:
|
|
4040
|
-
|
|
4568
|
+
else if (degraded) countText = wt("pickCardElements", { n: 0 }) + " · ⚠ " + degraded;
|
|
4569
|
+
else countText = wt("pickCardElements", { n: elements.length }) + (truncated ? "+" : "") + (isTabReport ? " " + wt("pickCardSnapshotTag") : "");
|
|
4570
|
+
var head = h("div", { className: "dsh-cdp-picks-head" }, h("span", { style: { fontWeight: 700 } }, isTabReport ? "🌐 " + (liveTitle || pageTitle || wt("pickCardTitle")) : "🌐 " + wt("pickCardTitle")), h("span", { className: "dsh-cdp-picks-sub" }, "@" + r.file), h("span", { className: "dsh-cdp-picks-sub" }, liveUrl || pageUrl || pageTitle), isTabReport && live ? h("span", {
|
|
4571
|
+
className: "dsh-cdp-picks-sub",
|
|
4572
|
+
title: reportSource || "live"
|
|
4573
|
+
}, "● " + wt("pickCardLive")) : null, h("span", { className: "dsh-cdp-picks-sub" }, countText), isTabReport && targetId !== "" ? h("button", {
|
|
4574
|
+
type: "button",
|
|
4575
|
+
title: wt("pickCardRecaptureHint"),
|
|
4576
|
+
className: "dsh-cdp-picks-close",
|
|
4577
|
+
onClick: function() {
|
|
4578
|
+
recapture(r, targetId, live);
|
|
4579
|
+
}
|
|
4580
|
+
}, "⟳") : null, h("button", {
|
|
4041
4581
|
type: "button",
|
|
4042
4582
|
title: wt("pickCardRemove"),
|
|
4043
4583
|
className: "dsh-cdp-picks-close",
|
|
@@ -4052,10 +4592,12 @@ function CdpPicksDockCard(props) {
|
|
|
4052
4592
|
}, "…"));
|
|
4053
4593
|
for (var i = 0; i < elements.length && i < 6; i++) {
|
|
4054
4594
|
var el = elements[i] || {};
|
|
4595
|
+
var tagText = isTabReport ? el.role || "?" : el.tag || "?";
|
|
4596
|
+
var descText = isTabReport ? (el.name || "") + (el.anchor ? " " + String(el.anchor).slice(0, 8) : "") : el.describe || el.name || "";
|
|
4055
4597
|
chips.push(h("div", {
|
|
4056
4598
|
key: el.n || i,
|
|
4057
4599
|
className: "dsh-cdp-picks-chip"
|
|
4058
|
-
}, h("span", { className: "dsh-cdp-picks-num" }, "#" + (el.n || i + 1)), h("span", { className: "dsh-cdp-picks-tag" },
|
|
4600
|
+
}, h("span", { className: "dsh-cdp-picks-num" }, "#" + (el.n || i + 1)), h("span", { className: "dsh-cdp-picks-tag" }, tagText), h("span", { className: "dsh-cdp-picks-desc" }, descText)));
|
|
4059
4601
|
}
|
|
4060
4602
|
if (elements.length > 6) chips.push(h("div", {
|
|
4061
4603
|
key: "more",
|
|
@@ -4347,6 +4889,81 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
4347
4889
|
};
|
|
4348
4890
|
}
|
|
4349
4891
|
}
|
|
4892
|
+
async function deliverTabReport(ctx, space) {
|
|
4893
|
+
try {
|
|
4894
|
+
var sessionId = currentSessionId(ctx.sessions.list.getSnapshot());
|
|
4895
|
+
if (!sessionId) return {
|
|
4896
|
+
ok: false,
|
|
4897
|
+
code: "no-active-session"
|
|
4898
|
+
};
|
|
4899
|
+
var actx = ctx.sessions.scope(sessionId);
|
|
4900
|
+
if (!actx) return {
|
|
4901
|
+
ok: false,
|
|
4902
|
+
code: "no-session-scope"
|
|
4903
|
+
};
|
|
4904
|
+
var conversation = ctx.get("conversation");
|
|
4905
|
+
if (!conversation || !conversation.input) return {
|
|
4906
|
+
ok: false,
|
|
4907
|
+
code: "no-conversation-service"
|
|
4908
|
+
};
|
|
4909
|
+
var input = conversation.input.for(actx);
|
|
4910
|
+
if (!input || typeof input.setDraft !== "function") return {
|
|
4911
|
+
ok: false,
|
|
4912
|
+
code: "no-input-facade"
|
|
4913
|
+
};
|
|
4914
|
+
var draft = readDraftText(input);
|
|
4915
|
+
var reRef = /@"(picks\/([^"\s]+\.json))"/g;
|
|
4916
|
+
var mentions = [], mm;
|
|
4917
|
+
while ((mm = reRef.exec(draft)) !== null) mentions.push(mm[2]);
|
|
4918
|
+
var existingFile = null;
|
|
4919
|
+
for (var i = 0; i < mentions.length; i++) {
|
|
4920
|
+
var lres = await postJson("/bcdp/api/picks-load", {
|
|
4921
|
+
file: mentions[i],
|
|
4922
|
+
session: sessionId
|
|
4923
|
+
});
|
|
4924
|
+
if (!lres || lres.ok === false || !lres.value) continue;
|
|
4925
|
+
try {
|
|
4926
|
+
var obj = JSON.parse(lres.value.content);
|
|
4927
|
+
if (obj && obj.type === "tab-anchor-report" && obj.targetId === space.targetId) {
|
|
4928
|
+
existingFile = mentions[i];
|
|
4929
|
+
break;
|
|
4930
|
+
}
|
|
4931
|
+
} catch (e) {}
|
|
4932
|
+
}
|
|
4933
|
+
var body = {
|
|
4934
|
+
targetId: space.targetId,
|
|
4935
|
+
session: sessionId
|
|
4936
|
+
};
|
|
4937
|
+
if (space.url) body.url = space.url;
|
|
4938
|
+
if (space.title) body.title = space.title;
|
|
4939
|
+
if (existingFile) body.file = existingFile;
|
|
4940
|
+
var res = await postJson("/bcdp/api/tab-anchor-report", body);
|
|
4941
|
+
if (!res || res.ok === false || !res.value) return {
|
|
4942
|
+
ok: false,
|
|
4943
|
+
code: res && res.error && res.error.code || "report-failed"
|
|
4944
|
+
};
|
|
4945
|
+
var token = typeof res.value.token === "string" ? res.value.token : "@\"picks/" + res.value.file + "\"";
|
|
4946
|
+
var pageCount = Number(res.value.count) || 0;
|
|
4947
|
+
if (!await tryInsertPickChip(ctx, sessionId, actx, input, token, "🌐 " + (space.title || space.url || "tab") + " · " + pageCount)) {
|
|
4948
|
+
var cur = readDraftText(input);
|
|
4949
|
+
cur = cur ? cur + (cur.charAt(cur.length - 1) === "\n" ? "" : "\n") + token : token;
|
|
4950
|
+
input.setDraft(cur);
|
|
4951
|
+
}
|
|
4952
|
+
return {
|
|
4953
|
+
ok: true,
|
|
4954
|
+
code: "delivered",
|
|
4955
|
+
file: res.value.file,
|
|
4956
|
+
count: pageCount,
|
|
4957
|
+
truncated: !!res.value.truncated
|
|
4958
|
+
};
|
|
4959
|
+
} catch (err) {
|
|
4960
|
+
return {
|
|
4961
|
+
ok: false,
|
|
4962
|
+
code: "deliver-failed",
|
|
4963
|
+
message: String(err && err.message || err)
|
|
4964
|
+
};
|
|
4965
|
+
}
|
|
4966
|
+
}
|
|
4350
4967
|
function createPickControl(onState, deliver) {
|
|
4351
4968
|
var enabled = false;
|
|
4352
4969
|
var timer = null;
|
|
@@ -4531,6 +5148,8 @@ function LivePreviewController(ctx) {
|
|
|
4531
5148
|
this._zoomHint = null;
|
|
4532
5149
|
this._zoomHintTimer = null;
|
|
4533
5150
|
this._pointerState = null;
|
|
5151
|
+
this.link = null;
|
|
5152
|
+
this.trackAll = false;
|
|
4534
5153
|
var self = this;
|
|
4535
5154
|
this.keyboardProxy = createKeyboardProxy(function(targetId, type, params) {
|
|
4536
5155
|
self.sendInput(targetId, type, params);
|
|
@@ -4559,6 +5178,9 @@ LivePreviewController.prototype._initialState = function() {
|
|
|
4559
5178
|
busy: false,
|
|
4560
5179
|
showLoginGuide: false,
|
|
4561
5180
|
captchaKind: null,
|
|
5181
|
+
link: null,
|
|
5182
|
+
trackAll: false,
|
|
5183
|
+
agentActiveId: null,
|
|
4562
5184
|
historyOpen: false,
|
|
4563
5185
|
zoomHint: null,
|
|
4564
5186
|
wiringStale: false,
|
|
@@ -4605,7 +5227,7 @@ LivePreviewController.prototype._recompute = function() {
|
|
|
4605
5227
|
return s.targetId === self.selectedTabId;
|
|
4606
5228
|
}) || null;
|
|
4607
5229
|
currentTargetId = this.selectedTabId;
|
|
4608
|
-
if (currentSpace
|
|
5230
|
+
if (currentSpace) {
|
|
4609
5231
|
var cached = this.frameCache.get(currentTargetId);
|
|
4610
5232
|
if (cached) currentSpace = Object.assign({}, currentSpace, { thumbnail: cached });
|
|
4611
5233
|
}
|
|
@@ -4619,10 +5241,8 @@ LivePreviewController.prototype._recompute = function() {
|
|
|
4619
5241
|
if (activeMarked) {
|
|
4620
5242
|
currentSpace = Object.assign({}, activeMarked);
|
|
4621
5243
|
currentTargetId = activeMarked.targetId;
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
if (cached2) currentSpace.thumbnail = cached2;
|
|
4625
|
-
}
|
|
5244
|
+
var cached2 = this.frameCache.get(currentTargetId);
|
|
5245
|
+
if (cached2) currentSpace.thumbnail = cached2;
|
|
4626
5246
|
}
|
|
4627
5247
|
}
|
|
4628
5248
|
this.currentActiveId = currentTargetId;
|
|
@@ -4651,17 +5271,36 @@ LivePreviewController.prototype._recompute = function() {
|
|
|
4651
5271
|
s.engineUnsupported = self.engineUnsupported;
|
|
4652
5272
|
s.pick = self._pick;
|
|
4653
5273
|
s.pickMessage = self._pickMessage;
|
|
5274
|
+
s.link = self.link;
|
|
5275
|
+
s.trackAll = self.trackAll;
|
|
5276
|
+
s.agentActiveId = self.agentActiveId;
|
|
4654
5277
|
});
|
|
4655
5278
|
this._syncWatch(currentTargetId);
|
|
4656
5279
|
};
|
|
4657
5280
|
LivePreviewController.prototype.start = function() {
|
|
4658
5281
|
document.addEventListener("visibilitychange", this.onDocumentVisibility);
|
|
5282
|
+
var self = this;
|
|
5283
|
+
fetch(TRACKING_ROUTE, { cache: "no-store" }).then(function(res) {
|
|
5284
|
+
return res.json().catch(function() {
|
|
5285
|
+
return null;
|
|
5286
|
+
});
|
|
5287
|
+
}).then(function(data) {
|
|
5288
|
+
if (data && typeof data.all === "boolean") {
|
|
5289
|
+
self.trackAll = data.all;
|
|
5290
|
+
self._recompute();
|
|
5291
|
+
}
|
|
5292
|
+
}).catch(function() {});
|
|
4659
5293
|
this._recompute();
|
|
4660
5294
|
if (this.visible) {
|
|
4661
5295
|
this.refresh();
|
|
4662
5296
|
this.openStream();
|
|
4663
5297
|
}
|
|
4664
5298
|
};
|
|
5299
|
+
LivePreviewController.prototype.setTrackAll = function(all) {
|
|
5300
|
+
this.trackAll = all === true;
|
|
5301
|
+
this._recompute();
|
|
5302
|
+
setTrackAllRemote(this.trackAll);
|
|
5303
|
+
};
|
|
4665
5304
|
LivePreviewController.prototype.togglePick = function() {
|
|
4666
5305
|
var targetId = this.currentActiveId;
|
|
4667
5306
|
if (this.pickControl.isEnabled()) {
|
|
@@ -4841,12 +5480,13 @@ LivePreviewController.prototype.refresh = function() {
|
|
|
4841
5480
|
self._renderEmpty();
|
|
4842
5481
|
return;
|
|
4843
5482
|
}
|
|
5483
|
+
if (data.link) self.link = data.link;
|
|
4844
5484
|
self._applyCaptureStatus(data.capture);
|
|
4845
5485
|
if (data.cliFrameMode === true && Array.isArray(data.spaces)) {
|
|
4846
|
-
var
|
|
4847
|
-
return s && s.targetId ===
|
|
4848
|
-
});
|
|
4849
|
-
if (
|
|
5486
|
+
var cliActive = data.spaces.find(function(s) {
|
|
5487
|
+
return s && (s.targetId === data.cliFrameTargetId || s.active === true);
|
|
5488
|
+
}) || data.spaces[0];
|
|
5489
|
+
if (cliActive) self.frameCache.set(cliActive.targetId || CLI_FRAME_TARGET_ID, CLI_FRAME_ROUTE + "?t=" + (cliActive.lastActive || Date.now()));
|
|
4850
5490
|
self._processSpaces(data.spaces);
|
|
4851
5491
|
return;
|
|
4852
5492
|
}
|
|
@@ -4861,7 +5501,11 @@ LivePreviewController.prototype._renderEmpty = function() {
|
|
|
4861
5501
|
};
|
|
4862
5502
|
LivePreviewController.prototype._processSpaces = function(spaces) {
|
|
4863
5503
|
if (this.disposed) return;
|
|
4864
|
-
|
|
5504
|
+
var incoming = Array.isArray(spaces) ? spaces : [];
|
|
5505
|
+
this.lastList = this.trackAll ? incoming : incoming.filter(function(s$1) {
|
|
5506
|
+
return s$1 && s$1.active === true;
|
|
5507
|
+
}).slice(0, 1);
|
|
5508
|
+
if (this.lastList.length === 0 && incoming.length === 1) this.lastList = incoming.slice(0, 1);
|
|
4865
5509
|
for (var i = 0; i < this.lastList.length; i++) {
|
|
4866
5510
|
var s = this.lastList[i];
|
|
4867
5511
|
var prev = this.pageMeta.get(s.targetId) || { targetId: s.targetId };
|
|
@@ -5053,6 +5697,7 @@ LivePreviewController.prototype.unpin = function() {
|
|
|
5053
5697
|
this._recompute();
|
|
5054
5698
|
};
|
|
5055
5699
|
LivePreviewController.prototype.selectTab = function(targetId) {
|
|
5700
|
+
if (targetId !== this.currentActiveId) switchTabRemote(targetId);
|
|
5056
5701
|
if (this.selectedTabId === targetId) {
|
|
5057
5702
|
this.selectedTabId = null;
|
|
5058
5703
|
this.pinned = null;
|
|
@@ -5118,6 +5763,15 @@ LivePreviewController.prototype.noteWired = function() {
|
|
|
5118
5763
|
if (!self.disposed) self._recompute();
|
|
5119
5764
|
});
|
|
5120
5765
|
};
|
|
5766
|
+
LivePreviewController.prototype.noteViewport = function(targetId, width, height) {
|
|
5767
|
+
if (targetId == null) return;
|
|
5768
|
+
if (!Number.isFinite(width) || !Number.isFinite(height)) return;
|
|
5769
|
+
if (width <= 0 || height <= 0) return;
|
|
5770
|
+
var meta = this.pageMeta.get(targetId) || {};
|
|
5771
|
+
meta.vw = width;
|
|
5772
|
+
meta.vh = height;
|
|
5773
|
+
this.pageMeta.set(targetId, meta);
|
|
5774
|
+
};
|
|
5121
5775
|
LivePreviewController.prototype._signalUnwired = function() {
|
|
5122
5776
|
var now = Date.now();
|
|
5123
5777
|
if (now - this._lastUnwiredAt < 5e3) return;
|
|
@@ -5273,12 +5927,141 @@ function EgoBrowserTab(props) {
|
|
|
5273
5927
|
});
|
|
5274
5928
|
var imgRef = React.useRef(null);
|
|
5275
5929
|
var videoRef = React.useRef(null);
|
|
5930
|
+
var stageRef = React.useRef(null);
|
|
5931
|
+
var sizeSyncRef = React.useRef(null);
|
|
5932
|
+
if (sizeSyncRef.current === null) {
|
|
5933
|
+
sizeSyncRef.current = createWindowSizeSync();
|
|
5934
|
+
sizeSyncRef.current.setEnabled(sizeSyncStored());
|
|
5935
|
+
}
|
|
5936
|
+
var sizeSync = sizeSyncRef.current;
|
|
5937
|
+
var sizeSyncState = React.useState(sizeSync.isEnabled());
|
|
5938
|
+
var sizeSyncOn = sizeSyncState[0];
|
|
5939
|
+
var setSizeSyncOn = sizeSyncState[1];
|
|
5940
|
+
var presetState = React.useState(false);
|
|
5941
|
+
var presetOpen = presetState[0];
|
|
5942
|
+
var setPresetOpen = presetState[1];
|
|
5943
|
+
var noticeState = React.useState("");
|
|
5944
|
+
var sizeNotice = noticeState[0];
|
|
5945
|
+
var setSizeNotice = noticeState[1];
|
|
5946
|
+
var noteSizeResult = function(status, parsed) {
|
|
5947
|
+
if (status === 400 || status === 404) setSizeNotice(wt("sizeApiOutdated"));
|
|
5948
|
+
else if (parsed && parsed.ok === true) setSizeNotice("");
|
|
5949
|
+
};
|
|
5950
|
+
var noteViewport = function(targetId, parsed) {
|
|
5951
|
+
if (parsed && parsed.ok === true && parsed.viewport) controller.noteViewport(targetId, parsed.viewport.width, parsed.viewport.height);
|
|
5952
|
+
};
|
|
5953
|
+
var applyPreset = function(ratio) {
|
|
5954
|
+
setPresetOpen(false);
|
|
5955
|
+
var targetId = state.currentTargetId;
|
|
5956
|
+
panelWindowSize({ aspect: ratio }).then(function(parsed) {
|
|
5957
|
+
noteSizeResult(200, parsed);
|
|
5958
|
+
noteViewport(targetId, parsed);
|
|
5959
|
+
if (parsed && parsed.ok === true) controller.refresh();
|
|
5960
|
+
}).catch(function() {
|
|
5961
|
+
setSizeNotice(wt("actionFailed"));
|
|
5962
|
+
});
|
|
5963
|
+
};
|
|
5964
|
+
var openUrlInPanel = function() {
|
|
5965
|
+
var current = state.currentSpace;
|
|
5966
|
+
var entered = window.prompt(wt("openUrlPrompt"), current && current.url || "https://");
|
|
5967
|
+
if (entered === null) return;
|
|
5968
|
+
var url = normalizeUrlInput(entered);
|
|
5969
|
+
if (url === "") return;
|
|
5970
|
+
var targetId = state.currentTargetId;
|
|
5971
|
+
setSizeNotice("");
|
|
5972
|
+
panelNavigate(url, false).then(function(parsed) {
|
|
5973
|
+
if (parsed && parsed.ok === true) {
|
|
5974
|
+
setSizeNotice("");
|
|
5975
|
+
noteViewport(targetId, parsed);
|
|
5976
|
+
controller.refresh();
|
|
5977
|
+
} else setSizeNotice(parsed && parsed.error || wt("actionFailed"));
|
|
5978
|
+
}).catch(function() {
|
|
5979
|
+
setSizeNotice(wt("actionFailed"));
|
|
5980
|
+
});
|
|
5981
|
+
};
|
|
5982
|
+
var reloadPage = function() {
|
|
5983
|
+
setSizeNotice("");
|
|
5984
|
+
panelNavigate("", true).then(function(parsed) {
|
|
5985
|
+
if (parsed && parsed.ok === true) {
|
|
5986
|
+
setSizeNotice("");
|
|
5987
|
+
controller.refresh();
|
|
5988
|
+
} else setSizeNotice(parsed && parsed.error || wt("actionFailed"));
|
|
5989
|
+
}).catch(function() {
|
|
5990
|
+
setSizeNotice(wt("actionFailed"));
|
|
5991
|
+
});
|
|
5992
|
+
};
|
|
5993
|
+
var maximizeWindow = function() {
|
|
5994
|
+
var targetId = state.currentTargetId;
|
|
5995
|
+
setSizeNotice("");
|
|
5996
|
+
panelWindowSize({ maximize: true }).then(function(parsed) {
|
|
5997
|
+
noteSizeResult(200, parsed);
|
|
5998
|
+
noteViewport(targetId, parsed);
|
|
5999
|
+
if (parsed && parsed.ok === true) controller.refresh();
|
|
6000
|
+
else setSizeNotice(parsed && parsed.error || wt("actionFailed"));
|
|
6001
|
+
}).catch(function() {
|
|
6002
|
+
setSizeNotice(wt("actionFailed"));
|
|
6003
|
+
});
|
|
6004
|
+
};
|
|
6005
|
+
React.useEffect(function() {
|
|
6006
|
+
if (!presetOpen) return;
|
|
6007
|
+
return function() {};
|
|
6008
|
+
}, [presetOpen]);
|
|
6009
|
+
var beginResize = function(axis) {
|
|
6010
|
+
return function(event) {
|
|
6011
|
+
event.preventDefault();
|
|
6012
|
+
event.stopPropagation();
|
|
6013
|
+
var startX = event.clientX;
|
|
6014
|
+
var startY = event.clientY;
|
|
6015
|
+
var sentX = 0;
|
|
6016
|
+
var sentY = 0;
|
|
6017
|
+
var lastAt = 0;
|
|
6018
|
+
var inFlight = false;
|
|
6019
|
+
var targetId = state.currentTargetId;
|
|
6020
|
+
var sendStep = function(stepX, stepY) {
|
|
6021
|
+
var payload = {};
|
|
6022
|
+
if (Math.abs(stepX) >= 1) payload.delta = Math.round(stepX);
|
|
6023
|
+
if (Math.abs(stepY) >= 1) payload.dy = Math.round(stepY);
|
|
6024
|
+
if (payload.delta === void 0 && payload.dy === void 0) return;
|
|
6025
|
+
panelWindowSize(payload).then(function(parsed) {
|
|
6026
|
+
noteSizeResult(200, parsed);
|
|
6027
|
+
noteViewport(targetId, parsed);
|
|
6028
|
+
}).catch(function() {
|
|
6029
|
+
return null;
|
|
6030
|
+
}).then(function() {
|
|
6031
|
+
inFlight = false;
|
|
6032
|
+
});
|
|
6033
|
+
};
|
|
6034
|
+
var onMove = function(ev) {
|
|
6035
|
+
var dxTotal = axis === "y" ? 0 : ev.clientX - startX;
|
|
6036
|
+
var dyTotal = axis === "x" ? 0 : ev.clientY - startY;
|
|
6037
|
+
var stepX = dxTotal - sentX;
|
|
6038
|
+
var stepY = dyTotal - sentY;
|
|
6039
|
+
if (Math.abs(stepX) < 3 && Math.abs(stepY) < 3) return;
|
|
6040
|
+
var now = Date.now();
|
|
6041
|
+
if (inFlight || now - lastAt < 120) return;
|
|
6042
|
+
inFlight = true;
|
|
6043
|
+
lastAt = now;
|
|
6044
|
+
sentX = dxTotal;
|
|
6045
|
+
sentY = dyTotal;
|
|
6046
|
+
sendStep(stepX, stepY);
|
|
6047
|
+
};
|
|
6048
|
+
var onUp = function() {
|
|
6049
|
+
document.removeEventListener("pointermove", onMove);
|
|
6050
|
+
document.removeEventListener("pointerup", onUp);
|
|
6051
|
+
document.removeEventListener("pointercancel", onUp);
|
|
6052
|
+
};
|
|
6053
|
+
document.addEventListener("pointermove", onMove);
|
|
6054
|
+
document.addEventListener("pointerup", onUp);
|
|
6055
|
+
document.addEventListener("pointercancel", onUp);
|
|
6056
|
+
};
|
|
6057
|
+
};
|
|
5276
6058
|
var bindLiveImg = function(el) {
|
|
5277
6059
|
imgRef.current = el;
|
|
5278
6060
|
if (el && state.currentTargetId != null && (controller.liveImg !== el || controller.liveImgTargetId !== state.currentTargetId)) {
|
|
5279
6061
|
controller.setLiveImg(el, state.currentTargetId);
|
|
5280
6062
|
controller.noteWired();
|
|
5281
6063
|
}
|
|
6064
|
+
if (sizeSyncOn) sizeSync.attach(stageRef.current || el);
|
|
5282
6065
|
};
|
|
5283
6066
|
var bindLiveVideo = function(el) {
|
|
5284
6067
|
videoRef.current = el;
|
|
@@ -5286,6 +6069,7 @@ function EgoBrowserTab(props) {
|
|
|
5286
6069
|
controller.setLiveVideo(el, state.currentTargetId);
|
|
5287
6070
|
controller.noteWired();
|
|
5288
6071
|
}
|
|
6072
|
+
if (sizeSyncOn) sizeSync.attach(stageRef.current || el);
|
|
5289
6073
|
};
|
|
5290
6074
|
React.useEffect(function() {
|
|
5291
6075
|
controller.start();
|
|
@@ -5296,6 +6080,21 @@ function EgoBrowserTab(props) {
|
|
|
5296
6080
|
React.useEffect(function() {
|
|
5297
6081
|
controller.setVisible(visible);
|
|
5298
6082
|
}, [visible, controller]);
|
|
6083
|
+
React.useEffect(function() {
|
|
6084
|
+
if (!visible) sizeSync.attach(null);
|
|
6085
|
+
else if (sizeSyncOn) sizeSync.attach(stageRef.current || imgRef.current || videoRef.current);
|
|
6086
|
+
}, [
|
|
6087
|
+
visible,
|
|
6088
|
+
sizeSyncOn,
|
|
6089
|
+
sizeSync,
|
|
6090
|
+
state.currentTargetId,
|
|
6091
|
+
state.backend
|
|
6092
|
+
]);
|
|
6093
|
+
React.useEffect(function() {
|
|
6094
|
+
return function() {
|
|
6095
|
+
sizeSync.dispose();
|
|
6096
|
+
};
|
|
6097
|
+
}, [sizeSync]);
|
|
5299
6098
|
React.useEffect(function() {
|
|
5300
6099
|
if (imgRef.current && state.currentTargetId != null) controller.setLiveImg(imgRef.current, state.currentTargetId);
|
|
5301
6100
|
if (videoRef.current && state.currentTargetId != null) controller.setLiveVideo(videoRef.current, state.currentTargetId);
|
|
@@ -5323,6 +6122,15 @@ function EgoBrowserTab(props) {
|
|
|
5323
6122
|
state.streamGeneration
|
|
5324
6123
|
]);
|
|
5325
6124
|
var h = React.createElement;
|
|
6125
|
+
var icon = function(svg) {
|
|
6126
|
+
return h("span", {
|
|
6127
|
+
style: {
|
|
6128
|
+
display: "inline-flex",
|
|
6129
|
+
alignItems: "center"
|
|
6130
|
+
},
|
|
6131
|
+
dangerouslySetInnerHTML: { __html: svg }
|
|
6132
|
+
});
|
|
6133
|
+
};
|
|
5326
6134
|
var header = h("div", { className: "dsh-ego-side-head" }, h("span", { className: "dsh-ego-side-title" }, h("span", { dangerouslySetInnerHTML: { __html: ICON_GLOBE } }), h("span", { style: { marginLeft: "5px" } }, state.busy ? wt("titleLive") : wt("title"))), h("button", {
|
|
5327
6135
|
className: "dsh-ego-side-iconbtn" + (state.busy ? " spinning" : ""),
|
|
5328
6136
|
title: wt("refresh"),
|
|
@@ -5352,24 +6160,52 @@ function EgoBrowserTab(props) {
|
|
|
5352
6160
|
className: "dsh-ego-side-hthumb",
|
|
5353
6161
|
src: s.thumbnail,
|
|
5354
6162
|
alt: ""
|
|
5355
|
-
}) : h("div", { className: "dsh-ego-side-hthumb" }), h("div", { className: "dsh-ego-side-hinfo" }, h("div", { className: "dsh-ego-side-htitle" }, s.title || s.url || wt("newTab")), h("div", { className: "dsh-ego-side-hurl" }, s.url || "(about:blank)"), s.targetId === state.currentTargetId ? h("div", { className: "dsh-ego-side-hactive" }, "● " + wt("current")) : null)
|
|
6163
|
+
}) : h("div", { className: "dsh-ego-side-hthumb" }), h("div", { className: "dsh-ego-side-hinfo" }, h("div", { className: "dsh-ego-side-htitle" }, s.title || s.url || wt("newTab")), h("div", { className: "dsh-ego-side-hurl" }, s.url || "(about:blank)"), s.targetId === state.currentTargetId ? h("div", { className: "dsh-ego-side-hactive" }, "● " + wt("current")) : null), h("button", {
|
|
6164
|
+
className: "dsh-ego-side-hat",
|
|
6165
|
+
type: "button",
|
|
6166
|
+
title: wt("atQuote"),
|
|
6167
|
+
onClick: function(ev) {
|
|
6168
|
+
ev.stopPropagation();
|
|
6169
|
+
var el = ev.currentTarget;
|
|
6170
|
+
if (el) el.className = "dsh-ego-side-hat busy";
|
|
6171
|
+
deliverTabReport(ctx, s).then(function(r) {
|
|
6172
|
+
if (!el) return;
|
|
6173
|
+
if (r && r.ok) {
|
|
6174
|
+
el.className = "dsh-ego-side-hat done";
|
|
6175
|
+
setTimeout(function() {
|
|
6176
|
+
el.className = "dsh-ego-side-hat";
|
|
6177
|
+
}, 1200);
|
|
6178
|
+
} else {
|
|
6179
|
+
el.className = "dsh-ego-side-hat err";
|
|
6180
|
+
setTimeout(function() {
|
|
6181
|
+
el.className = "dsh-ego-side-hat";
|
|
6182
|
+
}, 1500);
|
|
6183
|
+
console.warn("dsh-browser-cdp: tab anchor report failed", r && r.code);
|
|
6184
|
+
}
|
|
6185
|
+
}).catch(function() {
|
|
6186
|
+
if (el) el.className = "dsh-ego-side-hat";
|
|
6187
|
+
});
|
|
6188
|
+
}
|
|
6189
|
+
}, "@"));
|
|
5356
6190
|
}))));
|
|
5357
6191
|
}
|
|
5358
6192
|
var guides = [];
|
|
5359
6193
|
if (state.showLoginGuide) guides.push(h(EgoLoginGuide, {
|
|
5360
6194
|
key: "login",
|
|
5361
|
-
controller
|
|
6195
|
+
controller,
|
|
6196
|
+
link: state.link
|
|
5362
6197
|
}));
|
|
5363
6198
|
if (state.captchaKind) guides.push(h(EgoCaptchaGuide, {
|
|
5364
6199
|
key: "captcha",
|
|
5365
6200
|
kind: state.captchaKind,
|
|
5366
|
-
controller
|
|
6201
|
+
controller,
|
|
6202
|
+
link: state.link
|
|
5367
6203
|
}));
|
|
5368
6204
|
var tabsEl = state.spaces.length > 0 ? h("div", { className: "dsh-ego-side-tabs" }, state.spaces.map(function(s) {
|
|
5369
6205
|
var isActive = s.targetId === state.selectedTabId || state.selectedTabId === null && s.targetId === state.currentTargetId;
|
|
5370
6206
|
return h("div", {
|
|
5371
6207
|
key: s.targetId,
|
|
5372
|
-
className: "dsh-ego-side-tab" + (isActive ? " active" : ""),
|
|
6208
|
+
className: "dsh-ego-side-tab" + (isActive ? " active" : "") + (s.active === true ? " is-live" : ""),
|
|
5373
6209
|
title: s.url || "",
|
|
5374
6210
|
onClick: function() {
|
|
5375
6211
|
controller.selectTab(s.targetId);
|
|
@@ -5470,7 +6306,70 @@ function EgoBrowserTab(props) {
|
|
|
5470
6306
|
return null;
|
|
5471
6307
|
});
|
|
5472
6308
|
}
|
|
5473
|
-
}, wt("raiseWindow"))
|
|
6309
|
+
}, wt("raiseWindow")), h("button", {
|
|
6310
|
+
className: "dsh-ego-side-back",
|
|
6311
|
+
type: "button",
|
|
6312
|
+
title: wt("pageRefreshHint"),
|
|
6313
|
+
onClick: reloadPage
|
|
6314
|
+
}, icon(ICON_REFRESH), wt("pageRefresh")), h("button", {
|
|
6315
|
+
className: "dsh-ego-side-back",
|
|
6316
|
+
type: "button",
|
|
6317
|
+
title: wt("openUrlHint"),
|
|
6318
|
+
onClick: openUrlInPanel
|
|
6319
|
+
}, icon(ICON_LINK), wt("openUrl")), h("button", {
|
|
6320
|
+
className: "dsh-ego-side-back" + (state.trackAll ? " on" : ""),
|
|
6321
|
+
type: "button",
|
|
6322
|
+
title: state.trackAll ? wt("trackAllHintOn") : wt("trackAllHintOff"),
|
|
6323
|
+
onClick: function() {
|
|
6324
|
+
controller.setTrackAll(!state.trackAll);
|
|
6325
|
+
}
|
|
6326
|
+
}, icon(state.trackAll ? ICON_GRID : ICON_SQUARE), state.trackAll ? wt("trackAllOn") : wt("trackAllOff")), h("button", {
|
|
6327
|
+
className: "dsh-ego-side-back" + (sizeSyncOn ? " on" : ""),
|
|
6328
|
+
type: "button",
|
|
6329
|
+
title: wt("sizeSyncHint"),
|
|
6330
|
+
onClick: function() {
|
|
6331
|
+
var next = !sizeSyncOn;
|
|
6332
|
+
setSizeSyncOn(next);
|
|
6333
|
+
sizeSync.setEnabled(next);
|
|
6334
|
+
if (next) sizeSync.attach(stageRef.current || imgRef.current || videoRef.current);
|
|
6335
|
+
}
|
|
6336
|
+
}, icon(sizeSyncOn ? ICON_LOCK : ICON_UNLOCK), sizeSyncOn ? wt("sizeSyncOn") : wt("sizeSyncOff")), h("button", {
|
|
6337
|
+
className: "dsh-ego-side-back" + (presetOpen ? " on" : ""),
|
|
6338
|
+
type: "button",
|
|
6339
|
+
title: wt("sizePresetsHint"),
|
|
6340
|
+
onClick: function() {
|
|
6341
|
+
setPresetOpen(!presetOpen);
|
|
6342
|
+
}
|
|
6343
|
+
}, icon(ICON_ASPECT), wt("sizePresets")), h("button", {
|
|
6344
|
+
className: "dsh-ego-side-back",
|
|
6345
|
+
type: "button",
|
|
6346
|
+
title: wt("maximizeHint"),
|
|
6347
|
+
onClick: maximizeWindow
|
|
6348
|
+
}, icon(ICON_MAXIMIZE), wt("maximizeWindow")), presetOpen ? h("div", { className: "dsh-ego-side-presets" }, SIZE_PRESETS.map(function(preset) {
|
|
6349
|
+
return h("button", {
|
|
6350
|
+
key: preset.label,
|
|
6351
|
+
type: "button",
|
|
6352
|
+
className: "dsh-ego-side-preset-item",
|
|
6353
|
+
onClick: function() {
|
|
6354
|
+
applyPreset(preset.ratio);
|
|
6355
|
+
}
|
|
6356
|
+
}, preset.label);
|
|
6357
|
+
})) : null), h("div", {
|
|
6358
|
+
className: "dsh-ego-side-stage" + (sizeSyncOn ? " dsh-ego-size-unlocked" : "") + (state.currentTargetId != null && state.currentTargetId === state.agentActiveId ? " is-live" : ""),
|
|
6359
|
+
ref: stageRef
|
|
6360
|
+
}, liveImg, h("div", {
|
|
6361
|
+
className: "dsh-ego-side-resize dsh-ego-side-resize-right",
|
|
6362
|
+
title: wt("resizeHint"),
|
|
6363
|
+
onPointerDown: beginResize("x")
|
|
6364
|
+
}), h("div", {
|
|
6365
|
+
className: "dsh-ego-side-resize dsh-ego-side-resize-bottom",
|
|
6366
|
+
title: wt("resizeHint"),
|
|
6367
|
+
onPointerDown: beginResize("y")
|
|
6368
|
+
}), h("div", {
|
|
6369
|
+
className: "dsh-ego-side-resize dsh-ego-side-resize-corner",
|
|
6370
|
+
title: wt("resizeHint"),
|
|
6371
|
+
onPointerDown: beginResize("xy")
|
|
6372
|
+
})), h("div", { className: "dsh-ego-side-livetitle" }, currentSpace.title || currentSpace.url || wt("newTab")), h("div", { className: "dsh-ego-side-liveurl" + (state.zoomHint || sizeNotice ? " dsh-ego-side-hint" : "") }, sizeNotice || state.zoomHint || currentSpace.url || "")));
|
|
5474
6373
|
}
|
|
5475
6374
|
return h("div", { className: "dsh-ego-side-root" }, header, guides, tabsEl, body);
|
|
5476
6375
|
}
|
|
@@ -5481,7 +6380,8 @@ function EgoLoginGuide(props) {
|
|
|
5481
6380
|
var note = noteState[0], setNote = noteState[1];
|
|
5482
6381
|
var savingState = React.useState(false);
|
|
5483
6382
|
var saving = savingState[0], setSaving = savingState[1];
|
|
5484
|
-
|
|
6383
|
+
var canFlush = linkFlushable(props.link);
|
|
6384
|
+
return h("div", { className: "dsh-ego-side-login" }, h("span", { className: "dsh-ego-side-login-txt" }, linkLoginLine(props.link)), canFlush ? h("button", {
|
|
5485
6385
|
className: "dsh-ego-side-login-btn" + (saving ? " saving" : ""),
|
|
5486
6386
|
type: "button",
|
|
5487
6387
|
disabled: saving,
|
|
@@ -5497,7 +6397,7 @@ function EgoLoginGuide(props) {
|
|
|
5497
6397
|
setSaving(false);
|
|
5498
6398
|
});
|
|
5499
6399
|
}
|
|
5500
|
-
}, saving ? wt("loginSaving") : wt("loginBtn")), note ? h("span", { className: "dsh-ego-side-login-note" }, note) : null, h("button", {
|
|
6400
|
+
}, saving ? wt("loginSaving") : wt("loginBtn")) : null, !canFlush ? h("span", { className: "dsh-ego-side-login-note" }, wt("loginSelfPersist")) : null, note ? h("span", { className: "dsh-ego-side-login-note" }, note) : null, h("button", {
|
|
5501
6401
|
className: "dsh-ego-side-iconbtn",
|
|
5502
6402
|
type: "button",
|
|
5503
6403
|
title: wt("loginDismiss"),
|
|
@@ -5510,7 +6410,7 @@ function EgoCaptchaGuide(props) {
|
|
|
5510
6410
|
var controller = props.controller;
|
|
5511
6411
|
var kind = props.kind;
|
|
5512
6412
|
var h = React.createElement;
|
|
5513
|
-
return h("div", { className: "dsh-ego-side-captcha" }, h("span", { className: "dsh-ego-side-captcha-txt" }, h("b", null, wt("captchaTitle")), " — " +
|
|
6413
|
+
return h("div", { className: "dsh-ego-side-captcha" }, h("span", { className: "dsh-ego-side-captcha-txt" }, h("b", null, wt("captchaTitle")), " — " + linkCaptchaLine(props.link)), h("span", { className: "dsh-ego-side-captcha-kind" }, kind), h("button", {
|
|
5514
6414
|
className: "dsh-ego-side-iconbtn",
|
|
5515
6415
|
type: "button",
|
|
5516
6416
|
title: wt("captchaDismiss"),
|