-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcheck-drafts.ts
More file actions
34 lines (29 loc) · 911 Bytes
/
check-drafts.ts
File metadata and controls
34 lines (29 loc) · 911 Bytes
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
import { connectToSuperhuman, disconnect } from "./src/superhuman-api";
async function checkDraftKeys() {
const conn = await connectToSuperhuman(9333, true);
if (!conn) return;
const result = await conn.Runtime.evaluate({
expression: `
(() => {
const cfc = window.ViewState?._composeFormController;
if (!cfc) return { error: "CFC not found" };
const keys = Object.keys(cfc);
const details = {};
keys.forEach(k => {
const draft = cfc[k].state?.draft;
details[k] = {
id: draft?.id,
subject: draft?.subject,
to: draft?.to?.map(r => r.email),
bodyLen: draft?.body?.length
};
});
return { keys, details };
})()
`,
returnByValue: true
});
console.log(JSON.stringify(result.result.value, null, 2));
await disconnect(conn);
}
checkDraftKeys();