siluzan-tso-cli 1.0.0-beta.31 → 1.0.0-beta.32
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/dist/index.js +29 -10
- package/dist/skill/SKILL.md +1 -0
- package/dist/skill/_meta.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
|
|
|
20
20
|
siluzan-tso init --force # 强制覆盖已存在文件
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
> **注意**:当前为测试版(1.0.0-beta.
|
|
23
|
+
> **注意**:当前为测试版(1.0.0-beta.32),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
|
|
24
24
|
|
|
25
25
|
| 助手 | 建议 `--ai` |
|
|
26
26
|
|------|-------------|
|
package/dist/index.js
CHANGED
|
@@ -802,11 +802,16 @@ function findDpByUrl(nodes, targetUrl) {
|
|
|
802
802
|
}
|
|
803
803
|
return void 0;
|
|
804
804
|
}
|
|
805
|
-
async function fetchDataPermission(mainApiUrl,
|
|
805
|
+
async function fetchDataPermission(mainApiUrl, auth) {
|
|
806
806
|
const url = `${mainApiUrl}/command/menu/GetUserPermissions`;
|
|
807
|
+
const authHeaders = auth.apiKey ? { "x-api-key": auth.apiKey } : { Authorization: `Bearer ${auth.authToken}` };
|
|
807
808
|
try {
|
|
808
809
|
const res = await fetch(url, {
|
|
809
|
-
headers: {
|
|
810
|
+
headers: {
|
|
811
|
+
"Content-Type": "application/json",
|
|
812
|
+
"Accept-Language": "zh-CN",
|
|
813
|
+
...authHeaders
|
|
814
|
+
}
|
|
810
815
|
});
|
|
811
816
|
if (!res.ok) return "";
|
|
812
817
|
const json = await res.json();
|
|
@@ -1549,7 +1554,7 @@ async function runListAccounts(opts) {
|
|
|
1549
1554
|
process.exit(1);
|
|
1550
1555
|
}
|
|
1551
1556
|
}
|
|
1552
|
-
if (items.length > 0) {
|
|
1557
|
+
if (items.length > 0 && !opts.quick) {
|
|
1553
1558
|
const groups = /* @__PURE__ */ new Map();
|
|
1554
1559
|
for (const item of items) {
|
|
1555
1560
|
const id = item.ma.mediaCustomerId;
|
|
@@ -1638,9 +1643,13 @@ async function runListAccounts(opts) {
|
|
|
1638
1643
|
return;
|
|
1639
1644
|
}
|
|
1640
1645
|
const totalInfo = total !== void 0 ? `\uFF0C\u5171 ${total} \u6761` : "";
|
|
1641
|
-
|
|
1642
|
-
\u5E7F\u544A\u8D26\u6237\u5217\u8868\uFF08\u7B2C ${page} \u9875\uFF0C\u672C\u9875 ${items.length} \u6761${totalInfo}\uFF09
|
|
1643
|
-
|
|
1646
|
+
let listHeader = `
|
|
1647
|
+
\u5E7F\u544A\u8D26\u6237\u5217\u8868\uFF08\u7B2C ${page} \u9875\uFF0C\u672C\u9875 ${items.length} \u6761${totalInfo}\uFF09`;
|
|
1648
|
+
if (opts.quick) {
|
|
1649
|
+
listHeader += "\n \uFF08\u5FEB\u901F\u6A21\u5F0F\uFF1A\u672A\u5408\u5E76\u4F59\u989D\u3001\u6295\u653E\u6D88\u8017\u4E0E Arit \u5F97\u5206\uFF1B\u8868\u4E2D\u5BF9\u5E94\u5217\u4E3A\u300C-\u300D\u3002TikTok/Meta \u4ECD\u5408\u5E76\u5217\u8868\u63A5\u53E3\u540C\u5305\u5185\u7684 adList\u3002\uFF09";
|
|
1650
|
+
}
|
|
1651
|
+
listHeader += "\n";
|
|
1652
|
+
console.log(listHeader);
|
|
1644
1653
|
if (items.length === 0) {
|
|
1645
1654
|
console.log("\u6682\u65E0\u5E7F\u544A\u8D26\u6237\u6570\u636E\u3002\n");
|
|
1646
1655
|
return;
|
|
@@ -3735,7 +3744,7 @@ import * as os6 from "os";
|
|
|
3735
3744
|
async function ensureDataPermission(config) {
|
|
3736
3745
|
if (config.dataPermission) return config;
|
|
3737
3746
|
if (!config.mainApiUrl) return config;
|
|
3738
|
-
const dp = await fetchDataPermission(config.mainApiUrl, config
|
|
3747
|
+
const dp = await fetchDataPermission(config.mainApiUrl, config);
|
|
3739
3748
|
if (!dp) return config;
|
|
3740
3749
|
const configPath = path7.join(os6.homedir(), ".siluzan", "config.json");
|
|
3741
3750
|
try {
|
|
@@ -8550,12 +8559,13 @@ async function uploadAttachment(filePath, apiBaseUrl, config, verbose) {
|
|
|
8550
8559
|
const form = new FormData();
|
|
8551
8560
|
form.append("file", new Blob([fileBuffer], { type: mimeType }), fileName);
|
|
8552
8561
|
const uploadUrl = `${apiBaseUrl}/command/attachment`;
|
|
8562
|
+
const authHeaders = config.apiKey ? { "x-api-key": config.apiKey } : { Authorization: `Bearer ${config.authToken}` };
|
|
8553
8563
|
const res = await fetch(uploadUrl, {
|
|
8554
8564
|
method: "POST",
|
|
8555
8565
|
headers: {
|
|
8556
|
-
|
|
8566
|
+
"Accept-Language": "zh-CN",
|
|
8567
|
+
...authHeaders,
|
|
8557
8568
|
Datapermission: config.dataPermission ?? ""
|
|
8558
|
-
// 注意:不手动设置 Content-Type,让 fetch 自动添加含 boundary 的值
|
|
8559
8569
|
},
|
|
8560
8570
|
body: form
|
|
8561
8571
|
});
|
|
@@ -9465,7 +9475,15 @@ program.command("list-accounts").description("\u67E5\u8BE2\u5E7F\u544A\u8D26\u62
|
|
|
9465
9475
|
"-s, --status <status>",
|
|
9466
9476
|
"\u8D26\u6237\u72B6\u6001\uFF1Anormal\uFF08\u6B63\u5E38\uFF09| invalid\uFF08\u5931\u6548\uFF09| all\uFF08\u5168\u90E8\uFF0C\u9ED8\u8BA4\uFF09",
|
|
9467
9477
|
"all"
|
|
9468
|
-
).option("-p, --page <n>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09", parseInt).option("--page-size <n>", "\u6BCF\u9875\u6570\u91CF\uFF08\u9ED8\u8BA4 20\uFF09", parseInt).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
9478
|
+
).option("-p, --page <n>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09", parseInt).option("--page-size <n>", "\u6BCF\u9875\u6570\u91CF\uFF08\u9ED8\u8BA4 20\uFF09", parseInt).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
9479
|
+
"--json",
|
|
9480
|
+
"\u4EE5 JSON \u8F93\u51FA\uFF08\u542B\u5206\u9875\u4FE1\u5C01\u4E0E items\uFF1B\u9ED8\u8BA4\u4ECD\u4F1A\u5408\u5E76\u4F59\u989D/\u6D88\u8017/Arit\uFF0C\u4E0E\u8868\u683C\u4E00\u81F4\u3002\u52A0 --quick \u5219 items \u4EC5\u542B\u5217\u8868\u63A5\u53E3\u5B57\u6BB5\uFF09",
|
|
9481
|
+
false
|
|
9482
|
+
).option(
|
|
9483
|
+
"--quick",
|
|
9484
|
+
"\u5FEB\u901F\u6A21\u5F0F\uFF1A\u53EA\u8BF7\u6C42\u8D26\u6237\u5217\u8868\u63A5\u53E3\uFF0C\u4E0D\u518D\u5E76\u884C\u62C9\u53D6\u4F59\u989D\uFF08GetMediaAccountInfo\uFF09\u3001\u6295\u653E\u6982\u89C8\uFF08accountsoverview\uFF09\u3001ARIT \u8BCA\u65AD\u5F97\u5206\uFF1B\u8BF7\u6C42\u66F4\u5C11\u3001\u8FD4\u56DE\u66F4\u5FEB\u3002\u8868\u683C\u4E0E JSON \u4E2D\u4F59\u989D\u3001\u6D88\u8017\u3001\u5C55\u793A/\u70B9\u51FB/\u8F6C\u5316/CPC\u3001Arit \u7B49\u5C06\u4E3A\u7A7A\u6216\u300C-\u300D\u3002TikTok/Meta \u5217\u8868\u54CD\u5E94\u5185\u7684 adList \u4ECD\u4F1A\u6309\u7F51\u9875\u903B\u8F91\u5408\u5E76\u5230\u540C\u6761\u8BB0\u5F55\u3002",
|
|
9485
|
+
false
|
|
9486
|
+
).option(
|
|
9469
9487
|
"--unicode",
|
|
9470
9488
|
"\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08cli-table3\uFF09\uFF1B\u9ED8\u8BA4 ASCII +-|",
|
|
9471
9489
|
false
|
|
@@ -9482,6 +9500,7 @@ program.command("list-accounts").description("\u67E5\u8BE2\u5E7F\u544A\u8D26\u62
|
|
|
9482
9500
|
page: opts.page,
|
|
9483
9501
|
pageSize: opts.pageSize,
|
|
9484
9502
|
json: opts.json,
|
|
9503
|
+
quick: opts.quick,
|
|
9485
9504
|
unicode: opts.unicode,
|
|
9486
9505
|
verbose: opts.verbose
|
|
9487
9506
|
});
|
package/dist/skill/SKILL.md
CHANGED
|
@@ -73,6 +73,7 @@ description: >-
|
|
|
73
73
|
| TSO 首页(网页) | `config show` 取 `webUrl` → `{webUrl}/v3/foreign_trade/tso/home` |
|
|
74
74
|
| 查广告主组(TikTok 等取 magKey) | `siluzan-tso open-account list-groups` |
|
|
75
75
|
| Google 开户(脚本) | `siluzan-tso open-account google --company "…" --promotion-link "…" --promotion-type b2c ...`(**无需 magKey**) |
|
|
76
|
+
|
|
76
77
|
| Google 开户时区列表 | `siluzan-tso open-account google-timezones`(可加 `--keyword`) |
|
|
77
78
|
| TikTok 开户时区列表 | `siluzan-tso open-account tiktok-timezones`(可加 `--keyword`) |
|
|
78
79
|
| TikTok 行业列表 | `siluzan-tso open-account tiktok-industries`(两级结构,传叶子节点 ID) |
|
package/dist/skill/_meta.json
CHANGED