adspower-browser 2.1.0 → 2.1.2
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 +11 -0
- package/cli/core/winHideChildProcess.js +78 -17
- package/cli/core/winHideChildProcessLogic.js +61 -0
- package/cli/index.js +324 -21
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -168,6 +168,17 @@ ads update-group '{"group_id":"1","group_name":"New Name"}' # group_id + grou
|
|
|
168
168
|
ads get-group-list '{}' # group_name?, page_size?, page?
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
+
### Member
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
ads create-member '{"user_group_id":"...","email":"alice@example.com","password":"password1","identity":4}' # identity: 2 admin, 3 manager, 4 staff
|
|
175
|
+
ads update-member '{"user_id":"...","name":"Alice"}' # omit authorized_group to keep groups; [] + group_update_type 1 clears
|
|
176
|
+
ads reset-member-password '{"user_id":"..."}' # unbind_phone?: 0|1; new_password is in the response
|
|
177
|
+
ads delete-member '{"user_id":"..."}'
|
|
178
|
+
ads get-member-list '{}' # user_group_id?, user_id[]?, email[]?, page?, limit? (default 1)
|
|
179
|
+
ads get-member-group-list '{}' # page?, limit? (default 1)
|
|
180
|
+
```
|
|
181
|
+
|
|
171
182
|
### Application (categories)
|
|
172
183
|
|
|
173
184
|
```bash
|
|
@@ -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
|
@@ -728,6 +728,73 @@ var LOCAL_API_CONTRACTS = {
|
|
|
728
728
|
page_size: { apiName: "page_size", location: "query" }
|
|
729
729
|
}
|
|
730
730
|
},
|
|
731
|
+
"create-member": {
|
|
732
|
+
method: "POST",
|
|
733
|
+
path: "/api/v2/user/create",
|
|
734
|
+
params: {
|
|
735
|
+
user_group_id: { apiName: "user_group_id", location: "body" },
|
|
736
|
+
name: { apiName: "name", location: "body" },
|
|
737
|
+
email: { apiName: "email", location: "body" },
|
|
738
|
+
password: { apiName: "password", location: "body" },
|
|
739
|
+
identity: { apiName: "identity", location: "body" },
|
|
740
|
+
manager: { apiName: "manager", location: "body" },
|
|
741
|
+
member: { apiName: "member", location: "body" },
|
|
742
|
+
authorized_group: { apiName: "authorized_group", location: "body" },
|
|
743
|
+
profile_limit: { apiName: "profile_limit", location: "body" },
|
|
744
|
+
remark: { apiName: "remark", location: "body" }
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
"update-member": {
|
|
748
|
+
method: "POST",
|
|
749
|
+
path: "/api/v2/user/update",
|
|
750
|
+
params: {
|
|
751
|
+
user_id: { apiName: "user_id", location: "body" },
|
|
752
|
+
user_group_id: { apiName: "user_group_id", location: "body" },
|
|
753
|
+
name: { apiName: "name", location: "body" },
|
|
754
|
+
email: { apiName: "email", location: "body" },
|
|
755
|
+
identity: { apiName: "identity", location: "body" },
|
|
756
|
+
manager: { apiName: "manager", location: "body" },
|
|
757
|
+
member: { apiName: "member", location: "body" },
|
|
758
|
+
authorized_group: { apiName: "authorized_group", location: "body" },
|
|
759
|
+
group_update_type: { apiName: "group_update_type", location: "body" },
|
|
760
|
+
profile_limit: { apiName: "profile_limit", location: "body" },
|
|
761
|
+
remark: { apiName: "remark", location: "body" }
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
"reset-member-password": {
|
|
765
|
+
method: "POST",
|
|
766
|
+
path: "/api/v2/user/reset_password",
|
|
767
|
+
params: {
|
|
768
|
+
user_id: { apiName: "user_id", location: "body" },
|
|
769
|
+
unbind_phone: { apiName: "unbind_phone", location: "body" }
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
"delete-member": {
|
|
773
|
+
method: "POST",
|
|
774
|
+
path: "/api/v2/user/delete",
|
|
775
|
+
params: {
|
|
776
|
+
user_id: { apiName: "user_id", location: "body" }
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
"get-member-list": {
|
|
780
|
+
method: "GET",
|
|
781
|
+
path: "/api/v2/user/list",
|
|
782
|
+
params: {
|
|
783
|
+
user_group_id: { apiName: "user_group_id", location: "query" },
|
|
784
|
+
user_id: { apiName: "user_id", location: "query" },
|
|
785
|
+
email: { apiName: "email", location: "query" },
|
|
786
|
+
page: { apiName: "page", location: "query" },
|
|
787
|
+
limit: { apiName: "limit", location: "query" }
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
"get-member-group-list": {
|
|
791
|
+
method: "GET",
|
|
792
|
+
path: "/api/v2/user-group/list",
|
|
793
|
+
params: {
|
|
794
|
+
page: { apiName: "page", location: "query" },
|
|
795
|
+
limit: { apiName: "limit", location: "query" }
|
|
796
|
+
}
|
|
797
|
+
},
|
|
731
798
|
"create-proxy": {
|
|
732
799
|
method: "POST",
|
|
733
800
|
path: "/api/v2/proxy-list/create",
|
|
@@ -898,6 +965,12 @@ var API_ENDPOINTS = {
|
|
|
898
965
|
GET_GROUP_LIST: LOCAL_API_CONTRACTS["get-group-list"].path,
|
|
899
966
|
CREATE_GROUP: LOCAL_API_CONTRACTS["create-group"].path,
|
|
900
967
|
UPDATE_GROUP: LOCAL_API_CONTRACTS["update-group"].path,
|
|
968
|
+
CREATE_MEMBER: LOCAL_API_CONTRACTS["create-member"].path,
|
|
969
|
+
UPDATE_MEMBER: LOCAL_API_CONTRACTS["update-member"].path,
|
|
970
|
+
RESET_MEMBER_PASSWORD: LOCAL_API_CONTRACTS["reset-member-password"].path,
|
|
971
|
+
DELETE_MEMBER: LOCAL_API_CONTRACTS["delete-member"].path,
|
|
972
|
+
GET_MEMBER_LIST: LOCAL_API_CONTRACTS["get-member-list"].path,
|
|
973
|
+
GET_MEMBER_GROUP_LIST: LOCAL_API_CONTRACTS["get-member-group-list"].path,
|
|
901
974
|
GET_APPLICATION_LIST: LOCAL_API_CONTRACTS["get-application-list"].path,
|
|
902
975
|
GET_TAG_LIST: LOCAL_API_CONTRACTS["get-tag-list"].path,
|
|
903
976
|
CREATE_TAG: LOCAL_API_CONTRACTS["create-tag"].path,
|
|
@@ -907,12 +980,16 @@ var API_ENDPOINTS = {
|
|
|
907
980
|
GET_KERNEL_LIST: LOCAL_API_CONTRACTS["get-kernel-list"].path,
|
|
908
981
|
UPDATE_PATCH: LOCAL_API_CONTRACTS["update-patch"].path
|
|
909
982
|
};
|
|
983
|
+
var createClientHeaders = (apiKey) => ({
|
|
984
|
+
...apiKey ? { Authorization: `Bearer ${apiKey}` } : {},
|
|
985
|
+
"x-mcp-client": "mcp"
|
|
986
|
+
});
|
|
910
987
|
var apiClient = import_axios2.default.create({
|
|
911
|
-
headers: API_KEY
|
|
988
|
+
headers: createClientHeaders(API_KEY)
|
|
912
989
|
});
|
|
913
990
|
var getApiClient = () => {
|
|
914
991
|
const client = import_axios2.default.create({
|
|
915
|
-
headers: CONFIG.apiKey
|
|
992
|
+
headers: createClientHeaders(CONFIG.apiKey)
|
|
916
993
|
});
|
|
917
994
|
client.interceptors.request.use(async (config2) => {
|
|
918
995
|
if (isLocalApiRequestUrl(config2.url)) {
|
|
@@ -1039,6 +1116,42 @@ var TOOL_INTENT_BY_NAME = {
|
|
|
1039
1116
|
triggersEn: "list groups, search group name",
|
|
1040
1117
|
triggersZh: "\u5206\u7EC4\u5217\u8868,\u67E5\u7EC4\u540D"
|
|
1041
1118
|
},
|
|
1119
|
+
"create-member": {
|
|
1120
|
+
intentEn: "Create a team member (admin / manager / staff).",
|
|
1121
|
+
intentZh: "\u65B0\u5EFA\u56E2\u961F\u6210\u5458\uFF08\u7BA1\u7406\u5458 / \u7ECF\u7406 / \u5458\u5DE5\uFF09\u3002",
|
|
1122
|
+
triggersEn: "create member, add user, invite teammate, new staff",
|
|
1123
|
+
triggersZh: "\u521B\u5EFA\u6210\u5458,\u6DFB\u52A0\u7528\u6237,\u9080\u8BF7\u540C\u4E8B,\u65B0\u5EFA\u5458\u5DE5"
|
|
1124
|
+
},
|
|
1125
|
+
"update-member": {
|
|
1126
|
+
intentEn: "Update an existing team member (role, groups, profile limit).",
|
|
1127
|
+
intentZh: "\u7F16\u8F91\u5DF2\u6709\u56E2\u961F\u6210\u5458\uFF08\u8EAB\u4EFD\u3001\u6388\u6743\u5206\u7EC4\u3001\u73AF\u5883\u989D\u5EA6\u7B49\uFF09\u3002",
|
|
1128
|
+
triggersEn: "edit member, change role, update staff, authorized group",
|
|
1129
|
+
triggersZh: "\u7F16\u8F91\u6210\u5458,\u6539\u8EAB\u4EFD,\u66F4\u65B0\u7528\u6237,\u6388\u6743\u5206\u7EC4"
|
|
1130
|
+
},
|
|
1131
|
+
"reset-member-password": {
|
|
1132
|
+
intentEn: "Reset a team member password; new_password is returned in the response.",
|
|
1133
|
+
intentZh: "\u91CD\u7F6E\u6210\u5458\u5BC6\u7801\uFF0C\u6210\u529F\u54CD\u5E94\u91CC\u8FD4\u56DE\u660E\u6587 new_password\u3002",
|
|
1134
|
+
triggersEn: "reset password, new password, unbind phone",
|
|
1135
|
+
triggersZh: "\u91CD\u7F6E\u5BC6\u7801,\u6539\u5BC6\u7801,\u89E3\u7ED1\u624B\u673A"
|
|
1136
|
+
},
|
|
1137
|
+
"delete-member": {
|
|
1138
|
+
intentEn: "Delete a team member by user_id.",
|
|
1139
|
+
intentZh: "\u6309 user_id \u5220\u9664\u56E2\u961F\u6210\u5458\u3002",
|
|
1140
|
+
triggersEn: "remove member, delete user, delete staff",
|
|
1141
|
+
triggersZh: "\u5220\u9664\u6210\u5458,\u79FB\u9664\u7528\u6237,\u5220\u5458\u5DE5"
|
|
1142
|
+
},
|
|
1143
|
+
"get-member-list": {
|
|
1144
|
+
intentEn: "List or search team members (pagination, user_id, email).",
|
|
1145
|
+
intentZh: "\u5206\u9875/\u6761\u4EF6\u67E5\u8BE2\u56E2\u961F\u6210\u5458\u5217\u8868\u3002",
|
|
1146
|
+
triggersEn: "list members, search users, query staff, member list",
|
|
1147
|
+
triggersZh: "\u6210\u5458\u5217\u8868,\u67E5\u8BE2\u7528\u6237,\u641C\u7D22\u5458\u5DE5,\u5217\u51FA\u6210\u5458"
|
|
1148
|
+
},
|
|
1149
|
+
"get-member-group-list": {
|
|
1150
|
+
intentEn: "List member groups / roles with pagination.",
|
|
1151
|
+
intentZh: "\u5206\u9875\u67E5\u8BE2\u6210\u5458\u5206\u7EC4\uFF08\u89D2\u8272\uFF09\u5217\u8868\u3002",
|
|
1152
|
+
triggersEn: "member groups, user groups, role list",
|
|
1153
|
+
triggersZh: "\u6210\u5458\u5206\u7EC4,\u7528\u6237\u7EC4,\u89D2\u8272\u5217\u8868"
|
|
1154
|
+
},
|
|
1042
1155
|
"check-status": {
|
|
1043
1156
|
intentEn: "Check Local API availability on this machine.",
|
|
1044
1157
|
intentZh: "\u68C0\u6D4B\u672C\u673A Local API \u662F\u5426\u53EF\u7528\u3002",
|
|
@@ -1312,6 +1425,51 @@ function resolveOpenBrowserHeadless(params, env, platform) {
|
|
|
1312
1425
|
};
|
|
1313
1426
|
}
|
|
1314
1427
|
|
|
1428
|
+
// ../core/src/utils/systemVer.ts
|
|
1429
|
+
var import_os = __toESM(require("os"));
|
|
1430
|
+
function getUaSystemVersionFromOs(info = {}) {
|
|
1431
|
+
const platform = info.platform ?? import_os.default.platform();
|
|
1432
|
+
const release = info.release ?? import_os.default.release();
|
|
1433
|
+
if (platform === "linux") {
|
|
1434
|
+
return "Linux";
|
|
1435
|
+
}
|
|
1436
|
+
if (platform === "win32") {
|
|
1437
|
+
return matchWindowsVersion(release);
|
|
1438
|
+
}
|
|
1439
|
+
if (platform === "darwin") {
|
|
1440
|
+
return matchMacVersion(release);
|
|
1441
|
+
}
|
|
1442
|
+
return null;
|
|
1443
|
+
}
|
|
1444
|
+
function matchWindowsVersion(release) {
|
|
1445
|
+
const [majorStr, minorStr = "0", buildStr = "0"] = release.split(".");
|
|
1446
|
+
const major = Number(majorStr);
|
|
1447
|
+
const minor = Number(minorStr);
|
|
1448
|
+
const build = Number(buildStr);
|
|
1449
|
+
if (major === 6) {
|
|
1450
|
+
if (minor === 1) return "Windows 7";
|
|
1451
|
+
if (minor === 2 || minor === 3) return "Windows 8";
|
|
1452
|
+
}
|
|
1453
|
+
if (major === 10 && minor === 0) {
|
|
1454
|
+
return build >= 22e3 ? "Windows 11" : "Windows 10";
|
|
1455
|
+
}
|
|
1456
|
+
return "Windows";
|
|
1457
|
+
}
|
|
1458
|
+
function matchMacVersion(release) {
|
|
1459
|
+
const darwinMajor = Number(release.split(".")[0]);
|
|
1460
|
+
if (darwinMajor < 20) return "Mac OS X 10";
|
|
1461
|
+
const darwinToMac = {
|
|
1462
|
+
20: "Mac OS X 11",
|
|
1463
|
+
21: "Mac OS X 12",
|
|
1464
|
+
22: "Mac OS X 13",
|
|
1465
|
+
23: "Mac OS X 14",
|
|
1466
|
+
24: "Mac OS X 15",
|
|
1467
|
+
25: "Mac OS X 26"
|
|
1468
|
+
// macOS Tahoe 26,Darwin 仍为 25.x
|
|
1469
|
+
};
|
|
1470
|
+
return darwinToMac[darwinMajor] ?? "Mac OS X";
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1315
1473
|
// ../core/src/handlers/browser.ts
|
|
1316
1474
|
var browserHandlers = {
|
|
1317
1475
|
async openBrowser(params) {
|
|
@@ -1336,7 +1494,23 @@ var browserHandlers = {
|
|
|
1336
1494
|
throw new Error(response.data.msg);
|
|
1337
1495
|
},
|
|
1338
1496
|
async createBrowser(params) {
|
|
1339
|
-
|
|
1497
|
+
let resolvedParams = params;
|
|
1498
|
+
if (!params.fingerprint_config?.random_ua?.ua_system_version) {
|
|
1499
|
+
const uaSystemVersion = getUaSystemVersionFromOs();
|
|
1500
|
+
if (uaSystemVersion) {
|
|
1501
|
+
resolvedParams = {
|
|
1502
|
+
...params,
|
|
1503
|
+
fingerprint_config: {
|
|
1504
|
+
...params.fingerprint_config,
|
|
1505
|
+
random_ua: {
|
|
1506
|
+
...params.fingerprint_config?.random_ua,
|
|
1507
|
+
ua_system_version: [uaSystemVersion]
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
const requestBody = buildRequestBodyFor("create-browser", resolvedParams);
|
|
1340
1514
|
const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.CREATE_BROWSER}`, requestBody);
|
|
1341
1515
|
if (response.data.code === 0) {
|
|
1342
1516
|
return JSON.stringify(response.data.data, null, 2);
|
|
@@ -1479,6 +1653,73 @@ var groupHandlers = {
|
|
|
1479
1653
|
}
|
|
1480
1654
|
};
|
|
1481
1655
|
|
|
1656
|
+
// ../core/src/handlers/member.ts
|
|
1657
|
+
function serializeMemberListQuery(params) {
|
|
1658
|
+
const queryParams = { ...params };
|
|
1659
|
+
if (Array.isArray(params.user_id)) {
|
|
1660
|
+
queryParams.user_id = JSON.stringify(params.user_id);
|
|
1661
|
+
}
|
|
1662
|
+
if (Array.isArray(params.email)) {
|
|
1663
|
+
queryParams.email = JSON.stringify(params.email);
|
|
1664
|
+
}
|
|
1665
|
+
return queryParams;
|
|
1666
|
+
}
|
|
1667
|
+
var memberHandlers = {
|
|
1668
|
+
async createMember(params) {
|
|
1669
|
+
const requestBody = buildRequestBodyFor("create-member", params);
|
|
1670
|
+
const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.CREATE_MEMBER}`, requestBody);
|
|
1671
|
+
if (response.data.code === 0) {
|
|
1672
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1673
|
+
}
|
|
1674
|
+
throw new Error(response.data.msg);
|
|
1675
|
+
},
|
|
1676
|
+
async updateMember(params) {
|
|
1677
|
+
const requestBody = buildRequestBodyFor("update-member", params);
|
|
1678
|
+
const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.UPDATE_MEMBER}`, requestBody);
|
|
1679
|
+
if (response.data.code === 0) {
|
|
1680
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1681
|
+
}
|
|
1682
|
+
throw new Error(response.data.msg);
|
|
1683
|
+
},
|
|
1684
|
+
async resetMemberPassword(params) {
|
|
1685
|
+
const requestBody = buildRequestBodyFor("reset-member-password", params);
|
|
1686
|
+
const response = await getApiClient().post(
|
|
1687
|
+
`${getLocalApiBase()}${API_ENDPOINTS.RESET_MEMBER_PASSWORD}`,
|
|
1688
|
+
requestBody
|
|
1689
|
+
);
|
|
1690
|
+
if (response.data.code === 0) {
|
|
1691
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1692
|
+
}
|
|
1693
|
+
throw new Error(response.data.msg);
|
|
1694
|
+
},
|
|
1695
|
+
async deleteMember(params) {
|
|
1696
|
+
const requestBody = buildRequestBodyFor("delete-member", params);
|
|
1697
|
+
const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.DELETE_MEMBER}`, requestBody);
|
|
1698
|
+
if (response.data.code === 0) {
|
|
1699
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1700
|
+
}
|
|
1701
|
+
throw new Error(response.data.msg);
|
|
1702
|
+
},
|
|
1703
|
+
async getMemberList(params) {
|
|
1704
|
+
const query = buildQueryParamsFor("get-member-list", serializeMemberListQuery(params));
|
|
1705
|
+
const response = await getApiClient().get(`${getLocalApiBase()}${API_ENDPOINTS.GET_MEMBER_LIST}`, { params: query });
|
|
1706
|
+
if (response.data.code === 0) {
|
|
1707
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1708
|
+
}
|
|
1709
|
+
throw new Error(response.data.msg);
|
|
1710
|
+
},
|
|
1711
|
+
async getMemberGroupList(params) {
|
|
1712
|
+
const query = buildQueryParamsFor("get-member-group-list", params);
|
|
1713
|
+
const response = await getApiClient().get(`${getLocalApiBase()}${API_ENDPOINTS.GET_MEMBER_GROUP_LIST}`, {
|
|
1714
|
+
params: query
|
|
1715
|
+
});
|
|
1716
|
+
if (response.data.code === 0) {
|
|
1717
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1718
|
+
}
|
|
1719
|
+
throw new Error(response.data.msg);
|
|
1720
|
+
}
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1482
1723
|
// ../core/src/handlers/application.ts
|
|
1483
1724
|
var applicationHandlers = {
|
|
1484
1725
|
async checkStatus() {
|
|
@@ -1598,7 +1839,7 @@ var tagHandlers = {
|
|
|
1598
1839
|
|
|
1599
1840
|
// ../core/src/handlers/automation.ts
|
|
1600
1841
|
var import_path2 = __toESM(require("path"));
|
|
1601
|
-
var
|
|
1842
|
+
var import_os2 = __toESM(require("os"));
|
|
1602
1843
|
|
|
1603
1844
|
// ../core/src/utils/browserBase.ts
|
|
1604
1845
|
var import_playwright_core = require("playwright-core");
|
|
@@ -1651,7 +1892,7 @@ var BrowserBase = class {
|
|
|
1651
1892
|
var browserBase_default = new BrowserBase();
|
|
1652
1893
|
|
|
1653
1894
|
// ../core/src/handlers/automation.ts
|
|
1654
|
-
var defaultDownloadsPath = import_path2.default.join(
|
|
1895
|
+
var defaultDownloadsPath = import_path2.default.join(import_os2.default.homedir(), "Downloads");
|
|
1655
1896
|
|
|
1656
1897
|
// ../core/src/handlers/kernel.ts
|
|
1657
1898
|
var kernelHandlers = {
|
|
@@ -1805,6 +2046,7 @@ var randomUaConfigSchema = import_zod.z.object({
|
|
|
1805
2046
|
"Mac OS X 13",
|
|
1806
2047
|
"Mac OS X 14",
|
|
1807
2048
|
"Mac OS X 15",
|
|
2049
|
+
"Mac OS X 26",
|
|
1808
2050
|
"Mac OS X",
|
|
1809
2051
|
"Windows",
|
|
1810
2052
|
"iOS",
|
|
@@ -2212,7 +2454,7 @@ var schemas = {
|
|
|
2212
2454
|
ipchecker: import_zod.z.enum(["ip2location", "ipapi", "ipfoxy"]).optional().describe("IP query channel"),
|
|
2213
2455
|
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
2456
|
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({
|
|
2457
|
+
fingerprint_config: fingerprintConfigSchema.optional().default({ browser_kernel_config: { version: "latest", type: "chrome" } }),
|
|
2216
2458
|
platform_account: platformAccountSchema
|
|
2217
2459
|
}).strict(),
|
|
2218
2460
|
updateBrowserSchema: import_zod.z.object({
|
|
@@ -2332,6 +2574,49 @@ var schemas = {
|
|
|
2332
2574
|
page_size: import_zod.z.number().optional().describe("The size of the page, max is 100, default is 10"),
|
|
2333
2575
|
page: import_zod.z.number().optional().describe("The page of the group, default is 1")
|
|
2334
2576
|
}).strict(),
|
|
2577
|
+
createMemberSchema: import_zod.z.object({
|
|
2578
|
+
user_group_id: import_zod.z.string().max(50).describe("Member group / role id. Use get-member-group-list to obtain it"),
|
|
2579
|
+
name: import_zod.z.string().max(50).optional().describe("Member display name, max 50 characters"),
|
|
2580
|
+
email: import_zod.z.string().max(70).describe("Member email, max 70 characters"),
|
|
2581
|
+
password: import_zod.z.string().min(8).max(50).describe("Login password in plaintext, 8 to 50 characters. The Local API hashes it before storing"),
|
|
2582
|
+
identity: import_zod.z.union([import_zod.z.literal(2), import_zod.z.literal(3), import_zod.z.literal(4)]).describe("Role type: 2 admin, 3 manager, 4 staff"),
|
|
2583
|
+
manager: import_zod.z.string().max(15).optional().describe("Direct manager user_id. Required when identity is 4 (staff)"),
|
|
2584
|
+
member: import_zod.z.array(import_zod.z.string()).max(300).optional().describe("Direct subordinate user_id list, max 300. Used when identity is 2 or 3"),
|
|
2585
|
+
authorized_group: import_zod.z.array(import_zod.z.string()).max(1500).optional().describe("Authorized browser group ids, max 1500. Empty array means no groups"),
|
|
2586
|
+
profile_limit: import_zod.z.number().optional().describe("Profile quota for this member"),
|
|
2587
|
+
remark: import_zod.z.string().max(100).optional().describe("Remark, max 100 characters")
|
|
2588
|
+
}).strict(),
|
|
2589
|
+
updateMemberSchema: import_zod.z.object({
|
|
2590
|
+
user_id: import_zod.z.string().max(50).describe("Member user_id to update"),
|
|
2591
|
+
user_group_id: import_zod.z.string().max(50).optional().describe("Member group / role id"),
|
|
2592
|
+
name: import_zod.z.string().max(50).optional().describe("Member display name, max 50 characters. Empty string clears the name"),
|
|
2593
|
+
email: import_zod.z.string().max(70).optional().describe("Member email, max 70 characters"),
|
|
2594
|
+
identity: import_zod.z.union([import_zod.z.literal(2), import_zod.z.literal(3), import_zod.z.literal(4)]).optional().describe("Role type: 2 admin, 3 manager, 4 staff"),
|
|
2595
|
+
manager: import_zod.z.string().max(15).optional().describe("Direct manager user_id. Empty string clears the manager"),
|
|
2596
|
+
member: import_zod.z.array(import_zod.z.string()).max(300).optional().describe("Direct subordinate user_id list, max 300. Empty array clears subordinates"),
|
|
2597
|
+
authorized_group: import_zod.z.array(import_zod.z.string()).max(1500).optional().describe("Authorized browser group ids, max 1500. Omit to keep current groups. Empty array plus group_update_type 1 (default) replaces/clears; 2 appends/keeps"),
|
|
2598
|
+
group_update_type: import_zod.z.union([import_zod.z.literal(1), import_zod.z.literal(2)]).optional().describe("How authorized_group is applied: 1 replace (default), 2 append"),
|
|
2599
|
+
profile_limit: import_zod.z.number().optional().describe("Profile quota for this member"),
|
|
2600
|
+
remark: import_zod.z.string().max(100).optional().describe("Remark, max 100 characters. Empty string clears the remark")
|
|
2601
|
+
}).strict(),
|
|
2602
|
+
resetMemberPasswordSchema: import_zod.z.object({
|
|
2603
|
+
user_id: import_zod.z.string().max(50).describe("Member user_id whose password will be reset"),
|
|
2604
|
+
unbind_phone: import_zod.z.union([import_zod.z.literal(0), import_zod.z.literal(1)]).optional().describe("Whether to unbind the member phone: 1 unbind, 0 keep. Default 0")
|
|
2605
|
+
}).strict(),
|
|
2606
|
+
deleteMemberSchema: import_zod.z.object({
|
|
2607
|
+
user_id: import_zod.z.string().max(50).describe("Member user_id to delete")
|
|
2608
|
+
}).strict(),
|
|
2609
|
+
getMemberListSchema: import_zod.z.object({
|
|
2610
|
+
user_group_id: import_zod.z.string().max(50).optional().describe("Filter by member group / role id"),
|
|
2611
|
+
user_id: import_zod.z.array(import_zod.z.string()).max(50).optional().describe('Filter by member user_id list, max 50. Example: ["1001","1002"]'),
|
|
2612
|
+
email: import_zod.z.array(import_zod.z.string()).max(50).optional().describe('Filter by member email list, max 50. Example: ["a@b.com"]'),
|
|
2613
|
+
page: import_zod.z.number().int().min(1).max(1e7).optional().describe("Page number, default 1"),
|
|
2614
|
+
limit: import_zod.z.number().int().min(1).max(2e3).optional().describe("Page size, default 1, max 2000")
|
|
2615
|
+
}).strict(),
|
|
2616
|
+
getMemberGroupListSchema: import_zod.z.object({
|
|
2617
|
+
page: import_zod.z.number().int().min(1).max(1e7).optional().describe("Page number, default 1"),
|
|
2618
|
+
limit: import_zod.z.number().int().min(1).max(2e3).optional().describe("Page size, default 1, max 2000")
|
|
2619
|
+
}).strict(),
|
|
2335
2620
|
getApplicationListSchema: import_zod.z.object({
|
|
2336
2621
|
category_id: import_zod.z.string().optional().describe("Extension category_id"),
|
|
2337
2622
|
page: import_zod.z.number().optional().describe("Page number, default 1"),
|
|
@@ -2632,6 +2917,36 @@ var STATELESS_HANDLERS = {
|
|
|
2632
2917
|
description: buildCliCommandDescription("get-group-list", "Get the list of groups"),
|
|
2633
2918
|
paramsDescription: schemaParamsDescription(schemas.getGroupListSchema, "get-group-list")
|
|
2634
2919
|
},
|
|
2920
|
+
"create-member": {
|
|
2921
|
+
fn: memberHandlers.createMember,
|
|
2922
|
+
description: buildCliCommandDescription("create-member", "Create a team member"),
|
|
2923
|
+
paramsDescription: schemaParamsDescription(schemas.createMemberSchema, "create-member")
|
|
2924
|
+
},
|
|
2925
|
+
"update-member": {
|
|
2926
|
+
fn: memberHandlers.updateMember,
|
|
2927
|
+
description: buildCliCommandDescription("update-member", "Update a team member"),
|
|
2928
|
+
paramsDescription: schemaParamsDescription(schemas.updateMemberSchema, "update-member")
|
|
2929
|
+
},
|
|
2930
|
+
"reset-member-password": {
|
|
2931
|
+
fn: memberHandlers.resetMemberPassword,
|
|
2932
|
+
description: buildCliCommandDescription("reset-member-password", "Reset a team member password"),
|
|
2933
|
+
paramsDescription: schemaParamsDescription(schemas.resetMemberPasswordSchema, "reset-member-password")
|
|
2934
|
+
},
|
|
2935
|
+
"delete-member": {
|
|
2936
|
+
fn: memberHandlers.deleteMember,
|
|
2937
|
+
description: buildCliCommandDescription("delete-member", "Delete a team member"),
|
|
2938
|
+
paramsDescription: schemaParamsDescription(schemas.deleteMemberSchema, "delete-member")
|
|
2939
|
+
},
|
|
2940
|
+
"get-member-list": {
|
|
2941
|
+
fn: memberHandlers.getMemberList,
|
|
2942
|
+
description: buildCliCommandDescription("get-member-list", "Get the list of team members"),
|
|
2943
|
+
paramsDescription: schemaParamsDescription(schemas.getMemberListSchema, "get-member-list")
|
|
2944
|
+
},
|
|
2945
|
+
"get-member-group-list": {
|
|
2946
|
+
fn: memberHandlers.getMemberGroupList,
|
|
2947
|
+
description: buildCliCommandDescription("get-member-group-list", "Get the list of member groups"),
|
|
2948
|
+
paramsDescription: schemaParamsDescription(schemas.getMemberGroupListSchema, "get-member-group-list")
|
|
2949
|
+
},
|
|
2635
2950
|
"check-status": {
|
|
2636
2951
|
fn: applicationHandlers.checkStatus,
|
|
2637
2952
|
description: buildCliCommandDescription(
|
|
@@ -3050,9 +3365,6 @@ var startChild = (type) => {
|
|
|
3050
3365
|
}
|
|
3051
3366
|
if (text === "restart") {
|
|
3052
3367
|
child && child.kill("SIGKILL");
|
|
3053
|
-
store.setStoreValue("status", "restarting");
|
|
3054
|
-
startChild("2").catch(() => {
|
|
3055
|
-
});
|
|
3056
3368
|
}
|
|
3057
3369
|
if (text.indexOf("INTRANET_$$_") > -1) {
|
|
3058
3370
|
const arr = text.split("_$$_");
|
|
@@ -3084,18 +3396,9 @@ var startChild = (type) => {
|
|
|
3084
3396
|
process.exit(0);
|
|
3085
3397
|
});
|
|
3086
3398
|
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
|
-
}
|
|
3399
|
+
await browsersKill();
|
|
3400
|
+
store.clear();
|
|
3401
|
+
removePidFile();
|
|
3099
3402
|
});
|
|
3100
3403
|
timer = setTimeout(() => {
|
|
3101
3404
|
child && child.kill("SIGKILL");
|