nothing-browser 0.1.3 → 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/package.json +14 -26
- package/piggy/cache/{memory.ts → memory.js} +5 -10
- package/piggy/captcha/{index.ts → index.js} +19 -28
- package/piggy/capture/index.js +40 -0
- package/piggy/client/{index.ts → index.js} +133 -154
- package/piggy/dialog/{index.ts → index.js} +15 -31
- package/piggy/export/index.js +105 -0
- package/piggy/expose/index.js +24 -0
- package/piggy/find/{index.ts → index.js} +24 -39
- package/piggy/http/{index.ts → index.js} +7 -16
- package/piggy/human/{index.ts → index.js} +18 -49
- package/piggy/iframe/index.js +56 -0
- package/piggy/interactions/{index.ts → index.js} +20 -23
- package/piggy/intercept/{scripts.ts → scripts.js} +4 -13
- package/piggy/launch/{detect.ts → detect.js} +4 -6
- package/piggy/launch/{spawn.ts → spawn.js} +17 -22
- package/piggy/media/{index.ts → index.js} +13 -11
- package/piggy/navigation/{index.ts → index.js} +16 -14
- package/piggy/pool/index.js +76 -0
- package/piggy/provide/index.js +97 -0
- package/piggy/proxy/index.js +95 -0
- package/piggy/register/index.js +543 -0
- package/piggy/router/index.js +44 -0
- package/piggy/server/{index.ts → index.js} +16 -64
- package/piggy/session/index.js +69 -0
- package/piggy/store/{index.ts → index.js} +22 -62
- package/piggy/tabs/index.js +24 -0
- package/piggy/wait/index.js +77 -0
- package/{piggy.ts → piggy.js} +122 -146
- package/dist/cache/memory.js +0 -35
- package/dist/client/index.js +0 -1284
- package/dist/human/index.js +0 -82
- package/dist/launch/detect.js +0 -782
- package/dist/launch/spawn.js +0 -915
- package/dist/logger/index.js +0 -733
- package/dist/piggy/cache/memory.d.ts +0 -7
- package/dist/piggy/cache/memory.d.ts.map +0 -1
- package/dist/piggy/captcha/index.d.ts +0 -39
- package/dist/piggy/captcha/index.d.ts.map +0 -1
- package/dist/piggy/capture/index.d.ts +0 -48
- package/dist/piggy/capture/index.d.ts.map +0 -1
- package/dist/piggy/client/index.d.ts +0 -146
- package/dist/piggy/client/index.d.ts.map +0 -1
- package/dist/piggy/dialog/index.d.ts +0 -28
- package/dist/piggy/dialog/index.d.ts.map +0 -1
- package/dist/piggy/export/index.d.ts +0 -62
- package/dist/piggy/export/index.d.ts.map +0 -1
- package/dist/piggy/expose/index.d.ts +0 -6
- package/dist/piggy/expose/index.d.ts.map +0 -1
- package/dist/piggy/find/index.d.ts +0 -52
- package/dist/piggy/find/index.d.ts.map +0 -1
- package/dist/piggy/http/index.d.ts +0 -14
- package/dist/piggy/http/index.d.ts.map +0 -1
- package/dist/piggy/human/index.d.ts +0 -39
- package/dist/piggy/human/index.d.ts.map +0 -1
- package/dist/piggy/iframe/index.d.ts +0 -53
- package/dist/piggy/iframe/index.d.ts.map +0 -1
- package/dist/piggy/interactions/index.d.ts +0 -24
- package/dist/piggy/interactions/index.d.ts.map +0 -1
- package/dist/piggy/intercept/scripts.d.ts +0 -13
- package/dist/piggy/intercept/scripts.d.ts.map +0 -1
- package/dist/piggy/launch/detect.d.ts +0 -3
- package/dist/piggy/launch/detect.d.ts.map +0 -1
- package/dist/piggy/launch/spawn.d.ts +0 -6
- package/dist/piggy/launch/spawn.d.ts.map +0 -1
- package/dist/piggy/logger/index.d.ts +0 -3
- package/dist/piggy/logger/index.d.ts.map +0 -1
- package/dist/piggy/media/index.d.ts +0 -11
- package/dist/piggy/media/index.d.ts.map +0 -1
- package/dist/piggy/navigation/index.d.ts +0 -16
- package/dist/piggy/navigation/index.d.ts.map +0 -1
- package/dist/piggy/pool/index.d.ts +0 -23
- package/dist/piggy/pool/index.d.ts.map +0 -1
- package/dist/piggy/provide/index.d.ts +0 -98
- package/dist/piggy/provide/index.d.ts.map +0 -1
- package/dist/piggy/proxy/index.d.ts +0 -94
- package/dist/piggy/proxy/index.d.ts.map +0 -1
- package/dist/piggy/register/index.d.ts +0 -9
- package/dist/piggy/register/index.d.ts.map +0 -1
- package/dist/piggy/router/index.d.ts +0 -38
- package/dist/piggy/router/index.d.ts.map +0 -1
- package/dist/piggy/server/index.d.ts +0 -42
- package/dist/piggy/server/index.d.ts.map +0 -1
- package/dist/piggy/session/index.d.ts +0 -27
- package/dist/piggy/session/index.d.ts.map +0 -1
- package/dist/piggy/store/index.d.ts +0 -22
- package/dist/piggy/store/index.d.ts.map +0 -1
- package/dist/piggy/tabs/index.d.ts +0 -12
- package/dist/piggy/tabs/index.d.ts.map +0 -1
- package/dist/piggy/wait/index.d.ts +0 -28
- package/dist/piggy/wait/index.d.ts.map +0 -1
- package/dist/piggy.d.ts +0 -10
- package/dist/piggy.d.ts.map +0 -1
- package/dist/piggy.js +0 -30223
- package/dist/register/index.js +0 -23710
- package/dist/server/index.js +0 -26831
- package/piggy/capture/index.ts +0 -76
- package/piggy/export/index.d.ts +0 -117
- package/piggy/export/index.ts +0 -147
- package/piggy/expose/index.ts +0 -42
- package/piggy/iframe/index.ts +0 -79
- package/piggy/intercept/scripts.d.ts +0 -13
- package/piggy/intercept/scripts.d.ts.map +0 -1
- package/piggy/launch/detect.d.ts +0 -3
- package/piggy/launch/detect.d.ts.map +0 -1
- package/piggy/launch/spawn.d.ts +0 -6
- package/piggy/launch/spawn.d.ts.map +0 -1
- package/piggy/logger/index.d.ts +0 -3
- package/piggy/logger/index.d.ts.map +0 -1
- package/piggy/pool/index.d.ts +0 -12
- package/piggy/pool/index.ts +0 -75
- package/piggy/provide/index.ts +0 -170
- package/piggy/proxy/index.ts +0 -154
- package/piggy/register/index.ts +0 -575
- package/piggy/router/index.ts +0 -69
- package/piggy/session/index.ts +0 -76
- package/piggy/store/index.d.ts +0 -26
- package/piggy/tabs/index.ts +0 -23
- package/piggy/wait/index.ts +0 -90
- /package/piggy/logger/{index.ts → index.js} +0 -0
package/dist/human/index.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// piggy/human/index.ts
|
|
2
|
-
function randomDelay(min, max) {
|
|
3
|
-
return new Promise((r) => setTimeout(r, Math.floor(Math.random() * (max - min + 1)) + min));
|
|
4
|
-
}
|
|
5
|
-
function humanTypeSequence(text) {
|
|
6
|
-
const adjacent = {
|
|
7
|
-
a: ["q", "w", "s", "z"],
|
|
8
|
-
b: ["v", "g", "h", "n"],
|
|
9
|
-
c: ["x", "d", "f", "v"],
|
|
10
|
-
d: ["s", "e", "r", "f", "c", "x"],
|
|
11
|
-
e: ["w", "r", "d", "s"],
|
|
12
|
-
f: ["d", "r", "t", "g", "v", "c"],
|
|
13
|
-
g: ["f", "t", "y", "h", "b", "v"],
|
|
14
|
-
h: ["g", "y", "u", "j", "n", "b"],
|
|
15
|
-
i: ["u", "o", "k", "j"],
|
|
16
|
-
j: ["h", "u", "i", "k", "m", "n"],
|
|
17
|
-
k: ["j", "i", "o", "l", "m"],
|
|
18
|
-
l: ["k", "o", "p"],
|
|
19
|
-
m: ["n", "j", "k"],
|
|
20
|
-
n: ["b", "h", "j", "m"],
|
|
21
|
-
o: ["i", "p", "l", "k"],
|
|
22
|
-
p: ["o", "l"],
|
|
23
|
-
q: ["w", "a"],
|
|
24
|
-
r: ["e", "t", "f", "d"],
|
|
25
|
-
s: ["a", "w", "e", "d", "x", "z"],
|
|
26
|
-
t: ["r", "y", "g", "f"],
|
|
27
|
-
u: ["y", "i", "h", "j"],
|
|
28
|
-
v: ["c", "f", "g", "b"],
|
|
29
|
-
w: ["q", "e", "a", "s"],
|
|
30
|
-
x: ["z", "s", "d", "c"],
|
|
31
|
-
y: ["t", "u", "g", "h"],
|
|
32
|
-
z: ["a", "s", "x"]
|
|
33
|
-
};
|
|
34
|
-
const actions = [];
|
|
35
|
-
const typoIndices = new Set;
|
|
36
|
-
if (text.length > 4) {
|
|
37
|
-
let tries = 0;
|
|
38
|
-
while (typoIndices.size < 2 && tries < 20) {
|
|
39
|
-
typoIndices.add(Math.floor(Math.random() * text.length));
|
|
40
|
-
tries++;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
for (let i = 0;i < text.length; i++) {
|
|
44
|
-
if (typoIndices.has(i)) {
|
|
45
|
-
const ch = text[i].toLowerCase();
|
|
46
|
-
const neighbors = adjacent[ch];
|
|
47
|
-
const typo = neighbors ? neighbors[Math.floor(Math.random() * neighbors.length)] ?? ch : ch;
|
|
48
|
-
actions.push(typo);
|
|
49
|
-
actions.push("BACKSPACE");
|
|
50
|
-
}
|
|
51
|
-
actions.push(text[i]);
|
|
52
|
-
}
|
|
53
|
-
return actions;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
class HumanClient {
|
|
57
|
-
client;
|
|
58
|
-
constructor(client) {
|
|
59
|
-
this.client = client;
|
|
60
|
-
}
|
|
61
|
-
set(opts, tabId = "default") {
|
|
62
|
-
return this.client.send("human.set", { ...opts, tabId });
|
|
63
|
-
}
|
|
64
|
-
get(tabId = "default") {
|
|
65
|
-
return this.client.send("human.get", { tabId });
|
|
66
|
-
}
|
|
67
|
-
type(opts, tabId = "default") {
|
|
68
|
-
return this.client.send("human.type", { ...opts, tabId });
|
|
69
|
-
}
|
|
70
|
-
click(opts, tabId = "default") {
|
|
71
|
-
return this.client.send("human.click", { ...opts, tabId });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function createHumanAPI(client) {
|
|
75
|
-
return new HumanClient(client);
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
randomDelay,
|
|
79
|
-
humanTypeSequence,
|
|
80
|
-
createHumanAPI,
|
|
81
|
-
HumanClient
|
|
82
|
-
};
|