@vforsh/argus-watcher 0.1.2 → 0.1.4
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/README.md +67 -14
- package/dist/.tsbuildinfo +1 -1
- package/dist/artifacts.d.ts +13 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +27 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/buffer/LogBuffer.d.ts +8 -3
- package/dist/buffer/LogBuffer.d.ts.map +1 -1
- package/dist/buffer/LogBuffer.js +9 -1
- package/dist/buffer/LogBuffer.js.map +1 -1
- package/dist/buffer/NetBuffer.d.ts +29 -0
- package/dist/buffer/NetBuffer.d.ts.map +1 -0
- package/dist/buffer/NetBuffer.js +85 -0
- package/dist/buffer/NetBuffer.js.map +1 -0
- package/dist/cdp/accessibility.d.ts +18 -0
- package/dist/cdp/accessibility.d.ts.map +1 -0
- package/dist/cdp/accessibility.js +300 -0
- package/dist/cdp/accessibility.js.map +1 -0
- package/dist/cdp/connection.d.ts +39 -0
- package/dist/cdp/connection.d.ts.map +1 -0
- package/dist/cdp/connection.js +131 -0
- package/dist/cdp/connection.js.map +1 -0
- package/dist/cdp/dom/fill.d.ts +22 -0
- package/dist/cdp/dom/fill.d.ts.map +1 -0
- package/dist/cdp/dom/fill.js +59 -0
- package/dist/cdp/dom/fill.js.map +1 -0
- package/dist/cdp/dom/info.d.ts +14 -0
- package/dist/cdp/dom/info.d.ts.map +1 -0
- package/dist/cdp/dom/info.js +52 -0
- package/dist/cdp/dom/info.js.map +1 -0
- package/dist/cdp/dom/insert.d.ts +19 -0
- package/dist/cdp/dom/insert.d.ts.map +1 -0
- package/dist/cdp/dom/insert.js +30 -0
- package/dist/cdp/dom/insert.js.map +1 -0
- package/dist/cdp/dom/modify.d.ts +50 -0
- package/dist/cdp/dom/modify.d.ts.map +1 -0
- package/dist/cdp/dom/modify.js +100 -0
- package/dist/cdp/dom/modify.js.map +1 -0
- package/dist/cdp/dom/remove.d.ts +17 -0
- package/dist/cdp/dom/remove.d.ts.map +1 -0
- package/dist/cdp/dom/remove.js +27 -0
- package/dist/cdp/dom/remove.js.map +1 -0
- package/dist/cdp/dom/selector.d.ts +19 -0
- package/dist/cdp/dom/selector.d.ts.map +1 -0
- package/dist/cdp/dom/selector.js +86 -0
- package/dist/cdp/dom/selector.js.map +1 -0
- package/dist/cdp/dom/setFile.d.ts +21 -0
- package/dist/cdp/dom/setFile.d.ts.map +1 -0
- package/dist/cdp/dom/setFile.js +25 -0
- package/dist/cdp/dom/setFile.js.map +1 -0
- package/dist/cdp/dom/submit.d.ts +15 -0
- package/dist/cdp/dom/submit.d.ts.map +1 -0
- package/dist/cdp/dom/submit.js +130 -0
- package/dist/cdp/dom/submit.js.map +1 -0
- package/dist/cdp/dom/tree.d.ts +16 -0
- package/dist/cdp/dom/tree.d.ts.map +1 -0
- package/dist/cdp/dom/tree.js +100 -0
- package/dist/cdp/dom/tree.js.map +1 -0
- package/dist/cdp/dom/types.d.ts +15 -0
- package/dist/cdp/dom/types.d.ts.map +1 -0
- package/dist/cdp/dom/types.js +2 -0
- package/dist/cdp/dom/types.js.map +1 -0
- package/dist/cdp/dom.d.ts +15 -0
- package/dist/cdp/dom.d.ts.map +1 -0
- package/dist/cdp/dom.js +9 -0
- package/dist/cdp/dom.js.map +1 -0
- package/dist/cdp/editor.d.ts +23 -0
- package/dist/cdp/editor.d.ts.map +1 -0
- package/dist/cdp/editor.js +266 -0
- package/dist/cdp/editor.js.map +1 -0
- package/dist/cdp/emulation.d.ts +16 -0
- package/dist/cdp/emulation.d.ts.map +1 -0
- package/dist/cdp/emulation.js +40 -0
- package/dist/cdp/emulation.js.map +1 -0
- package/dist/cdp/eval.d.ts +11 -0
- package/dist/cdp/eval.d.ts.map +1 -0
- package/dist/cdp/eval.js +79 -0
- package/dist/cdp/eval.js.map +1 -0
- package/dist/cdp/keyboard.d.ts +38 -0
- package/dist/cdp/keyboard.d.ts.map +1 -0
- package/dist/cdp/keyboard.js +148 -0
- package/dist/cdp/keyboard.js.map +1 -0
- package/dist/cdp/mouse.d.ts +49 -0
- package/dist/cdp/mouse.d.ts.map +1 -0
- package/dist/cdp/mouse.js +203 -0
- package/dist/cdp/mouse.js.map +1 -0
- package/dist/cdp/networkCapture.d.ts +11 -0
- package/dist/cdp/networkCapture.d.ts.map +1 -0
- package/dist/cdp/networkCapture.js +99 -0
- package/dist/cdp/networkCapture.js.map +1 -0
- package/dist/cdp/pageIndicator.d.ts +41 -0
- package/dist/cdp/pageIndicator.d.ts.map +1 -0
- package/dist/cdp/pageIndicator.js +395 -0
- package/dist/cdp/pageIndicator.js.map +1 -0
- package/dist/cdp/redaction.d.ts +3 -0
- package/dist/cdp/redaction.d.ts.map +1 -0
- package/dist/cdp/redaction.js +35 -0
- package/dist/cdp/redaction.js.map +1 -0
- package/dist/cdp/remoteObject.d.ts +6 -0
- package/dist/cdp/remoteObject.d.ts.map +1 -0
- package/dist/cdp/remoteObject.js +94 -0
- package/dist/cdp/remoteObject.js.map +1 -0
- package/dist/cdp/screenshot.d.ts +10 -0
- package/dist/cdp/screenshot.d.ts.map +1 -0
- package/dist/cdp/screenshot.js +83 -0
- package/dist/cdp/screenshot.js.map +1 -0
- package/dist/cdp/storageLocal.d.ts +8 -0
- package/dist/cdp/storageLocal.d.ts.map +1 -0
- package/dist/cdp/storageLocal.js +70 -0
- package/dist/cdp/storageLocal.js.map +1 -0
- package/dist/cdp/text-filter.d.ts +6 -0
- package/dist/cdp/text-filter.d.ts.map +1 -0
- package/dist/cdp/text-filter.js +36 -0
- package/dist/cdp/text-filter.js.map +1 -0
- package/dist/cdp/throttle.d.ts +6 -0
- package/dist/cdp/throttle.d.ts.map +1 -0
- package/dist/cdp/throttle.js +9 -0
- package/dist/cdp/throttle.js.map +1 -0
- package/dist/cdp/tracing.d.ts +15 -0
- package/dist/cdp/tracing.d.ts.map +1 -0
- package/dist/cdp/tracing.js +159 -0
- package/dist/cdp/tracing.js.map +1 -0
- package/dist/cdp/watcher.d.ts +17 -2
- package/dist/cdp/watcher.d.ts.map +1 -1
- package/dist/cdp/watcher.js +124 -175
- package/dist/cdp/watcher.js.map +1 -1
- package/dist/emulation/EmulationController.d.ts +12 -0
- package/dist/emulation/EmulationController.d.ts.map +1 -0
- package/dist/emulation/EmulationController.js +83 -0
- package/dist/emulation/EmulationController.js.map +1 -0
- package/dist/events.d.ts +86 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/fileLogs/WatcherFileLogger.d.ts +5 -2
- package/dist/fileLogs/WatcherFileLogger.d.ts.map +1 -1
- package/dist/fileLogs/WatcherFileLogger.js +30 -12
- package/dist/fileLogs/WatcherFileLogger.js.map +1 -1
- package/dist/http/httpUtils.d.ts +25 -0
- package/dist/http/httpUtils.d.ts.map +1 -0
- package/dist/http/httpUtils.js +170 -0
- package/dist/http/httpUtils.js.map +1 -0
- package/dist/http/router.d.ts +5 -0
- package/dist/http/router.d.ts.map +1 -0
- package/dist/http/router.js +85 -0
- package/dist/http/router.js.map +1 -0
- package/dist/http/routes/getEmulation.d.ts +3 -0
- package/dist/http/routes/getEmulation.d.ts.map +1 -0
- package/dist/http/routes/getEmulation.js +8 -0
- package/dist/http/routes/getEmulation.js.map +1 -0
- package/dist/http/routes/getLogs.d.ts +3 -0
- package/dist/http/routes/getLogs.d.ts.map +1 -0
- package/dist/http/routes/getLogs.js +28 -0
- package/dist/http/routes/getLogs.js.map +1 -0
- package/dist/http/routes/getNet.d.ts +3 -0
- package/dist/http/routes/getNet.d.ts.map +1 -0
- package/dist/http/routes/getNet.js +17 -0
- package/dist/http/routes/getNet.js.map +1 -0
- package/dist/http/routes/getNetTail.d.ts +3 -0
- package/dist/http/routes/getNetTail.d.ts.map +1 -0
- package/dist/http/routes/getNetTail.js +18 -0
- package/dist/http/routes/getNetTail.js.map +1 -0
- package/dist/http/routes/getStatus.d.ts +3 -0
- package/dist/http/routes/getStatus.d.ts.map +1 -0
- package/dist/http/routes/getStatus.js +21 -0
- package/dist/http/routes/getStatus.js.map +1 -0
- package/dist/http/routes/getTail.d.ts +3 -0
- package/dist/http/routes/getTail.d.ts.map +1 -0
- package/dist/http/routes/getTail.js +28 -0
- package/dist/http/routes/getTail.js.map +1 -0
- package/dist/http/routes/getTargets.d.ts +3 -0
- package/dist/http/routes/getTargets.d.ts.map +1 -0
- package/dist/http/routes/getTargets.js +16 -0
- package/dist/http/routes/getTargets.js.map +1 -0
- package/dist/http/routes/getThrottle.d.ts +3 -0
- package/dist/http/routes/getThrottle.d.ts.map +1 -0
- package/dist/http/routes/getThrottle.js +8 -0
- package/dist/http/routes/getThrottle.js.map +1 -0
- package/dist/http/routes/postAttach.d.ts +3 -0
- package/dist/http/routes/postAttach.d.ts.map +1 -0
- package/dist/http/routes/postAttach.js +24 -0
- package/dist/http/routes/postAttach.js.map +1 -0
- package/dist/http/routes/postCodeEdit.d.ts +3 -0
- package/dist/http/routes/postCodeEdit.d.ts.map +1 -0
- package/dist/http/routes/postCodeEdit.js +32 -0
- package/dist/http/routes/postCodeEdit.js.map +1 -0
- package/dist/http/routes/postCodeGrep.d.ts +3 -0
- package/dist/http/routes/postCodeGrep.d.ts.map +1 -0
- package/dist/http/routes/postCodeGrep.js +26 -0
- package/dist/http/routes/postCodeGrep.js.map +1 -0
- package/dist/http/routes/postCodeList.d.ts +3 -0
- package/dist/http/routes/postCodeList.d.ts.map +1 -0
- package/dist/http/routes/postCodeList.js +20 -0
- package/dist/http/routes/postCodeList.js.map +1 -0
- package/dist/http/routes/postCodeRead.d.ts +3 -0
- package/dist/http/routes/postCodeRead.d.ts.map +1 -0
- package/dist/http/routes/postCodeRead.js +30 -0
- package/dist/http/routes/postCodeRead.js.map +1 -0
- package/dist/http/routes/postDetach.d.ts +3 -0
- package/dist/http/routes/postDetach.d.ts.map +1 -0
- package/dist/http/routes/postDetach.js +24 -0
- package/dist/http/routes/postDetach.js.map +1 -0
- package/dist/http/routes/postDomAdd.d.ts +7 -0
- package/dist/http/routes/postDomAdd.d.ts.map +1 -0
- package/dist/http/routes/postDomAdd.js +97 -0
- package/dist/http/routes/postDomAdd.js.map +1 -0
- package/dist/http/routes/postDomClick.d.ts +3 -0
- package/dist/http/routes/postDomClick.d.ts.map +1 -0
- package/dist/http/routes/postDomClick.js +85 -0
- package/dist/http/routes/postDomClick.js.map +1 -0
- package/dist/http/routes/postDomFill.d.ts +3 -0
- package/dist/http/routes/postDomFill.d.ts.map +1 -0
- package/dist/http/routes/postDomFill.js +58 -0
- package/dist/http/routes/postDomFill.js.map +1 -0
- package/dist/http/routes/postDomFocus.d.ts +3 -0
- package/dist/http/routes/postDomFocus.d.ts.map +1 -0
- package/dist/http/routes/postDomFocus.js +40 -0
- package/dist/http/routes/postDomFocus.js.map +1 -0
- package/dist/http/routes/postDomHover.d.ts +3 -0
- package/dist/http/routes/postDomHover.d.ts.map +1 -0
- package/dist/http/routes/postDomHover.js +40 -0
- package/dist/http/routes/postDomHover.js.map +1 -0
- package/dist/http/routes/postDomInfo.d.ts +3 -0
- package/dist/http/routes/postDomInfo.d.ts.map +1 -0
- package/dist/http/routes/postDomInfo.js +40 -0
- package/dist/http/routes/postDomInfo.js.map +1 -0
- package/dist/http/routes/postDomKeydown.d.ts +3 -0
- package/dist/http/routes/postDomKeydown.d.ts.map +1 -0
- package/dist/http/routes/postDomKeydown.js +36 -0
- package/dist/http/routes/postDomKeydown.js.map +1 -0
- package/dist/http/routes/postDomModify.d.ts +3 -0
- package/dist/http/routes/postDomModify.d.ts.map +1 -0
- package/dist/http/routes/postDomModify.js +45 -0
- package/dist/http/routes/postDomModify.js.map +1 -0
- package/dist/http/routes/postDomRemove.d.ts +3 -0
- package/dist/http/routes/postDomRemove.d.ts.map +1 -0
- package/dist/http/routes/postDomRemove.js +39 -0
- package/dist/http/routes/postDomRemove.js.map +1 -0
- package/dist/http/routes/postDomScroll.d.ts +3 -0
- package/dist/http/routes/postDomScroll.d.ts.map +1 -0
- package/dist/http/routes/postDomScroll.js +75 -0
- package/dist/http/routes/postDomScroll.js.map +1 -0
- package/dist/http/routes/postDomScrollTo.d.ts +3 -0
- package/dist/http/routes/postDomScrollTo.d.ts.map +1 -0
- package/dist/http/routes/postDomScrollTo.js +69 -0
- package/dist/http/routes/postDomScrollTo.js.map +1 -0
- package/dist/http/routes/postDomSetFile.d.ts +3 -0
- package/dist/http/routes/postDomSetFile.d.ts.map +1 -0
- package/dist/http/routes/postDomSetFile.js +58 -0
- package/dist/http/routes/postDomSetFile.js.map +1 -0
- package/dist/http/routes/postDomSubmit.d.ts +3 -0
- package/dist/http/routes/postDomSubmit.d.ts.map +1 -0
- package/dist/http/routes/postDomSubmit.js +49 -0
- package/dist/http/routes/postDomSubmit.js.map +1 -0
- package/dist/http/routes/postDomTree.d.ts +3 -0
- package/dist/http/routes/postDomTree.d.ts.map +1 -0
- package/dist/http/routes/postDomTree.js +41 -0
- package/dist/http/routes/postDomTree.js.map +1 -0
- package/dist/http/routes/postEmulation.d.ts +3 -0
- package/dist/http/routes/postEmulation.d.ts.map +1 -0
- package/dist/http/routes/postEmulation.js +70 -0
- package/dist/http/routes/postEmulation.js.map +1 -0
- package/dist/http/routes/postEval.d.ts +3 -0
- package/dist/http/routes/postEval.d.ts.map +1 -0
- package/dist/http/routes/postEval.js +27 -0
- package/dist/http/routes/postEval.js.map +1 -0
- package/dist/http/routes/postReload.d.ts +3 -0
- package/dist/http/routes/postReload.d.ts.map +1 -0
- package/dist/http/routes/postReload.js +20 -0
- package/dist/http/routes/postReload.js.map +1 -0
- package/dist/http/routes/postScreenshot.d.ts +3 -0
- package/dist/http/routes/postScreenshot.d.ts.map +1 -0
- package/dist/http/routes/postScreenshot.js +17 -0
- package/dist/http/routes/postScreenshot.js.map +1 -0
- package/dist/http/routes/postShutdown.d.ts +3 -0
- package/dist/http/routes/postShutdown.d.ts.map +1 -0
- package/dist/http/routes/postShutdown.js +13 -0
- package/dist/http/routes/postShutdown.js.map +1 -0
- package/dist/http/routes/postSnapshot.d.ts +3 -0
- package/dist/http/routes/postSnapshot.d.ts.map +1 -0
- package/dist/http/routes/postSnapshot.js +28 -0
- package/dist/http/routes/postSnapshot.js.map +1 -0
- package/dist/http/routes/postStorageLocal.d.ts +3 -0
- package/dist/http/routes/postStorageLocal.d.ts.map +1 -0
- package/dist/http/routes/postStorageLocal.js +31 -0
- package/dist/http/routes/postStorageLocal.js.map +1 -0
- package/dist/http/routes/postThrottle.d.ts +3 -0
- package/dist/http/routes/postThrottle.d.ts.map +1 -0
- package/dist/http/routes/postThrottle.js +38 -0
- package/dist/http/routes/postThrottle.js.map +1 -0
- package/dist/http/routes/postTraceStart.d.ts +3 -0
- package/dist/http/routes/postTraceStart.d.ts.map +1 -0
- package/dist/http/routes/postTraceStart.js +17 -0
- package/dist/http/routes/postTraceStart.js.map +1 -0
- package/dist/http/routes/postTraceStop.d.ts +3 -0
- package/dist/http/routes/postTraceStop.d.ts.map +1 -0
- package/dist/http/routes/postTraceStop.js +17 -0
- package/dist/http/routes/postTraceStop.js.map +1 -0
- package/dist/http/routes/types.d.ts +9 -0
- package/dist/http/routes/types.d.ts.map +1 -0
- package/dist/http/routes/types.js +10 -0
- package/dist/http/routes/types.js.map +1 -0
- package/dist/http/server.d.ts +42 -1
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +3 -82
- package/dist/http/server.js.map +1 -1
- package/dist/index.d.ts +117 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +349 -44
- package/dist/index.js.map +1 -1
- package/dist/native-messaging/messaging.d.ts +18 -0
- package/dist/native-messaging/messaging.d.ts.map +1 -0
- package/dist/native-messaging/messaging.js +94 -0
- package/dist/native-messaging/messaging.js.map +1 -0
- package/dist/native-messaging/session-manager.d.ts +108 -0
- package/dist/native-messaging/session-manager.d.ts.map +1 -0
- package/dist/native-messaging/session-manager.js +267 -0
- package/dist/native-messaging/session-manager.js.map +1 -0
- package/dist/native-messaging/types.d.ts +112 -0
- package/dist/native-messaging/types.d.ts.map +1 -0
- package/dist/native-messaging/types.js +6 -0
- package/dist/native-messaging/types.js.map +1 -0
- package/dist/registry/registry.d.ts +9 -2
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +53 -9
- package/dist/registry/registry.js.map +1 -1
- package/dist/scripts/install-host.d.ts +10 -0
- package/dist/scripts/install-host.d.ts.map +1 -0
- package/dist/scripts/install-host.js +189 -0
- package/dist/scripts/install-host.js.map +1 -0
- package/dist/sources/cdp-source.d.ts +24 -0
- package/dist/sources/cdp-source.d.ts.map +1 -0
- package/dist/sources/cdp-source.js +49 -0
- package/dist/sources/cdp-source.js.map +1 -0
- package/dist/sources/extension-frame-state.d.ts +64 -0
- package/dist/sources/extension-frame-state.d.ts.map +1 -0
- package/dist/sources/extension-frame-state.js +117 -0
- package/dist/sources/extension-frame-state.js.map +1 -0
- package/dist/sources/extension-log-events.d.ts +15 -0
- package/dist/sources/extension-log-events.d.ts.map +1 -0
- package/dist/sources/extension-log-events.js +101 -0
- package/dist/sources/extension-log-events.js.map +1 -0
- package/dist/sources/extension-source.d.ts +15 -0
- package/dist/sources/extension-source.d.ts.map +1 -0
- package/dist/sources/extension-source.js +487 -0
- package/dist/sources/extension-source.js.map +1 -0
- package/dist/sources/types.d.ts +109 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +7 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/throttle/ThrottleController.d.ts +12 -0
- package/dist/throttle/ThrottleController.d.ts.map +1 -0
- package/dist/throttle/ThrottleController.js +67 -0
- package/dist/throttle/ThrottleController.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NetBuffer } from '../buffer/NetBuffer.js';
|
|
2
|
+
import type { CdpSessionHandle } from './connection.js';
|
|
3
|
+
export type NetworkCaptureHandle = {
|
|
4
|
+
onAttached: () => Promise<void>;
|
|
5
|
+
onDetached: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const createNetworkCapture: (options: {
|
|
8
|
+
session: CdpSessionHandle;
|
|
9
|
+
buffer: NetBuffer;
|
|
10
|
+
}) => NetworkCaptureHandle;
|
|
11
|
+
//# sourceMappingURL=networkCapture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkCapture.d.ts","sourceRoot":"","sources":["../../src/cdp/networkCapture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAevD,MAAM,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/B,UAAU,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS;IAAE,OAAO,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,KAAG,oBAoHhG,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { redactUrl } from './redaction.js';
|
|
2
|
+
export const createNetworkCapture = (options) => {
|
|
3
|
+
const inflight = new Map();
|
|
4
|
+
const getOrCreate = (requestId) => {
|
|
5
|
+
const existing = inflight.get(requestId);
|
|
6
|
+
if (existing) {
|
|
7
|
+
return existing;
|
|
8
|
+
}
|
|
9
|
+
const next = {
|
|
10
|
+
requestId,
|
|
11
|
+
url: '',
|
|
12
|
+
method: 'GET',
|
|
13
|
+
resourceType: null,
|
|
14
|
+
status: null,
|
|
15
|
+
encodedDataLength: null,
|
|
16
|
+
errorText: null,
|
|
17
|
+
startTime: null,
|
|
18
|
+
endTime: null,
|
|
19
|
+
};
|
|
20
|
+
inflight.set(requestId, next);
|
|
21
|
+
return next;
|
|
22
|
+
};
|
|
23
|
+
const finalize = (requestId) => {
|
|
24
|
+
const record = inflight.get(requestId);
|
|
25
|
+
if (!record) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
inflight.delete(requestId);
|
|
29
|
+
const durationMs = record.startTime != null && record.endTime != null
|
|
30
|
+
? Math.max(0, Math.round((record.endTime - record.startTime) * 1000))
|
|
31
|
+
: null;
|
|
32
|
+
const summary = {
|
|
33
|
+
ts: Date.now(),
|
|
34
|
+
requestId: record.requestId,
|
|
35
|
+
url: redactUrl(record.url),
|
|
36
|
+
method: record.method,
|
|
37
|
+
resourceType: record.resourceType,
|
|
38
|
+
status: record.status,
|
|
39
|
+
encodedDataLength: record.encodedDataLength,
|
|
40
|
+
errorText: record.errorText,
|
|
41
|
+
durationMs,
|
|
42
|
+
};
|
|
43
|
+
options.buffer.add(summary);
|
|
44
|
+
};
|
|
45
|
+
options.session.onEvent('Network.requestWillBeSent', (params) => {
|
|
46
|
+
const payload = params;
|
|
47
|
+
const requestId = payload.requestId;
|
|
48
|
+
if (!requestId) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const entry = getOrCreate(requestId);
|
|
52
|
+
entry.url = payload.request?.url ?? entry.url;
|
|
53
|
+
entry.method = payload.request?.method ?? entry.method;
|
|
54
|
+
entry.resourceType = payload.type ?? entry.resourceType;
|
|
55
|
+
entry.startTime = typeof payload.timestamp === 'number' ? payload.timestamp : entry.startTime;
|
|
56
|
+
});
|
|
57
|
+
options.session.onEvent('Network.responseReceived', (params) => {
|
|
58
|
+
const payload = params;
|
|
59
|
+
const requestId = payload.requestId;
|
|
60
|
+
if (!requestId) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const entry = getOrCreate(requestId);
|
|
64
|
+
entry.status = typeof payload.response?.status === 'number' ? payload.response.status : entry.status;
|
|
65
|
+
entry.resourceType = payload.type ?? entry.resourceType;
|
|
66
|
+
});
|
|
67
|
+
options.session.onEvent('Network.loadingFinished', (params) => {
|
|
68
|
+
const payload = params;
|
|
69
|
+
const requestId = payload.requestId;
|
|
70
|
+
if (!requestId) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const entry = getOrCreate(requestId);
|
|
74
|
+
entry.encodedDataLength =
|
|
75
|
+
typeof payload.encodedDataLength === 'number' ? payload.encodedDataLength : entry.encodedDataLength;
|
|
76
|
+
entry.endTime = typeof payload.timestamp === 'number' ? payload.timestamp : entry.endTime;
|
|
77
|
+
finalize(requestId);
|
|
78
|
+
});
|
|
79
|
+
options.session.onEvent('Network.loadingFailed', (params) => {
|
|
80
|
+
const payload = params;
|
|
81
|
+
const requestId = payload.requestId;
|
|
82
|
+
if (!requestId) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const entry = getOrCreate(requestId);
|
|
86
|
+
entry.errorText = payload.errorText ?? entry.errorText;
|
|
87
|
+
entry.endTime = typeof payload.timestamp === 'number' ? payload.timestamp : entry.endTime;
|
|
88
|
+
finalize(requestId);
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
onAttached: async () => {
|
|
92
|
+
await options.session.sendAndWait('Network.enable');
|
|
93
|
+
},
|
|
94
|
+
onDetached: () => {
|
|
95
|
+
inflight.clear();
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=networkCapture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkCapture.js","sourceRoot":"","sources":["../../src/cdp/networkCapture.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAmB1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAyD,EAAwB,EAAE;IACvH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAA;IAEnD,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAmB,EAAE;QAC1D,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QACxC,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,QAAQ,CAAA;QAChB,CAAC;QACD,MAAM,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C,SAAS,CAAC,CAAA;IACpB,CAAC,CAAC,CAAA;IAEF,OAAO;QACN,UAAU,EAAE,KAAK,IAAI,EAAE;YACtB,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAA;QACpD,CAAC;QACD,UAAU,EAAE,GAAG,EAAE;YAChB,QAAQ,CAAC,KAAK,EAAE,CAAA;QACjB,CAAC;KACD,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CdpSessionHandle } from './connection.js';
|
|
2
|
+
import type { CdpTarget } from './watcher.js';
|
|
3
|
+
export type PageIndicatorPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left-center' | 'right-center';
|
|
4
|
+
export type PageIndicatorOptions = {
|
|
5
|
+
/** Whether the in-page indicator is enabled. */
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/** The predefined position of the indicator on the page. */
|
|
8
|
+
position?: PageIndicatorPosition;
|
|
9
|
+
/** The interval in milliseconds at which the watcher sends a heartbeat to keep the indicator alive. */
|
|
10
|
+
heartbeatMs?: number;
|
|
11
|
+
/** The time-to-live in milliseconds for the indicator. If no heartbeat is received within this time, the indicator is removed from the page. */
|
|
12
|
+
ttlMs?: number;
|
|
13
|
+
/** Background color for the indicator badge. Defaults to 'rgba(0, 0, 0, 0.75)'. */
|
|
14
|
+
bgColor?: string;
|
|
15
|
+
/** Icon color for the indicator badge. Defaults to 'rgba(255, 255, 255, 0.95)'. */
|
|
16
|
+
iconColor?: string;
|
|
17
|
+
/** Margin from the edge in pixels. Defaults to 8. */
|
|
18
|
+
margin?: number;
|
|
19
|
+
/** Icon size in pixels. Defaults to 19. */
|
|
20
|
+
size?: number;
|
|
21
|
+
};
|
|
22
|
+
export type PageIndicatorInfo = {
|
|
23
|
+
watcherId: string;
|
|
24
|
+
watcherHost: string;
|
|
25
|
+
watcherPort: number;
|
|
26
|
+
watcherPid: number;
|
|
27
|
+
targetTitle: string | null;
|
|
28
|
+
targetUrl: string | null;
|
|
29
|
+
attachedAt: number;
|
|
30
|
+
};
|
|
31
|
+
export type PageIndicatorController = {
|
|
32
|
+
onAttach: (session: CdpSessionHandle, target: CdpTarget, info: PageIndicatorInfo) => void;
|
|
33
|
+
onNavigation: (session: CdpSessionHandle, info: PageIndicatorInfo) => void;
|
|
34
|
+
/** Re-inject the indicator using the last known info. Use after DOM is rebuilt (e.g. domContentEventFired). */
|
|
35
|
+
reinstall: () => void;
|
|
36
|
+
onDetach: () => void;
|
|
37
|
+
stop: () => void;
|
|
38
|
+
};
|
|
39
|
+
export declare const validatePageIndicatorOptions: (options: PageIndicatorOptions | undefined) => void;
|
|
40
|
+
export declare const createPageIndicatorController: (options: PageIndicatorOptions) => PageIndicatorController;
|
|
41
|
+
//# sourceMappingURL=pageIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageIndicator.d.ts","sourceRoot":"","sources":["../../src/cdp/pageIndicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,MAAM,qBAAqB,GAC9B,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,GACd,aAAa,GACb,cAAc,CAAA;AAEjB,MAAM,MAAM,oBAAoB,GAAG;IAClC,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAChC,uGAAuG;IACvG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gJAAgJ;IAChJ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACzF,YAAY,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAC1E,+GAA+G;IAC/G,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,IAAI,EAAE,MAAM,IAAI,CAAA;CAChB,CAAA;AAOD,eAAO,MAAM,4BAA4B,GAAI,SAAS,oBAAoB,GAAG,SAAS,KAAG,IAgBxF,CAAA;AAOD,eAAO,MAAM,6BAA6B,GAAI,SAAS,oBAAoB,KAAG,uBAsF7E,CAAA"}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
const BOT_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>`;
|
|
2
|
+
const MIN_HEARTBEAT_MS = 500;
|
|
3
|
+
const MIN_TTL_MS = 2000;
|
|
4
|
+
export const validatePageIndicatorOptions = (options) => {
|
|
5
|
+
if (!options) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (options.heartbeatMs !== undefined) {
|
|
9
|
+
if (!Number.isInteger(options.heartbeatMs) || options.heartbeatMs < MIN_HEARTBEAT_MS) {
|
|
10
|
+
throw new Error(`pageIndicator.heartbeatMs must be an integer >= ${MIN_HEARTBEAT_MS}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (options.ttlMs !== undefined) {
|
|
14
|
+
if (!Number.isInteger(options.ttlMs) || options.ttlMs < MIN_TTL_MS) {
|
|
15
|
+
throw new Error(`pageIndicator.ttlMs must be an integer >= ${MIN_TTL_MS}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const DEFAULT_BG_COLOR = 'rgba(0, 0, 0, 0.75)';
|
|
20
|
+
const DEFAULT_HOVER_BG_COLOR = 'rgba(0, 0, 0, 0.9)';
|
|
21
|
+
const DEFAULT_ICON_COLOR = 'rgba(255, 255, 255, 0.95)';
|
|
22
|
+
const DEFAULT_MARGIN = 8;
|
|
23
|
+
const DEFAULT_SIZE = 19;
|
|
24
|
+
export const createPageIndicatorController = (options) => {
|
|
25
|
+
const position = options.position ?? 'bottom-right';
|
|
26
|
+
const heartbeatMs = options.heartbeatMs ?? 2000;
|
|
27
|
+
const ttlMs = options.ttlMs ?? 6000;
|
|
28
|
+
const bgColor = options.bgColor ?? DEFAULT_BG_COLOR;
|
|
29
|
+
const hoverBgColor = DEFAULT_HOVER_BG_COLOR;
|
|
30
|
+
const iconColor = options.iconColor ?? DEFAULT_ICON_COLOR;
|
|
31
|
+
const margin = options.margin ?? DEFAULT_MARGIN;
|
|
32
|
+
const size = options.size ?? DEFAULT_SIZE;
|
|
33
|
+
let heartbeatTimer = null;
|
|
34
|
+
let currentSession = null;
|
|
35
|
+
let currentInfo = null;
|
|
36
|
+
const onAttach = (session, _target, info) => {
|
|
37
|
+
stop();
|
|
38
|
+
currentSession = session;
|
|
39
|
+
currentInfo = info;
|
|
40
|
+
void installIndicator(session, {
|
|
41
|
+
info,
|
|
42
|
+
position,
|
|
43
|
+
ttlMs,
|
|
44
|
+
bgColor,
|
|
45
|
+
hoverBgColor,
|
|
46
|
+
iconColor,
|
|
47
|
+
margin,
|
|
48
|
+
size,
|
|
49
|
+
});
|
|
50
|
+
heartbeatTimer = setInterval(() => {
|
|
51
|
+
if (!currentSession || !currentInfo) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
void sendHeartbeat(currentSession, currentInfo);
|
|
55
|
+
}, heartbeatMs);
|
|
56
|
+
};
|
|
57
|
+
const onNavigation = (session, info) => {
|
|
58
|
+
currentInfo = info;
|
|
59
|
+
void installIndicator(session, {
|
|
60
|
+
info,
|
|
61
|
+
position,
|
|
62
|
+
ttlMs,
|
|
63
|
+
bgColor,
|
|
64
|
+
hoverBgColor,
|
|
65
|
+
iconColor,
|
|
66
|
+
margin,
|
|
67
|
+
size,
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const reinstall = () => {
|
|
71
|
+
if (!currentSession || !currentInfo) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
void installIndicator(currentSession, {
|
|
75
|
+
info: currentInfo,
|
|
76
|
+
position,
|
|
77
|
+
ttlMs,
|
|
78
|
+
bgColor,
|
|
79
|
+
hoverBgColor,
|
|
80
|
+
iconColor,
|
|
81
|
+
margin,
|
|
82
|
+
size,
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const onDetach = () => {
|
|
86
|
+
if (heartbeatTimer) {
|
|
87
|
+
clearInterval(heartbeatTimer);
|
|
88
|
+
heartbeatTimer = null;
|
|
89
|
+
}
|
|
90
|
+
if (currentSession) {
|
|
91
|
+
void removeIndicator(currentSession).catch(() => { });
|
|
92
|
+
}
|
|
93
|
+
currentSession = null;
|
|
94
|
+
currentInfo = null;
|
|
95
|
+
};
|
|
96
|
+
const stop = () => {
|
|
97
|
+
onDetach();
|
|
98
|
+
};
|
|
99
|
+
return { onAttach, onNavigation, reinstall, onDetach, stop };
|
|
100
|
+
};
|
|
101
|
+
const installIndicator = async (session, params) => {
|
|
102
|
+
const { info, position, ttlMs, bgColor, hoverBgColor, iconColor, margin, size } = params;
|
|
103
|
+
const expression = buildInstallExpression({
|
|
104
|
+
info,
|
|
105
|
+
position,
|
|
106
|
+
ttlMs,
|
|
107
|
+
bgColor,
|
|
108
|
+
hoverBgColor,
|
|
109
|
+
iconColor,
|
|
110
|
+
margin,
|
|
111
|
+
size,
|
|
112
|
+
});
|
|
113
|
+
try {
|
|
114
|
+
await session.sendAndWait('Runtime.evaluate', {
|
|
115
|
+
expression,
|
|
116
|
+
returnByValue: true,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Best-effort; page may not be ready
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const sendHeartbeat = async (session, info) => {
|
|
124
|
+
const expression = buildHeartbeatExpression(info);
|
|
125
|
+
try {
|
|
126
|
+
await session.sendAndWait('Runtime.evaluate', {
|
|
127
|
+
expression,
|
|
128
|
+
returnByValue: true,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Best-effort; CDP may be disconnected
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const removeIndicator = async (session) => {
|
|
136
|
+
const expression = buildRemoveExpression();
|
|
137
|
+
try {
|
|
138
|
+
await session.sendAndWait('Runtime.evaluate', {
|
|
139
|
+
expression,
|
|
140
|
+
returnByValue: true,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// Best-effort; CDP may be unavailable
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const buildInstallExpression = (params) => {
|
|
148
|
+
const { info, position, ttlMs, bgColor, hoverBgColor, iconColor, margin, size } = params;
|
|
149
|
+
const infoJson = JSON.stringify(info);
|
|
150
|
+
const svgWithSize = BOT_SVG.replace(/width="19"/, `width="${size}"`).replace(/height="19"/, `height="${size}"`);
|
|
151
|
+
const svgEscaped = svgWithSize.replace(/'/g, "\\'");
|
|
152
|
+
const positionStyles = {
|
|
153
|
+
'top-left': `top: ${margin}px; left: ${margin}px;`,
|
|
154
|
+
'top-center': `top: ${margin}px; left: 50%; transform: translateX(-50%);`,
|
|
155
|
+
'top-right': `top: ${margin}px; right: ${margin}px;`,
|
|
156
|
+
'bottom-left': `bottom: ${margin}px; left: ${margin}px;`,
|
|
157
|
+
'bottom-center': `bottom: ${margin}px; left: 50%; transform: translateX(-50%);`,
|
|
158
|
+
'bottom-right': `bottom: ${margin}px; right: ${margin}px;`,
|
|
159
|
+
'left-center': `top: 50%; left: ${margin}px; transform: translateY(-50%);`,
|
|
160
|
+
'right-center': `top: 50%; right: ${margin}px; transform: translateY(-50%);`,
|
|
161
|
+
};
|
|
162
|
+
const posStyle = positionStyles[position];
|
|
163
|
+
const tooltipText = `Argus Watcher: ${info.watcherId}`;
|
|
164
|
+
return `
|
|
165
|
+
(function() {
|
|
166
|
+
var INDICATOR_ID = 'argus-watcher-indicator';
|
|
167
|
+
var STYLE_ID = 'argus-watcher-indicator-style';
|
|
168
|
+
var DIALOG_ID = 'argus-watcher-indicator-dialog';
|
|
169
|
+
var STATE_KEY = '__ARGUS_WATCHER_INDICATOR__';
|
|
170
|
+
var info = ${infoJson};
|
|
171
|
+
var ttlMs = ${ttlMs};
|
|
172
|
+
var svg = '${svgEscaped}';
|
|
173
|
+
|
|
174
|
+
var existing = document.getElementById(INDICATOR_ID);
|
|
175
|
+
if (existing) {
|
|
176
|
+
existing.remove();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (window[STATE_KEY] && window[STATE_KEY].timerId) {
|
|
180
|
+
clearInterval(window[STATE_KEY].timerId);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Inject styles for hover effects and dialog
|
|
184
|
+
var existingStyle = document.getElementById(STYLE_ID);
|
|
185
|
+
if (existingStyle) {
|
|
186
|
+
existingStyle.remove();
|
|
187
|
+
}
|
|
188
|
+
var style = document.createElement('style');
|
|
189
|
+
style.id = STYLE_ID;
|
|
190
|
+
style.textContent =
|
|
191
|
+
'#' + INDICATOR_ID + ' {' +
|
|
192
|
+
'transition: filter 0.15s ease, background 0.15s ease;' +
|
|
193
|
+
'}' +
|
|
194
|
+
'#' + INDICATOR_ID + ':hover {' +
|
|
195
|
+
'filter: brightness(1.4);' +
|
|
196
|
+
'background: ${hoverBgColor} !important;' +
|
|
197
|
+
'}' +
|
|
198
|
+
'#' + DIALOG_ID + '::backdrop {' +
|
|
199
|
+
'background: rgba(0, 0, 0, 0.5);' +
|
|
200
|
+
'}' +
|
|
201
|
+
'#' + DIALOG_ID + ' {' +
|
|
202
|
+
'border: 1px solid rgba(255, 255, 255, 0.15);' +
|
|
203
|
+
'border-radius: 10px;' +
|
|
204
|
+
'background: #1a1a1a;' +
|
|
205
|
+
'color: #e0e0e0;' +
|
|
206
|
+
'padding: 0;' +
|
|
207
|
+
'min-width: 320px;' +
|
|
208
|
+
'max-width: 480px;' +
|
|
209
|
+
'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;' +
|
|
210
|
+
'font-size: 13px;' +
|
|
211
|
+
'box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);' +
|
|
212
|
+
'}' +
|
|
213
|
+
'#' + DIALOG_ID + ' .argus-dialog-header {' +
|
|
214
|
+
'padding: 14px 18px 10px;' +
|
|
215
|
+
'font-size: 14px;' +
|
|
216
|
+
'font-weight: 600;' +
|
|
217
|
+
'color: #fff;' +
|
|
218
|
+
'border-bottom: 1px solid rgba(255, 255, 255, 0.1);' +
|
|
219
|
+
'}' +
|
|
220
|
+
'#' + DIALOG_ID + ' .argus-dialog-body {' +
|
|
221
|
+
'padding: 12px 18px;' +
|
|
222
|
+
'}' +
|
|
223
|
+
'#' + DIALOG_ID + ' .argus-dialog-row {' +
|
|
224
|
+
'display: flex;' +
|
|
225
|
+
'padding: 4px 0;' +
|
|
226
|
+
'gap: 12px;' +
|
|
227
|
+
'}' +
|
|
228
|
+
'#' + DIALOG_ID + ' .argus-dialog-label {' +
|
|
229
|
+
'flex-shrink: 0;' +
|
|
230
|
+
'width: 70px;' +
|
|
231
|
+
'color: rgba(255, 255, 255, 0.5);' +
|
|
232
|
+
'font-size: 12px;' +
|
|
233
|
+
'text-transform: uppercase;' +
|
|
234
|
+
'letter-spacing: 0.5px;' +
|
|
235
|
+
'padding-top: 1px;' +
|
|
236
|
+
'}' +
|
|
237
|
+
'#' + DIALOG_ID + ' .argus-dialog-value {' +
|
|
238
|
+
'color: #e0e0e0;' +
|
|
239
|
+
'word-break: break-all;' +
|
|
240
|
+
'}' +
|
|
241
|
+
'#' + DIALOG_ID + ' .argus-dialog-footer {' +
|
|
242
|
+
'display: flex;' +
|
|
243
|
+
'justify-content: flex-end;' +
|
|
244
|
+
'gap: 8px;' +
|
|
245
|
+
'padding: 10px 18px 14px;' +
|
|
246
|
+
'border-top: 1px solid rgba(255, 255, 255, 0.1);' +
|
|
247
|
+
'}' +
|
|
248
|
+
'#' + DIALOG_ID + ' button {' +
|
|
249
|
+
'border: 1px solid rgba(255, 255, 255, 0.2);' +
|
|
250
|
+
'border-radius: 6px;' +
|
|
251
|
+
'padding: 6px 16px;' +
|
|
252
|
+
'font-size: 13px;' +
|
|
253
|
+
'cursor: pointer;' +
|
|
254
|
+
'background: rgba(255, 255, 255, 0.08);' +
|
|
255
|
+
'color: #e0e0e0;' +
|
|
256
|
+
'}' +
|
|
257
|
+
'#' + DIALOG_ID + ' button:hover {' +
|
|
258
|
+
'background: rgba(255, 255, 255, 0.15);' +
|
|
259
|
+
'}';
|
|
260
|
+
document.documentElement.appendChild(style);
|
|
261
|
+
|
|
262
|
+
var el = document.createElement('div');
|
|
263
|
+
el.id = INDICATOR_ID;
|
|
264
|
+
el.setAttribute('data-testid', INDICATOR_ID);
|
|
265
|
+
el.setAttribute('title', '${tooltipText}');
|
|
266
|
+
el.style.cssText = 'position: fixed; ${posStyle} z-index: 2147483647; ' +
|
|
267
|
+
'background: ${bgColor}; color: ${iconColor}; ' +
|
|
268
|
+
'padding: 6px; border-radius: 6px; ' +
|
|
269
|
+
'cursor: pointer; display: flex; align-items: center; justify-content: center; ' +
|
|
270
|
+
'user-select: none; pointer-events: auto;';
|
|
271
|
+
el.innerHTML = svg;
|
|
272
|
+
|
|
273
|
+
el.addEventListener('click', function() {
|
|
274
|
+
var state = window[STATE_KEY];
|
|
275
|
+
var i = state ? state.info : info;
|
|
276
|
+
var attachedDate = new Date(i.attachedAt).toISOString();
|
|
277
|
+
var fields = [
|
|
278
|
+
['ID', i.watcherId],
|
|
279
|
+
['Host', i.watcherHost + ':' + i.watcherPort],
|
|
280
|
+
['PID', String(i.watcherPid)],
|
|
281
|
+
['Target', i.targetTitle || '(no title)'],
|
|
282
|
+
['URL', i.targetUrl || '(no url)'],
|
|
283
|
+
['Attached', attachedDate]
|
|
284
|
+
];
|
|
285
|
+
|
|
286
|
+
var dialog = document.getElementById(DIALOG_ID);
|
|
287
|
+
if (!dialog) {
|
|
288
|
+
dialog = document.createElement('dialog');
|
|
289
|
+
dialog.id = DIALOG_ID;
|
|
290
|
+
dialog.addEventListener('click', function(e) {
|
|
291
|
+
if (e.target === dialog) {
|
|
292
|
+
dialog.close();
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
document.documentElement.appendChild(dialog);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
var html = '<div class="argus-dialog-header">Argus Watcher</div>' +
|
|
299
|
+
'<div class="argus-dialog-body">';
|
|
300
|
+
for (var f = 0; f < fields.length; f++) {
|
|
301
|
+
html += '<div class="argus-dialog-row">' +
|
|
302
|
+
'<span class="argus-dialog-label">' + fields[f][0] + '</span>' +
|
|
303
|
+
'<span class="argus-dialog-value">' + fields[f][1] + '</span>' +
|
|
304
|
+
'</div>';
|
|
305
|
+
}
|
|
306
|
+
html += '</div>' +
|
|
307
|
+
'<div class="argus-dialog-footer">' +
|
|
308
|
+
'<button data-action="copy" type="button">Copy</button>' +
|
|
309
|
+
'<button data-action="close" type="button">Close</button>' +
|
|
310
|
+
'</div>';
|
|
311
|
+
dialog.innerHTML = html;
|
|
312
|
+
|
|
313
|
+
dialog.querySelector('[data-action="copy"]').addEventListener('click', function() {
|
|
314
|
+
var text = 'Argus Watcher Info\\n';
|
|
315
|
+
for (var c = 0; c < fields.length; c++) {
|
|
316
|
+
text += fields[c][0] + ': ' + fields[c][1] + '\\n';
|
|
317
|
+
}
|
|
318
|
+
navigator.clipboard.writeText(text.trim()).then(function() {
|
|
319
|
+
var btn = dialog.querySelector('[data-action="copy"]');
|
|
320
|
+
if (btn) {
|
|
321
|
+
btn.textContent = 'Copied!';
|
|
322
|
+
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
dialog.querySelector('[data-action="close"]').addEventListener('click', function() {
|
|
328
|
+
dialog.close();
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
dialog.showModal();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
document.documentElement.appendChild(el);
|
|
335
|
+
|
|
336
|
+
var timerId = setInterval(function() {
|
|
337
|
+
var state = window[STATE_KEY];
|
|
338
|
+
if (!state) {
|
|
339
|
+
clearInterval(timerId);
|
|
340
|
+
var indicator = document.getElementById(INDICATOR_ID);
|
|
341
|
+
if (indicator) indicator.remove();
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (Date.now() - state.lastSeenMs > state.ttlMs) {
|
|
345
|
+
clearInterval(state.timerId);
|
|
346
|
+
var indicator = document.getElementById(INDICATOR_ID);
|
|
347
|
+
if (indicator) indicator.remove();
|
|
348
|
+
delete window[STATE_KEY];
|
|
349
|
+
}
|
|
350
|
+
}, 1000);
|
|
351
|
+
|
|
352
|
+
window[STATE_KEY] = {
|
|
353
|
+
lastSeenMs: Date.now(),
|
|
354
|
+
ttlMs: ttlMs,
|
|
355
|
+
timerId: timerId,
|
|
356
|
+
info: info
|
|
357
|
+
};
|
|
358
|
+
})();
|
|
359
|
+
`;
|
|
360
|
+
};
|
|
361
|
+
const buildHeartbeatExpression = (info) => {
|
|
362
|
+
const infoJson = JSON.stringify(info);
|
|
363
|
+
return `
|
|
364
|
+
(function() {
|
|
365
|
+
var STATE_KEY = '__ARGUS_WATCHER_INDICATOR__';
|
|
366
|
+
var state = window[STATE_KEY];
|
|
367
|
+
if (state) {
|
|
368
|
+
state.lastSeenMs = Date.now();
|
|
369
|
+
state.info = ${infoJson};
|
|
370
|
+
}
|
|
371
|
+
})();
|
|
372
|
+
`;
|
|
373
|
+
};
|
|
374
|
+
const buildRemoveExpression = () => {
|
|
375
|
+
return `
|
|
376
|
+
(function() {
|
|
377
|
+
var INDICATOR_ID = 'argus-watcher-indicator';
|
|
378
|
+
var STYLE_ID = 'argus-watcher-indicator-style';
|
|
379
|
+
var DIALOG_ID = 'argus-watcher-indicator-dialog';
|
|
380
|
+
var STATE_KEY = '__ARGUS_WATCHER_INDICATOR__';
|
|
381
|
+
var state = window[STATE_KEY];
|
|
382
|
+
if (state && state.timerId) {
|
|
383
|
+
clearInterval(state.timerId);
|
|
384
|
+
}
|
|
385
|
+
delete window[STATE_KEY];
|
|
386
|
+
var el = document.getElementById(INDICATOR_ID);
|
|
387
|
+
if (el) el.remove();
|
|
388
|
+
var styleEl = document.getElementById(STYLE_ID);
|
|
389
|
+
if (styleEl) styleEl.remove();
|
|
390
|
+
var dialogEl = document.getElementById(DIALOG_ID);
|
|
391
|
+
if (dialogEl) dialogEl.remove();
|
|
392
|
+
})();
|
|
393
|
+
`;
|
|
394
|
+
};
|
|
395
|
+
//# sourceMappingURL=pageIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageIndic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ts","sourceRoot":"","sources":["../../src/cdp/redaction.ts"],"names":[],"mappings":"AAEA,qDAAqD;AACrD,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,MAmCzC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const SENSITIVE_KEYS = new Set(['token', 'access_token', 'auth', 'authorization', 'code', 'password', 'pass']);
|
|
2
|
+
/** Redact URL query values while preserving keys. */
|
|
3
|
+
export const redactUrl = (value) => {
|
|
4
|
+
if (!value) {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
let url;
|
|
8
|
+
try {
|
|
9
|
+
url = new URL(value);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
if (!url.search) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
const params = new URLSearchParams(url.search);
|
|
18
|
+
const redacted = new URLSearchParams();
|
|
19
|
+
for (const [key, val] of params.entries()) {
|
|
20
|
+
const trimmedKey = key.trim();
|
|
21
|
+
if (!trimmedKey) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const lowerKey = trimmedKey.toLowerCase();
|
|
25
|
+
if (SENSITIVE_KEYS.has(lowerKey) && val.trim()) {
|
|
26
|
+
redacted.append(trimmedKey, 'redacted');
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
redacted.append(trimmedKey, '');
|
|
30
|
+
}
|
|
31
|
+
const search = redacted.toString();
|
|
32
|
+
url.search = search ? `?${search}` : '';
|
|
33
|
+
return url.toString();
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=redaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redaction.js","sourceRoot":"","sources":["../../src/cdp/redaction.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,M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OAAO,GAAG,CAAC,QAAQ,EAAE,CAAA;AACtB,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type CdpRuntimeClient = {
|
|
2
|
+
sendAndWait: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
3
|
+
};
|
|
4
|
+
export declare const serializeRemoteObjects: (values: unknown[], cdp?: CdpRuntimeClient) => Promise<unknown[]>;
|
|
5
|
+
export declare const serializeRemoteObject: (value: unknown, cdp?: CdpRuntimeClient) => Promise<unknown>;
|
|
6
|
+
//# sourceMappingURL=remoteObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteObject.d.ts","sourceRoot":"","sources":["../../src/cdp/remoteObject.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CACnF,CAAA;AAYD,eAAO,MAAM,sBAAsB,GAAU,QAAQ,OAAO,EAAE,EAAE,MAAM,gBAAgB,KAAG,OAAO,CAAC,OAAO,EAAE,CAKzG,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAU,OAAO,OAAO,EAAE,MAAM,gBAAgB,KAAG,OAAO,CAAC,OAAO,CA+BnG,CAAA"}
|