adspower-browser 2.1.0 → 2.1.2-beta.1
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 +2 -0
- package/cli/core/winHideChildProcess.js +78 -17
- package/cli/core/winHideChildProcessLogic.js +61 -0
- package/cli/index.js +147 -21
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -142,6 +142,8 @@ ads close-browser <profile_id> # Or JSON: profile_id? | profil
|
|
|
142
142
|
ads create-browser '{"group_id":"0","user_proxy_config":{"proxy_soft":"no_proxy"},...}' # group_id + account field required; proxy optional (defaults to no_proxy; proxyid takes priority over user_proxy_config when both given)
|
|
143
143
|
ads update-browser '{"profile_id":"...",...}' # profile_id required
|
|
144
144
|
ads delete-browser '{"profile_id":["..."]}' # profile_id required
|
|
145
|
+
ads get-recycle-bin-list '{}' # page?, limit? (1-100, default 1). Last 30 days only
|
|
146
|
+
ads restore-recycle-bin '{"profile_id":"...","group_id":"123"}' # profile_id or profile_no, group_id required
|
|
145
147
|
ads get-browser-list '{}' # CLI defaults to page=1,limit=200. Or group_id?, limit?, page?, profile_id[]?, profile_no[]?, sort_type?, sort_order?, tag_ids?, tags_filter?, name?, name_filter?
|
|
146
148
|
ads get-opened-browser # No params
|
|
147
149
|
```
|
|
@@ -1,30 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
4
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/core/winHideChildProcessLogic.js
|
|
8
|
+
var require_winHideChildProcessLogic = __commonJS({
|
|
9
|
+
"src/core/winHideChildProcessLogic.js"(exports2, module2) {
|
|
10
|
+
"use strict";
|
|
11
|
+
var path = require("path");
|
|
12
|
+
var CONSOLE_EXECUTABLES = /^(cmd|powershell|pwsh|wmic|tasklist|reg|findstr|where|whoami|systeminfo|netstat|sc|net|chcp|hostname|conhost)(\.exe)?$/i;
|
|
13
|
+
var BROWSER_EXECUTABLES = /^(sunbrowser|flowerbrowser|chrome|chromium|msedge|firefox|brave|opera)(\.exe)?$/i;
|
|
14
|
+
function getExecutableBaseName(command) {
|
|
15
|
+
const trimmed = String(command).trim();
|
|
16
|
+
let executable = trimmed;
|
|
17
|
+
const quotedMatch = trimmed.match(/^"([^"]+)"|^'([^']+)'/);
|
|
18
|
+
if (quotedMatch) {
|
|
19
|
+
executable = quotedMatch[1] || quotedMatch[2];
|
|
20
|
+
} else {
|
|
21
|
+
executable = trimmed.split(/\s+/)[0] || trimmed;
|
|
22
|
+
}
|
|
23
|
+
executable = executable.replace(/^["']|["']$/g, "");
|
|
24
|
+
return path.basename(executable.replace(/\\/g, "/")).toLowerCase();
|
|
25
|
+
}
|
|
26
|
+
function shouldHideForSpawn(command, options) {
|
|
27
|
+
if (options?.windowsHide === false) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const base = getExecutableBaseName(command);
|
|
31
|
+
if (BROWSER_EXECUTABLES.test(base)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (CONSOLE_EXECUTABLES.test(base)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (options?.shell) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if (/\.(cmd|bat)$/i.test(base)) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
function withWindowsHideForExec2(options) {
|
|
46
|
+
if (typeof options === "object" && options !== null && !Array.isArray(options)) {
|
|
47
|
+
if (options.windowsHide === false) {
|
|
48
|
+
return options;
|
|
49
|
+
}
|
|
50
|
+
return { ...options, windowsHide: true };
|
|
51
|
+
}
|
|
52
|
+
return { windowsHide: true };
|
|
53
|
+
}
|
|
54
|
+
function withWindowsHideForSpawn2(command, options) {
|
|
55
|
+
const opts = typeof options === "object" && options !== null && !Array.isArray(options) ? { ...options } : {};
|
|
56
|
+
if (!shouldHideForSpawn(command, opts)) {
|
|
57
|
+
return opts;
|
|
58
|
+
}
|
|
59
|
+
return { ...opts, windowsHide: true };
|
|
60
|
+
}
|
|
61
|
+
module2.exports = {
|
|
62
|
+
CONSOLE_EXECUTABLES,
|
|
63
|
+
BROWSER_EXECUTABLES,
|
|
64
|
+
getExecutableBaseName,
|
|
65
|
+
shouldHideForSpawn,
|
|
66
|
+
withWindowsHideForExec: withWindowsHideForExec2,
|
|
67
|
+
withWindowsHideForSpawn: withWindowsHideForSpawn2
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
2
71
|
|
|
3
72
|
// src/core/winHideChildProcess.js
|
|
4
73
|
if (process.platform !== "win32") {
|
|
5
74
|
return;
|
|
6
75
|
}
|
|
7
76
|
var cp = require("child_process");
|
|
8
|
-
|
|
9
|
-
if (typeof options === "object" && options !== null && !Array.isArray(options)) {
|
|
10
|
-
if (options.windowsHide === false) {
|
|
11
|
-
return options;
|
|
12
|
-
}
|
|
13
|
-
return { ...options, windowsHide: true };
|
|
14
|
-
}
|
|
15
|
-
return { windowsHide: true };
|
|
16
|
-
}
|
|
77
|
+
var { withWindowsHideForExec, withWindowsHideForSpawn } = require_winHideChildProcessLogic();
|
|
17
78
|
function normalizeExecArgs(options, callback) {
|
|
18
79
|
if (typeof options === "function") {
|
|
19
|
-
return { options: {
|
|
80
|
+
return { options: withWindowsHideForExec({}), callback: options };
|
|
20
81
|
}
|
|
21
|
-
return { options:
|
|
82
|
+
return { options: withWindowsHideForExec(options || {}), callback };
|
|
22
83
|
}
|
|
23
|
-
function normalizeSpawnArgs(args, options) {
|
|
84
|
+
function normalizeSpawnArgs(command, args, options) {
|
|
24
85
|
if (Array.isArray(args)) {
|
|
25
|
-
return { args, options:
|
|
86
|
+
return { args, options: withWindowsHideForSpawn(command, options || {}) };
|
|
26
87
|
}
|
|
27
|
-
return { args: [], options:
|
|
88
|
+
return { args: [], options: withWindowsHideForSpawn(command, args || {}) };
|
|
28
89
|
}
|
|
29
90
|
var origExec = cp.exec.bind(cp);
|
|
30
91
|
cp.exec = function exec(cmd, options, callback) {
|
|
@@ -33,15 +94,15 @@ cp.exec = function exec(cmd, options, callback) {
|
|
|
33
94
|
};
|
|
34
95
|
var origExecSync = cp.execSync.bind(cp);
|
|
35
96
|
cp.execSync = function execSync(cmd, options) {
|
|
36
|
-
return origExecSync(cmd,
|
|
97
|
+
return origExecSync(cmd, withWindowsHideForExec(options || {}));
|
|
37
98
|
};
|
|
38
99
|
var origSpawn = cp.spawn.bind(cp);
|
|
39
100
|
cp.spawn = function spawn(command, args, options) {
|
|
40
|
-
const normalized = normalizeSpawnArgs(args, options);
|
|
101
|
+
const normalized = normalizeSpawnArgs(command, args, options);
|
|
41
102
|
return origSpawn(command, normalized.args, normalized.options);
|
|
42
103
|
};
|
|
43
104
|
var origSpawnSync = cp.spawnSync.bind(cp);
|
|
44
105
|
cp.spawnSync = function spawnSync(command, args, options) {
|
|
45
|
-
const normalized = normalizeSpawnArgs(args, options);
|
|
106
|
+
const normalized = normalizeSpawnArgs(command, args, options);
|
|
46
107
|
return origSpawnSync(command, normalized.args, normalized.options);
|
|
47
108
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// src/core/winHideChildProcessLogic.js
|
|
4
|
+
var path = require("path");
|
|
5
|
+
var CONSOLE_EXECUTABLES = /^(cmd|powershell|pwsh|wmic|tasklist|reg|findstr|where|whoami|systeminfo|netstat|sc|net|chcp|hostname|conhost)(\.exe)?$/i;
|
|
6
|
+
var BROWSER_EXECUTABLES = /^(sunbrowser|flowerbrowser|chrome|chromium|msedge|firefox|brave|opera)(\.exe)?$/i;
|
|
7
|
+
function getExecutableBaseName(command) {
|
|
8
|
+
const trimmed = String(command).trim();
|
|
9
|
+
let executable = trimmed;
|
|
10
|
+
const quotedMatch = trimmed.match(/^"([^"]+)"|^'([^']+)'/);
|
|
11
|
+
if (quotedMatch) {
|
|
12
|
+
executable = quotedMatch[1] || quotedMatch[2];
|
|
13
|
+
} else {
|
|
14
|
+
executable = trimmed.split(/\s+/)[0] || trimmed;
|
|
15
|
+
}
|
|
16
|
+
executable = executable.replace(/^["']|["']$/g, "");
|
|
17
|
+
return path.basename(executable.replace(/\\/g, "/")).toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
function shouldHideForSpawn(command, options) {
|
|
20
|
+
if (options?.windowsHide === false) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const base = getExecutableBaseName(command);
|
|
24
|
+
if (BROWSER_EXECUTABLES.test(base)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (CONSOLE_EXECUTABLES.test(base)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (options?.shell) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if (/\.(cmd|bat)$/i.test(base)) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
function withWindowsHideForExec(options) {
|
|
39
|
+
if (typeof options === "object" && options !== null && !Array.isArray(options)) {
|
|
40
|
+
if (options.windowsHide === false) {
|
|
41
|
+
return options;
|
|
42
|
+
}
|
|
43
|
+
return { ...options, windowsHide: true };
|
|
44
|
+
}
|
|
45
|
+
return { windowsHide: true };
|
|
46
|
+
}
|
|
47
|
+
function withWindowsHideForSpawn(command, options) {
|
|
48
|
+
const opts = typeof options === "object" && options !== null && !Array.isArray(options) ? { ...options } : {};
|
|
49
|
+
if (!shouldHideForSpawn(command, opts)) {
|
|
50
|
+
return opts;
|
|
51
|
+
}
|
|
52
|
+
return { ...opts, windowsHide: true };
|
|
53
|
+
}
|
|
54
|
+
module.exports = {
|
|
55
|
+
CONSOLE_EXECUTABLES,
|
|
56
|
+
BROWSER_EXECUTABLES,
|
|
57
|
+
getExecutableBaseName,
|
|
58
|
+
shouldHideForSpawn,
|
|
59
|
+
withWindowsHideForExec,
|
|
60
|
+
withWindowsHideForSpawn
|
|
61
|
+
};
|
package/cli/index.js
CHANGED
|
@@ -610,6 +610,23 @@ var LOCAL_API_CONTRACTS = {
|
|
|
610
610
|
profile_id: { apiName: "profile_id", location: "body" }
|
|
611
611
|
}
|
|
612
612
|
},
|
|
613
|
+
"get-recycle-bin-list": {
|
|
614
|
+
method: "POST",
|
|
615
|
+
path: "/api/v2/browser-profile/recycle-bin/list",
|
|
616
|
+
params: {
|
|
617
|
+
page: { apiName: "page", location: "body", default: 1 },
|
|
618
|
+
limit: { apiName: "limit", location: "body", default: 1 }
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
"restore-recycle-bin": {
|
|
622
|
+
method: "POST",
|
|
623
|
+
path: "/api/v2/browser-profile/recycle-bin/restore",
|
|
624
|
+
params: {
|
|
625
|
+
profile_id: { apiName: "profile_id", location: "body" },
|
|
626
|
+
profile_no: { apiName: "profile_no", location: "body" },
|
|
627
|
+
group_id: { apiName: "group_id", location: "body" }
|
|
628
|
+
}
|
|
629
|
+
},
|
|
613
630
|
"get-browser-list": {
|
|
614
631
|
method: "POST",
|
|
615
632
|
path: "/api/v2/browser-profile/list",
|
|
@@ -881,6 +898,8 @@ var API_ENDPOINTS = {
|
|
|
881
898
|
GET_BROWSER_LIST: LOCAL_API_CONTRACTS["get-browser-list"].path,
|
|
882
899
|
UPDATE_BROWSER: LOCAL_API_CONTRACTS["update-browser"].path,
|
|
883
900
|
DELETE_BROWSER: LOCAL_API_CONTRACTS["delete-browser"].path,
|
|
901
|
+
GET_RECYCLE_BIN_LIST: LOCAL_API_CONTRACTS["get-recycle-bin-list"].path,
|
|
902
|
+
RESTORE_RECYCLE_BIN: LOCAL_API_CONTRACTS["restore-recycle-bin"].path,
|
|
884
903
|
GET_PROFILE_COOKIES: LOCAL_API_CONTRACTS["get-profile-cookies"].path,
|
|
885
904
|
GET_PROFILE_UA: LOCAL_API_CONTRACTS["get-profile-ua"].path,
|
|
886
905
|
CLOSE_ALL_PROFILES: LOCAL_API_CONTRACTS["close-all-profiles"].path,
|
|
@@ -907,12 +926,16 @@ var API_ENDPOINTS = {
|
|
|
907
926
|
GET_KERNEL_LIST: LOCAL_API_CONTRACTS["get-kernel-list"].path,
|
|
908
927
|
UPDATE_PATCH: LOCAL_API_CONTRACTS["update-patch"].path
|
|
909
928
|
};
|
|
929
|
+
var createClientHeaders = (apiKey) => ({
|
|
930
|
+
...apiKey ? { Authorization: `Bearer ${apiKey}` } : {},
|
|
931
|
+
"x-mcp-client": "mcp"
|
|
932
|
+
});
|
|
910
933
|
var apiClient = import_axios2.default.create({
|
|
911
|
-
headers: API_KEY
|
|
934
|
+
headers: createClientHeaders(API_KEY)
|
|
912
935
|
});
|
|
913
936
|
var getApiClient = () => {
|
|
914
937
|
const client = import_axios2.default.create({
|
|
915
|
-
headers: CONFIG.apiKey
|
|
938
|
+
headers: createClientHeaders(CONFIG.apiKey)
|
|
916
939
|
});
|
|
917
940
|
client.interceptors.request.use(async (config2) => {
|
|
918
941
|
if (isLocalApiRequestUrl(config2.url)) {
|
|
@@ -955,6 +978,18 @@ var TOOL_INTENT_BY_NAME = {
|
|
|
955
978
|
triggersEn: "remove profile, delete account, trash browser",
|
|
956
979
|
triggersZh: "\u5220\u9664\u73AF\u5883,\u79FB\u9664profile,\u5220\u6389\u6D4F\u89C8\u5668\u8D26\u53F7"
|
|
957
980
|
},
|
|
981
|
+
"get-recycle-bin-list": {
|
|
982
|
+
intentEn: "List browser profiles in the recycle bin from the last 30 days.",
|
|
983
|
+
intentZh: "\u67E5\u8BE2\u8FD1 30 \u5929\u56DE\u6536\u7AD9\u4E2D\u7684\u6D4F\u89C8\u5668\u73AF\u5883\u3002",
|
|
984
|
+
triggersEn: "recycle bin, deleted profiles, trash list, recently deleted",
|
|
985
|
+
triggersZh: "\u56DE\u6536\u7AD9,\u5DF2\u5220\u9664\u73AF\u5883,\u6700\u8FD1\u5220\u9664,\u5783\u573E\u6876\u5217\u8868"
|
|
986
|
+
},
|
|
987
|
+
"restore-recycle-bin": {
|
|
988
|
+
intentEn: "Restore one deleted browser profile from the recycle bin into a target group.",
|
|
989
|
+
intentZh: "\u628A\u56DE\u6536\u7AD9\u91CC\u7684\u4E00\u4E2A\u73AF\u5883\u6062\u590D\u5230\u6307\u5B9A\u5206\u7EC4\u3002",
|
|
990
|
+
triggersEn: "restore profile, recover deleted browser, undelete environment",
|
|
991
|
+
triggersZh: "\u6062\u590D\u73AF\u5883,\u8FD8\u539F\u56DE\u6536\u7AD9,\u627E\u56DE\u5DF2\u5220\u9664\u73AF\u5883"
|
|
992
|
+
},
|
|
958
993
|
"get-browser-list": {
|
|
959
994
|
intentEn: "List or search browser profiles (pagination, filters).",
|
|
960
995
|
intentZh: "\u5206\u9875/\u6761\u4EF6\u67E5\u8BE2\u6D4F\u89C8\u5668 profile \u5217\u8868\u3002",
|
|
@@ -1312,6 +1347,51 @@ function resolveOpenBrowserHeadless(params, env, platform) {
|
|
|
1312
1347
|
};
|
|
1313
1348
|
}
|
|
1314
1349
|
|
|
1350
|
+
// ../core/src/utils/systemVer.ts
|
|
1351
|
+
var import_os = __toESM(require("os"));
|
|
1352
|
+
function getUaSystemVersionFromOs(info = {}) {
|
|
1353
|
+
const platform = info.platform ?? import_os.default.platform();
|
|
1354
|
+
const release = info.release ?? import_os.default.release();
|
|
1355
|
+
if (platform === "linux") {
|
|
1356
|
+
return "Linux";
|
|
1357
|
+
}
|
|
1358
|
+
if (platform === "win32") {
|
|
1359
|
+
return matchWindowsVersion(release);
|
|
1360
|
+
}
|
|
1361
|
+
if (platform === "darwin") {
|
|
1362
|
+
return matchMacVersion(release);
|
|
1363
|
+
}
|
|
1364
|
+
return null;
|
|
1365
|
+
}
|
|
1366
|
+
function matchWindowsVersion(release) {
|
|
1367
|
+
const [majorStr, minorStr = "0", buildStr = "0"] = release.split(".");
|
|
1368
|
+
const major = Number(majorStr);
|
|
1369
|
+
const minor = Number(minorStr);
|
|
1370
|
+
const build = Number(buildStr);
|
|
1371
|
+
if (major === 6) {
|
|
1372
|
+
if (minor === 1) return "Windows 7";
|
|
1373
|
+
if (minor === 2 || minor === 3) return "Windows 8";
|
|
1374
|
+
}
|
|
1375
|
+
if (major === 10 && minor === 0) {
|
|
1376
|
+
return build >= 22e3 ? "Windows 11" : "Windows 10";
|
|
1377
|
+
}
|
|
1378
|
+
return "Windows";
|
|
1379
|
+
}
|
|
1380
|
+
function matchMacVersion(release) {
|
|
1381
|
+
const darwinMajor = Number(release.split(".")[0]);
|
|
1382
|
+
if (darwinMajor < 20) return "Mac OS X 10";
|
|
1383
|
+
const darwinToMac = {
|
|
1384
|
+
20: "Mac OS X 11",
|
|
1385
|
+
21: "Mac OS X 12",
|
|
1386
|
+
22: "Mac OS X 13",
|
|
1387
|
+
23: "Mac OS X 14",
|
|
1388
|
+
24: "Mac OS X 15",
|
|
1389
|
+
25: "Mac OS X 26"
|
|
1390
|
+
// macOS Tahoe 26,Darwin 仍为 25.x
|
|
1391
|
+
};
|
|
1392
|
+
return darwinToMac[darwinMajor] ?? "Mac OS X";
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1315
1395
|
// ../core/src/handlers/browser.ts
|
|
1316
1396
|
var browserHandlers = {
|
|
1317
1397
|
async openBrowser(params) {
|
|
@@ -1336,7 +1416,23 @@ var browserHandlers = {
|
|
|
1336
1416
|
throw new Error(response.data.msg);
|
|
1337
1417
|
},
|
|
1338
1418
|
async createBrowser(params) {
|
|
1339
|
-
|
|
1419
|
+
let resolvedParams = params;
|
|
1420
|
+
if (!params.fingerprint_config?.random_ua?.ua_system_version) {
|
|
1421
|
+
const uaSystemVersion = getUaSystemVersionFromOs();
|
|
1422
|
+
if (uaSystemVersion) {
|
|
1423
|
+
resolvedParams = {
|
|
1424
|
+
...params,
|
|
1425
|
+
fingerprint_config: {
|
|
1426
|
+
...params.fingerprint_config,
|
|
1427
|
+
random_ua: {
|
|
1428
|
+
...params.fingerprint_config?.random_ua,
|
|
1429
|
+
ua_system_version: [uaSystemVersion]
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
const requestBody = buildRequestBodyFor("create-browser", resolvedParams);
|
|
1340
1436
|
const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.CREATE_BROWSER}`, requestBody);
|
|
1341
1437
|
if (response.data.code === 0) {
|
|
1342
1438
|
return JSON.stringify(response.data.data, null, 2);
|
|
@@ -1361,6 +1457,26 @@ var browserHandlers = {
|
|
|
1361
1457
|
}
|
|
1362
1458
|
throw new Error(response.data.msg);
|
|
1363
1459
|
},
|
|
1460
|
+
async getRecycleBinList(params) {
|
|
1461
|
+
const response = await getApiClient().post(
|
|
1462
|
+
`${getLocalApiBase()}${API_ENDPOINTS.GET_RECYCLE_BIN_LIST}`,
|
|
1463
|
+
buildRequestBodyFor("get-recycle-bin-list", params)
|
|
1464
|
+
);
|
|
1465
|
+
if (response.data.code === 0) {
|
|
1466
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1467
|
+
}
|
|
1468
|
+
throw new Error(response.data.msg);
|
|
1469
|
+
},
|
|
1470
|
+
async restoreRecycleBin(params) {
|
|
1471
|
+
const response = await getApiClient().post(
|
|
1472
|
+
`${getLocalApiBase()}${API_ENDPOINTS.RESTORE_RECYCLE_BIN}`,
|
|
1473
|
+
buildRequestBodyFor("restore-recycle-bin", params)
|
|
1474
|
+
);
|
|
1475
|
+
if (response.data.code === 0) {
|
|
1476
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1477
|
+
}
|
|
1478
|
+
throw new Error(response.data.msg);
|
|
1479
|
+
},
|
|
1364
1480
|
async getBrowserList(params) {
|
|
1365
1481
|
const requestBody = buildRequestBodyFor("get-browser-list", params);
|
|
1366
1482
|
const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.GET_BROWSER_LIST}`, requestBody);
|
|
@@ -1598,7 +1714,7 @@ var tagHandlers = {
|
|
|
1598
1714
|
|
|
1599
1715
|
// ../core/src/handlers/automation.ts
|
|
1600
1716
|
var import_path2 = __toESM(require("path"));
|
|
1601
|
-
var
|
|
1717
|
+
var import_os2 = __toESM(require("os"));
|
|
1602
1718
|
|
|
1603
1719
|
// ../core/src/utils/browserBase.ts
|
|
1604
1720
|
var import_playwright_core = require("playwright-core");
|
|
@@ -1651,7 +1767,7 @@ var BrowserBase = class {
|
|
|
1651
1767
|
var browserBase_default = new BrowserBase();
|
|
1652
1768
|
|
|
1653
1769
|
// ../core/src/handlers/automation.ts
|
|
1654
|
-
var defaultDownloadsPath = import_path2.default.join(
|
|
1770
|
+
var defaultDownloadsPath = import_path2.default.join(import_os2.default.homedir(), "Downloads");
|
|
1655
1771
|
|
|
1656
1772
|
// ../core/src/handlers/kernel.ts
|
|
1657
1773
|
var kernelHandlers = {
|
|
@@ -1805,6 +1921,7 @@ var randomUaConfigSchema = import_zod.z.object({
|
|
|
1805
1921
|
"Mac OS X 13",
|
|
1806
1922
|
"Mac OS X 14",
|
|
1807
1923
|
"Mac OS X 15",
|
|
1924
|
+
"Mac OS X 26",
|
|
1808
1925
|
"Mac OS X",
|
|
1809
1926
|
"Windows",
|
|
1810
1927
|
"iOS",
|
|
@@ -2212,7 +2329,7 @@ var schemas = {
|
|
|
2212
2329
|
ipchecker: import_zod.z.enum(["ip2location", "ipapi", "ipfoxy"]).optional().describe("IP query channel"),
|
|
2213
2330
|
category_id: import_zod.z.string().optional().describe("The category id of the browser, you can use the get-application-list tool to get the application list"),
|
|
2214
2331
|
profile_tag_ids: import_zod.z.array(import_zod.z.string()).max(30).optional().describe('Tag IDs to assign to the profile, max 30 tags per profile. Example: ["tag1","tag2"]'),
|
|
2215
|
-
fingerprint_config: fingerprintConfigSchema.optional().default({
|
|
2332
|
+
fingerprint_config: fingerprintConfigSchema.optional().default({ browser_kernel_config: { version: "latest", type: "chrome" } }),
|
|
2216
2333
|
platform_account: platformAccountSchema
|
|
2217
2334
|
}).strict(),
|
|
2218
2335
|
updateBrowserSchema: import_zod.z.object({
|
|
@@ -2272,6 +2389,17 @@ var schemas = {
|
|
|
2272
2389
|
deleteBrowserSchema: import_zod.z.object({
|
|
2273
2390
|
profile_id: import_zod.z.array(import_zod.z.string()).describe("The profile ids of the browsers to delete, it is required when you want to delete the browser")
|
|
2274
2391
|
}).strict(),
|
|
2392
|
+
getRecycleBinListSchema: import_zod.z.object({
|
|
2393
|
+
page: import_zod.z.number().int().min(1).optional().describe("Page number. Defaults to 1. Only profiles deleted in the last 30 days and visible to the caller are returned."),
|
|
2394
|
+
limit: import_zod.z.number().int().min(1).max(100).optional().describe("Profiles per page, range 1-100. Defaults to 1 when omitted.")
|
|
2395
|
+
}).strict(),
|
|
2396
|
+
restoreRecycleBinSchema: import_zod.z.object({
|
|
2397
|
+
profile_id: import_zod.z.string().optional().describe("Profile ID in the recycle bin. Either profile_id or profile_no is required. If both are provided, profile_id takes priority."),
|
|
2398
|
+
profile_no: import_zod.z.string().regex(/^\d+$/, "Profile number must be a numeric string").optional().describe("Profile serial number in the recycle bin. Either profile_id or profile_no is required. If both are provided, profile_id takes priority."),
|
|
2399
|
+
group_id: import_zod.z.string().regex(/^\d+$/, "Group ID must be a numeric string").describe('Target group ID after restore. Use get-group-list to find a group the caller can use. "0" is ungrouped.')
|
|
2400
|
+
}).strict().refine((data) => data.profile_id || data.profile_no, {
|
|
2401
|
+
message: "Either profile_id or profile_no must be provided"
|
|
2402
|
+
}),
|
|
2275
2403
|
getBrowserListSchema: import_zod.z.object({
|
|
2276
2404
|
group_id: import_zod.z.string().regex(/^\d+$/, "Group ID must be a numeric string").optional().describe("Query by group ID; searches all groups if empty"),
|
|
2277
2405
|
limit: import_zod.z.number().min(1).max(200).optional().describe("Profiles per page, range 1 ~ 200. If omitted the CLI sends limit=200; the Local API itself defaults to only 1, so always rely on this CLI default or pass an explicit value"),
|
|
@@ -2541,6 +2669,16 @@ var STATELESS_HANDLERS = {
|
|
|
2541
2669
|
description: buildCliCommandDescription("delete-browser", "Delete the browser"),
|
|
2542
2670
|
paramsDescription: schemaParamsDescription(schemas.deleteBrowserSchema, "delete-browser")
|
|
2543
2671
|
},
|
|
2672
|
+
"get-recycle-bin-list": {
|
|
2673
|
+
fn: browserHandlers.getRecycleBinList,
|
|
2674
|
+
description: buildCliCommandDescription("get-recycle-bin-list", "List browser profiles in the recycle bin from the last 30 days"),
|
|
2675
|
+
paramsDescription: schemaParamsDescription(schemas.getRecycleBinListSchema, "get-recycle-bin-list")
|
|
2676
|
+
},
|
|
2677
|
+
"restore-recycle-bin": {
|
|
2678
|
+
fn: browserHandlers.restoreRecycleBin,
|
|
2679
|
+
description: buildCliCommandDescription("restore-recycle-bin", "Restore a deleted browser profile from the recycle bin into a group"),
|
|
2680
|
+
paramsDescription: schemaParamsDescription(schemas.restoreRecycleBinSchema, "restore-recycle-bin")
|
|
2681
|
+
},
|
|
2544
2682
|
"get-browser-list": {
|
|
2545
2683
|
fn: browserHandlers.getBrowserList,
|
|
2546
2684
|
description: buildCliCommandDescription("get-browser-list", "Get the list of browsers"),
|
|
@@ -3050,9 +3188,6 @@ var startChild = (type) => {
|
|
|
3050
3188
|
}
|
|
3051
3189
|
if (text === "restart") {
|
|
3052
3190
|
child && child.kill("SIGKILL");
|
|
3053
|
-
store.setStoreValue("status", "restarting");
|
|
3054
|
-
startChild("2").catch(() => {
|
|
3055
|
-
});
|
|
3056
3191
|
}
|
|
3057
3192
|
if (text.indexOf("INTRANET_$$_") > -1) {
|
|
3058
3193
|
const arr = text.split("_$$_");
|
|
@@ -3084,18 +3219,9 @@ var startChild = (type) => {
|
|
|
3084
3219
|
process.exit(0);
|
|
3085
3220
|
});
|
|
3086
3221
|
child.on("exit", async (code, signal) => {
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
removePidFile();
|
|
3091
|
-
} else {
|
|
3092
|
-
child = null;
|
|
3093
|
-
await sleepTime(500);
|
|
3094
|
-
startChild("2").then(() => {
|
|
3095
|
-
}).catch(() => {
|
|
3096
|
-
logError("[!] Restart failed");
|
|
3097
|
-
});
|
|
3098
|
-
}
|
|
3222
|
+
await browsersKill();
|
|
3223
|
+
store.clear();
|
|
3224
|
+
removePidFile();
|
|
3099
3225
|
});
|
|
3100
3226
|
timer = setTimeout(() => {
|
|
3101
3227
|
child && child.kill("SIGKILL");
|