-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcapture-sync-data.ts
More file actions
51 lines (42 loc) · 1.65 KB
/
capture-sync-data.ts
File metadata and controls
51 lines (42 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { connectToSuperhuman, disconnect } from "./src/superhuman-api";
async function main() {
const conn = await connectToSuperhuman(9333);
if (!conn) { console.log("No connection"); process.exit(1); }
// Enable network monitoring with response bodies
await conn.Network.enable({});
const syncResponses: any[] = [];
// Capture response bodies for sync endpoints
conn.Network.responseReceived(async (params) => {
const url = params.response.url;
if (url.includes("userdata") || url.includes("sync") || url.includes("snippet") || url.includes("settings")) {
try {
const body = await conn.Network.getResponseBody({ requestId: params.requestId });
syncResponses.push({
url,
status: params.response.status,
bodyPreview: body.body?.slice(0, 2000)
});
} catch (e) {
syncResponses.push({ url, error: "Could not get body" });
}
}
});
console.log("Monitoring for sync/userdata responses...");
console.log("Navigate to Settings > Snippets in Superhuman, or refresh the page.\n");
// Wait for user to trigger something
await new Promise(r => setTimeout(r, 10000));
console.log("\n=== Captured Sync Responses ===");
for (const resp of syncResponses) {
console.log("\nURL:", resp.url);
console.log("Status:", resp.status);
if (resp.bodyPreview) {
// Check if body contains snippet-related data
if (resp.bodyPreview.toLowerCase().includes("snippet")) {
console.log("*** CONTAINS SNIPPET DATA ***");
}
console.log("Body preview:", resp.bodyPreview.slice(0, 500));
}
}
await disconnect(conn);
}
main().catch(console.error);