adspower-browser 2.1.3 → 2.1.4-beta
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 +1 -1
- package/cli/index.js +47 -7
- package/cwd/lib/main.min.js +2 -2
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -143,7 +143,7 @@ ads create-browser '{"group_id":"0","user_proxy_config":{"proxy_soft":"no_proxy"
|
|
|
143
143
|
ads update-browser '{"profile_id":"...",...}' # profile_id required
|
|
144
144
|
ads delete-browser '{"profile_id":["..."]}' # profile_id required
|
|
145
145
|
ads get-recycle-bin-list '{}' # page?, limit? (1-100). Omit either to use the Local API backend default. Last 30 days only
|
|
146
|
-
ads restore-recycle-bin '{"profile_id":"
|
|
146
|
+
ads restore-recycle-bin '{"profile_id":["id1","id2"],"group_id":"123"}' # profile_id[] or profile_no[], group_id required
|
|
147
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?
|
|
148
148
|
ads get-opened-browser # No params
|
|
149
149
|
```
|
package/cli/index.js
CHANGED
|
@@ -833,6 +833,14 @@ var LOCAL_API_CONTRACTS = {
|
|
|
833
833
|
ipchecker: { apiName: "ipchecker", location: "body" }
|
|
834
834
|
}
|
|
835
835
|
},
|
|
836
|
+
"get-dynamic-proxy-traffic": {
|
|
837
|
+
method: "POST",
|
|
838
|
+
path: "/api/v2/proxy/dynamic-proxy-traffic",
|
|
839
|
+
params: {
|
|
840
|
+
start_date: { apiName: "start_date", location: "body" },
|
|
841
|
+
end_date: { apiName: "end_date", location: "body" }
|
|
842
|
+
}
|
|
843
|
+
},
|
|
836
844
|
"get-proxy-list": {
|
|
837
845
|
method: "POST",
|
|
838
846
|
path: "/api/v2/proxy-list/list",
|
|
@@ -976,6 +984,7 @@ var API_ENDPOINTS = {
|
|
|
976
984
|
GET_BROWSER_ACTIVE: LOCAL_API_CONTRACTS["get-browser-active"].path,
|
|
977
985
|
CREATE_PROXY: LOCAL_API_CONTRACTS["create-proxy"].path,
|
|
978
986
|
UPDATE_PROXY: LOCAL_API_CONTRACTS["update-proxy"].path,
|
|
987
|
+
GET_DYNAMIC_PROXY_TRAFFIC: LOCAL_API_CONTRACTS["get-dynamic-proxy-traffic"].path,
|
|
979
988
|
GET_PROXY_LIST: LOCAL_API_CONTRACTS["get-proxy-list"].path,
|
|
980
989
|
DELETE_PROXY: LOCAL_API_CONTRACTS["delete-proxy"].path,
|
|
981
990
|
GET_OPENED_BROWSER: LOCAL_API_CONTRACTS["get-opened-browser"].path,
|
|
@@ -1058,8 +1067,8 @@ var TOOL_INTENT_BY_NAME = {
|
|
|
1058
1067
|
triggersZh: "\u56DE\u6536\u7AD9,\u5DF2\u5220\u9664\u73AF\u5883,\u6700\u8FD1\u5220\u9664,\u5783\u573E\u6876\u5217\u8868"
|
|
1059
1068
|
},
|
|
1060
1069
|
"restore-recycle-bin": {
|
|
1061
|
-
intentEn: "Restore one deleted browser
|
|
1062
|
-
intentZh: "\u628A\u56DE\u6536\u7AD9\u91CC\u7684\u4E00\u4E2A\u73AF\u5883\u6062\u590D\u5230\u6307\u5B9A\u5206\u7EC4\u3002",
|
|
1070
|
+
intentEn: "Restore one or more deleted browser profiles from the recycle bin into a target group.",
|
|
1071
|
+
intentZh: "\u628A\u56DE\u6536\u7AD9\u91CC\u7684\u4E00\u4E2A\u6216\u591A\u4E2A\u73AF\u5883\u6062\u590D\u5230\u6307\u5B9A\u5206\u7EC4\u3002",
|
|
1063
1072
|
triggersEn: "restore profile, recover deleted browser, undelete environment",
|
|
1064
1073
|
triggersZh: "\u6062\u590D\u73AF\u5883,\u8FD8\u539F\u56DE\u6536\u7AD9,\u627E\u56DE\u5DF2\u5220\u9664\u73AF\u5883"
|
|
1065
1074
|
},
|
|
@@ -1207,6 +1216,12 @@ var TOOL_INTENT_BY_NAME = {
|
|
|
1207
1216
|
triggersEn: "edit proxy, change proxy host",
|
|
1208
1217
|
triggersZh: "\u4FEE\u6539\u4EE3\u7406,\u66F4\u65B0\u4EE3\u7406"
|
|
1209
1218
|
},
|
|
1219
|
+
"get-dynamic-proxy-traffic": {
|
|
1220
|
+
intentEn: "Query and return dynamic proxy traffic for the current team, including available traffic, traffic package expiration dates, and daily traffic consumption for the current month or a specified date range.",
|
|
1221
|
+
intentZh: "\u67E5\u8BE2\u5E76\u8FD4\u56DE\u5F53\u524D\u56E2\u961F\u52A8\u6001\u4EE3\u7406\u7684\u6D41\u91CF\u4FE1\u606F\uFF0C\u5305\u62EC\u53EF\u7528\u6D41\u91CF\u3001\u6D41\u91CF\u5305\u5230\u671F\u65E5\u671F\uFF0C\u4EE5\u53CA\u672C\u6708\u6216\u6307\u5B9A\u65E5\u671F\u8303\u56F4\u5185\u7684\u6BCF\u65E5\u6D41\u91CF\u6D88\u8017\u60C5\u51B5\u3002",
|
|
1222
|
+
triggersEn: "dynamic proxy traffic, available traffic, traffic package expiration, daily traffic consumption",
|
|
1223
|
+
triggersZh: "\u52A8\u6001\u4EE3\u7406\u6D41\u91CF,\u53EF\u7528\u6D41\u91CF,\u6D41\u91CF\u5305\u5230\u671F\u65E5\u671F,\u6BCF\u65E5\u6D41\u91CF\u6D88\u8017"
|
|
1224
|
+
},
|
|
1210
1225
|
"get-proxy-list": {
|
|
1211
1226
|
intentEn: "List proxies with filters/pagination.",
|
|
1212
1227
|
intentZh: "\u5206\u9875/\u6761\u4EF6\u67E5\u8BE2\u4EE3\u7406\u5217\u8868\u3002",
|
|
@@ -1388,7 +1403,7 @@ function buildRequestBodyFor(command, params) {
|
|
|
1388
1403
|
}
|
|
1389
1404
|
const value = withContractDefault(params[inputName], config2.default);
|
|
1390
1405
|
if (value !== void 0) {
|
|
1391
|
-
requestBody[config2.apiName] = toContractValue(value);
|
|
1406
|
+
requestBody[config2.apiName] = command === "restore-recycle-bin" && (inputName === "profile_id" || inputName === "profile_no") && Array.isArray(value) ? value.join(",") : toContractValue(value);
|
|
1392
1407
|
}
|
|
1393
1408
|
});
|
|
1394
1409
|
return requestBody;
|
|
@@ -1577,9 +1592,17 @@ var browserHandlers = {
|
|
|
1577
1592
|
throw new Error(response.data.msg);
|
|
1578
1593
|
},
|
|
1579
1594
|
async restoreRecycleBin(params) {
|
|
1595
|
+
const _p = params;
|
|
1596
|
+
if (_p.profile_id && Array.isArray(_p.profile_id)) {
|
|
1597
|
+
_p.profile_id = _p.profile_id.join(",");
|
|
1598
|
+
}
|
|
1599
|
+
if (_p.profile_no && Array.isArray(_p.profile_no)) {
|
|
1600
|
+
_p.profile_no = _p.profile_no.join(",");
|
|
1601
|
+
}
|
|
1602
|
+
console.log(_p);
|
|
1580
1603
|
const response = await getApiClient().post(
|
|
1581
1604
|
`${getLocalApiBase()}${API_ENDPOINTS.RESTORE_RECYCLE_BIN}`,
|
|
1582
|
-
buildRequestBodyFor("restore-recycle-bin",
|
|
1605
|
+
buildRequestBodyFor("restore-recycle-bin", _p)
|
|
1583
1606
|
);
|
|
1584
1607
|
if (response.data.code === 0) {
|
|
1585
1608
|
return JSON.stringify(response.data.data, null, 2);
|
|
@@ -1824,6 +1847,14 @@ var proxyHandlers = {
|
|
|
1824
1847
|
}
|
|
1825
1848
|
throw new Error(response.data.msg);
|
|
1826
1849
|
},
|
|
1850
|
+
async getDynamicProxyTraffic(params = {}) {
|
|
1851
|
+
const requestBody = buildRequestBodyFor("get-dynamic-proxy-traffic", params);
|
|
1852
|
+
const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.GET_DYNAMIC_PROXY_TRAFFIC}`, requestBody);
|
|
1853
|
+
if (response.data.code === 0) {
|
|
1854
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
1855
|
+
}
|
|
1856
|
+
throw new Error(response.data.msg);
|
|
1857
|
+
},
|
|
1827
1858
|
async getProxyList(params) {
|
|
1828
1859
|
const requestBody = buildRequestBodyFor("get-proxy-list", params);
|
|
1829
1860
|
const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.GET_PROXY_LIST}`, requestBody);
|
|
@@ -2570,8 +2601,8 @@ var schemas = {
|
|
|
2570
2601
|
limit: import_zod.z.number().int().min(1).max(100).optional().describe("Profiles per page, range 1-100. Omit to use the Local API backend default.")
|
|
2571
2602
|
}).strict(),
|
|
2572
2603
|
restoreRecycleBinSchema: import_zod.z.object({
|
|
2573
|
-
profile_id:
|
|
2574
|
-
profile_no: import_zod.z.string().regex(/^\d+$/, "Profile number must be a numeric string").optional().describe("
|
|
2604
|
+
profile_id: nonEmptyStringArraySchema.optional().describe("Array of one or more profile IDs in the recycle bin. Either profile_id or profile_no is required. If both are provided, profile_id takes priority."),
|
|
2605
|
+
profile_no: import_zod.z.array(import_zod.z.string().regex(/^\d+$/, "Profile number must be a numeric string")).min(1).optional().describe("Array of one or more profile serial numbers in the recycle bin. Either profile_id or profile_no is required. If both are provided, profile_id takes priority."),
|
|
2575
2606
|
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.')
|
|
2576
2607
|
}).strict().refine((data) => data.profile_id || data.profile_no, {
|
|
2577
2608
|
message: "Either profile_id or profile_no must be provided"
|
|
@@ -2710,6 +2741,10 @@ var schemas = {
|
|
|
2710
2741
|
remark: import_zod.z.string().optional().describe("Remark/description for the proxy"),
|
|
2711
2742
|
ipchecker: import_zod.z.enum(["ip2location", "ipapi", "ipfoxy"]).optional().describe("IP checker.")
|
|
2712
2743
|
}).strict(),
|
|
2744
|
+
getDynamicProxyTrafficSchema: import_zod.z.object({
|
|
2745
|
+
start_date: import_zod.z.iso.date().optional().describe("Query start date in YYYY-MM-DD format. Defaults to the first day of the current month in the Local API when omitted"),
|
|
2746
|
+
end_date: import_zod.z.iso.date().optional().describe("Query end date in YYYY-MM-DD format. Defaults to the current date in the Local API when omitted")
|
|
2747
|
+
}).strict(),
|
|
2713
2748
|
getProxyListSchema: import_zod.z.object({
|
|
2714
2749
|
limit: import_zod.z.number().optional().describe("Profiles per page. Number of proxies returned per page, range 1 ~ 200, default is 50"),
|
|
2715
2750
|
page: import_zod.z.number().optional().describe("Page number for results, default is 1"),
|
|
@@ -2895,7 +2930,7 @@ var STATELESS_HANDLERS = {
|
|
|
2895
2930
|
},
|
|
2896
2931
|
"restore-recycle-bin": {
|
|
2897
2932
|
fn: browserHandlers.restoreRecycleBin,
|
|
2898
|
-
description: buildCliCommandDescription("restore-recycle-bin", "Restore
|
|
2933
|
+
description: buildCliCommandDescription("restore-recycle-bin", "Restore one or more deleted browser profiles from the recycle bin into a group"),
|
|
2899
2934
|
paramsDescription: schemaParamsDescription(schemas.restoreRecycleBinSchema, "restore-recycle-bin")
|
|
2900
2935
|
},
|
|
2901
2936
|
"get-browser-list": {
|
|
@@ -3045,6 +3080,11 @@ var STATELESS_HANDLERS = {
|
|
|
3045
3080
|
description: buildCliCommandDescription("update-proxy", "Update the proxy"),
|
|
3046
3081
|
paramsDescription: schemaParamsDescription(schemas.updateProxySchema, "update-proxy")
|
|
3047
3082
|
},
|
|
3083
|
+
"get-dynamic-proxy-traffic": {
|
|
3084
|
+
fn: proxyHandlers.getDynamicProxyTraffic,
|
|
3085
|
+
description: buildCliCommandDescription("get-dynamic-proxy-traffic", "Query and return dynamic proxy traffic for the current team, including available traffic, traffic package expiration dates, and daily traffic consumption for the current month or a specified date range."),
|
|
3086
|
+
paramsDescription: schemaParamsDescription(schemas.getDynamicProxyTrafficSchema, "get-dynamic-proxy-traffic")
|
|
3087
|
+
},
|
|
3048
3088
|
"get-proxy-list": {
|
|
3049
3089
|
fn: proxyHandlers.getProxyList,
|
|
3050
3090
|
description: buildCliCommandDescription("get-proxy-list", "Get the list of proxies"),
|