bukesiyi-cli 0.5.0 → 0.6.0
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 +43 -1
- package/dist/main.js +46 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,10 +28,52 @@ buke web logout
|
|
|
28
28
|
|
|
29
29
|
`delivery.list` 需要 `kind` 和 `sourceId`,示例中的项目编号要换成自己的短剧项目编号。
|
|
30
30
|
|
|
31
|
-
登录密码使用隐藏终端输入、管道或 `BUKE_PASSWORD`,不写命令参数。`web operations --json` 返回固定操作编号、方法、路径、正文类型和适用限制。路径参数通过 `--params` JSON 文件提供,查询条件用 `--query`,正文用 `--data`;原文件上传用 `--file`,`multipart` 表单用 `--files` 指定真实字段名(如 `{"mask":"./mask.png"}`,单文件也可用 `--file`,按目录自动选择字段名);单文件按目录策略限制:图片 15 MiB、文档 30 MiB、允许音视频的附件 90 MiB
|
|
31
|
+
登录密码使用隐藏终端输入、管道或 `BUKE_PASSWORD`,不写命令参数。`web operations --json` 返回固定操作编号、方法、路径、正文类型和适用限制。路径参数通过 `--params` JSON 文件提供,查询条件用 `--query`,正文用 `--data`;原文件上传用 `--file`,`multipart` 表单用 `--files` 指定真实字段名(如 `{"mask":"./mask.png"}`,单文件也可用 `--file`,按目录自动选择字段名);单文件按目录策略限制:图片 15 MiB、文档 30 MiB、允许音视频的附件 90 MiB、短剧配音录音 20 MiB、语音转文字 2 MiB、蒙版 4 MiB;表单总量最多 256 MiB。业务头用 `--headers <JSON文件>`,仅允许目录声明的字段(如录音的 `X-Script-Fingerprint`),不能覆盖认证或工作区。下载用 `--out <新文件>`,已有文件不会覆盖。签发 API 密钥、分享链接和下载凭证必须指定 `--out`;真实响应只写入权限为 0600 的文件,终端输出脱敏结果。
|
|
32
32
|
|
|
33
33
|
网页写操作保留 `webRecovery` 与原请求键。已受理、结果未知和完成分别表示;连接中断后先查询原资源。只有服务端支持幂等重放的操作才能用原键恢复,不支持重放时不会把再次提交伪装成恢复。并发同一请求只提交一次;已完成后的独立串行操作仍可执行。上次结果仍未知时,明确创建另一次尝试须提供新键并再次确认范围。`web logout` 撤销网页会话;`buke logout` 仍只删除本机 API 密钥,不混用两种凭据。
|
|
34
34
|
|
|
35
|
+
### 短信登录与首次设密
|
|
36
|
+
|
|
37
|
+
先查询 `auth.smsLoginStatus`,确认服务开放后发送验证码。手机号和验证码通过私有 JSON 文件或 `--data -` 标准输入提供,勿把验证码、密码写进命令行。短信登录成功后,CLI 校验账号、工作区成员身份、令牌和有效期,将真实会话保存到权限为 0600 的会话文件;失败或不完整响应不会覆盖原会话。终端、`--out` 结果和恢复记录均隐藏验证码、密码及令牌。
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
buke web call auth.smsLoginStatus --json
|
|
41
|
+
buke web call auth.sendLoginSms --data phone.json --yes --json
|
|
42
|
+
buke web call auth.loginWithSms --data sms-login.json --yes --json
|
|
43
|
+
buke web whoami --json
|
|
44
|
+
buke web call auth.sendPasswordSetupSms --yes --json
|
|
45
|
+
buke web call auth.setupPassword --data first-password.json --yes --json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`phone.json` 使用 `phone` 字段;`sms-login.json` 使用 `phone`、`code`;`first-password.json` 使用 `code`、`newPassword`。首次设密仅适用于已登录且尚未设密的账号,验证码发送给当前账号绑定手机号,不签发新会话。一键登录依赖原生手机 SDK,CLI 不提供该入口。
|
|
49
|
+
|
|
50
|
+
### 图文、剪辑与语音入口
|
|
51
|
+
|
|
52
|
+
固定目录补齐以下网页能力,仍使用本人会话和工作区权限;写操作继续要求 `--yes`。
|
|
53
|
+
|
|
54
|
+
| 功能 | 操作编号与参数 |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| 图文引用素材库 | `graphic.attachGraphicRunAsset`:`--params` 提供 `runId`,`--data` 提供 `assetId` |
|
|
57
|
+
| 图文保存到素材库 | `graphic.saveGraphicImageToLibrary`:`--params` 提供 `runId`、`imageId`,`--data` 提供 `kind`(`character` / `scene` / `prop`)和可选 `name` |
|
|
58
|
+
| 图文原图 | `graphic.graphicImageSource`:`runId`、`imageId` |
|
|
59
|
+
| 商品视频素材原图 | `videos.commercialAdImageSource`:`rootRunId`、`assetId` |
|
|
60
|
+
| 商品视频故事板原图 | `videos.commercialAdStoryboardSource`:`rootRunId`、`imageKey` |
|
|
61
|
+
| 商品视频编辑原图 | `videos.commercialAdImageEditSource`:`rootRunId`、`editId` |
|
|
62
|
+
| 剪辑时间线 | `videos.getCommercialAdEditTimeline` 使用 `rootRunId`;`drama.getStoryEditTimeline` 使用 `projectId` |
|
|
63
|
+
| 语音转文字 | `speech.health` 查询服务状态;`speech.transcribe --file <音频> --yes` 提交录音 |
|
|
64
|
+
| 创建入口 | `public.publicCommercialAdInspirations` 查询公开创意参考;`videos.showcaseEntryDefault` 查询当前登录账号的默认设置 |
|
|
65
|
+
|
|
66
|
+
四种原图操作返回二进制原件,必须指定 `--out <新文件>`;原有 `download` 操作继续用于交付文件。下载拒绝未就绪的 JSON 响应,即使输出文件没有扩展名也一样。
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
buke web call graphic.graphicImageSource --params image-params.json --out ./source.png --json
|
|
70
|
+
buke web call videos.getCommercialAdEditTimeline --params video-params.json --json
|
|
71
|
+
buke web call speech.health --json
|
|
72
|
+
buke web call speech.transcribe --file ./recording.webm --yes --json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
语音转文字直接上传原始音频字节,不接受 multipart 字段或 JSON 正文。支持 WAV、MP3、WebM、M4A / MP4、OGG / Opus、AAC、FLAC,最多 2 MiB;服务端校验实际音频内容及 0.5–60 秒时长。它与短剧配音录音上传使用不同限制。
|
|
76
|
+
|
|
35
77
|
## 安装
|
|
36
78
|
|
|
37
79
|
运行环境要求 Node.js 20 或更高版本。
|
package/dist/main.js
CHANGED
|
@@ -427,7 +427,7 @@ async function readNewKey(io) {
|
|
|
427
427
|
|
|
428
428
|
// package.json
|
|
429
429
|
var name = "bukesiyi-cli";
|
|
430
|
-
var version = "0.
|
|
430
|
+
var version = "0.6.0";
|
|
431
431
|
|
|
432
432
|
// src/version.ts
|
|
433
433
|
var PACKAGE_NAME = name;
|
|
@@ -2804,7 +2804,24 @@ var WEB_OPERATIONS = [
|
|
|
2804
2804
|
{ "id": "videos.updateCommercialAdRootSettings", "method": "POST", "path": "/api/showcase-videos/runs/:rootRunId/settings", "source": "web-src/src/lib/api.ts:2363", "group": "videos", "description": "\u5546\u54C1\u89C6\u9891\uFF1A\u63D0\u4EA4\u4F5C\u54C1 / \u8BBE\u7F6E", "body": "json" },
|
|
2805
2805
|
{ "id": "videos.uploadCommercialAdAssetGap", "method": "PUT", "path": "/api/showcase-videos/runs/:rootRunId/gaps/:gapId/upload", "source": "web-src/src/lib/api.ts:2400", "group": "videos", "description": "\u5546\u54C1\u89C6\u9891\uFF1A\u8BBE\u7F6E\u7D20\u6750\u7F3A\u53E3 / \u4E0A\u4F20", "body": "binary", "uploadPolicy": "image" },
|
|
2806
2806
|
{ "id": "videos.voiceCandidates.importSource", "method": "POST", "path": "/api/showcase-videos/runs/:rootRunId/voice-candidates", "source": "web-src/src/lib/api.ts:2161", "group": "videos", "description": "\u4ECE\u5DF2\u6709\u6765\u6E90\u5BFC\u5165\u5546\u54C1\u89C6\u9891\u97F3\u8272\u53C2\u8003", "body": "json" },
|
|
2807
|
-
{ "id": "videos.voiceCandidates.upload", "method": "POST", "path": "/api/showcase-videos/runs/:rootRunId/voice-candidates", "source": "web-src/src/lib/api.ts:2161", "group": "videos", "description": "\u4E0A\u4F20\u5546\u54C1\u89C6\u9891\u97F3\u8272\u53C2\u8003", "body": "multipart", "uploadPolicy": "voiceSource", "uploadField": "file" }
|
|
2807
|
+
{ "id": "videos.voiceCandidates.upload", "method": "POST", "path": "/api/showcase-videos/runs/:rootRunId/voice-candidates", "source": "web-src/src/lib/api.ts:2161", "group": "videos", "description": "\u4E0A\u4F20\u5546\u54C1\u89C6\u9891\u97F3\u8272\u53C2\u8003", "body": "multipart", "uploadPolicy": "voiceSource", "uploadField": "file" },
|
|
2808
|
+
{ "id": "auth.smsLoginStatus", "method": "GET", "path": "/api/auth/sms/login/status", "source": "web-src/src/lib/api.ts:1803", "group": "auth", "description": "\u767B\u5F55\uFF1A\u67E5\u8BE2\u77ED\u4FE1\u767B\u5F55\u662F\u5426\u5F00\u653E", "public": true },
|
|
2809
|
+
{ "id": "auth.sendLoginSms", "method": "POST", "path": "/api/auth/sms/login-code", "source": "web-src/src/lib/api.ts:1805", "group": "auth", "description": "\u767B\u5F55\uFF1A\u53D1\u9001\u767B\u5F55\u9A8C\u8BC1\u7801", "body": "json", "public": true, "exampleBody": { "phone": "\u624B\u673A\u53F7" } },
|
|
2810
|
+
{ "id": "auth.loginWithSms", "method": "POST", "path": "/api/auth/login/sms", "source": "web-src/src/lib/api.ts:1808", "group": "auth", "description": "\u767B\u5F55\uFF1A\u4F7F\u7528\u77ED\u4FE1\u9A8C\u8BC1\u7801\u767B\u5F55\u5E76\u4FDD\u5B58\u4F1A\u8BDD", "body": "json", "public": true, "sessionResponse": true, "exampleBody": { "phone": "\u624B\u673A\u53F7", "code": "\u9A8C\u8BC1\u7801" } },
|
|
2811
|
+
{ "id": "auth.sendPasswordSetupSms", "method": "POST", "path": "/api/auth/password/setup-code", "source": "web-src/src/lib/api.ts:1847", "group": "auth", "description": "\u767B\u5F55\uFF1A\u5411\u5F53\u524D\u8D26\u53F7\u53D1\u9001\u9996\u6B21\u8BBE\u5BC6\u9A8C\u8BC1\u7801", "body": "json" },
|
|
2812
|
+
{ "id": "auth.setupPassword", "method": "POST", "path": "/api/auth/password/setup", "source": "web-src/src/lib/api.ts:1850", "group": "auth", "description": "\u767B\u5F55\uFF1A\u4F7F\u7528\u9A8C\u8BC1\u7801\u9996\u6B21\u8BBE\u7F6E\u5BC6\u7801", "body": "json", "exampleBody": { "code": "\u9A8C\u8BC1\u7801", "newPassword": "\u65B0\u5BC6\u7801" } },
|
|
2813
|
+
{ "id": "graphic.saveGraphicImageToLibrary", "method": "POST", "path": "/api/graphic/runs/:runId/images/:imageId/save-to-library", "source": "web-src/src/lib/api.ts:1477", "group": "graphic", "description": "\u56FE\u6587\uFF1A\u5C06\u56FE\u7247\u4FDD\u5B58\u5230\u672C\u4EBA\u7D20\u6750\u5E93", "body": "json", "exampleBody": { "kind": "scene" } },
|
|
2814
|
+
{ "id": "graphic.attachGraphicRunAsset", "method": "POST", "path": "/api/graphic/runs/:runId/attachments/from-library", "source": "web-src/src/lib/api.ts:1558", "group": "graphic", "description": "\u56FE\u6587\uFF1A\u5F15\u7528\u672C\u4EBA\u7D20\u6750\u5E93\u4E2D\u7684\u7D20\u6750", "body": "json", "exampleBody": { "assetId": "\u7D20\u6750\u7F16\u53F7" } },
|
|
2815
|
+
{ "id": "graphic.graphicImageSource", "method": "GET", "path": "/api/graphic/runs/:runId/images/:imageId/source", "source": "web-src/src/lib/api.ts:1491", "group": "graphic", "description": "\u56FE\u6587\uFF1A\u4FDD\u5B58\u4F9B\u7F16\u8F91\u4F7F\u7528\u7684\u56FE\u7247\u539F\u4EF6\uFF1B\u9700\u8981 --out", "response": "file" },
|
|
2816
|
+
{ "id": "videos.commercialAdImageSource", "method": "GET", "path": "/api/showcase-videos/runs/:rootRunId/images/:assetId/source", "source": "web-src/src/lib/api.ts:2396", "group": "videos", "description": "\u5546\u54C1\u89C6\u9891\uFF1A\u4FDD\u5B58\u4F9B\u7F16\u8F91\u4F7F\u7528\u7684\u7D20\u6750\u539F\u56FE\uFF1B\u9700\u8981 --out", "response": "file" },
|
|
2817
|
+
{ "id": "videos.commercialAdStoryboardSource", "method": "GET", "path": "/api/showcase-videos/runs/:rootRunId/storyboards/:imageKey/source", "source": "web-src/src/lib/api.ts:2396", "group": "videos", "description": "\u5546\u54C1\u89C6\u9891\uFF1A\u4FDD\u5B58\u4F9B\u7F16\u8F91\u4F7F\u7528\u7684\u6545\u4E8B\u677F\u539F\u56FE\uFF1B\u9700\u8981 --out", "response": "file" },
|
|
2818
|
+
{ "id": "videos.commercialAdImageEditSource", "method": "GET", "path": "/api/showcase-videos/runs/:rootRunId/image-edits/:editId/source", "source": "web-src/src/lib/api.ts:2396", "group": "videos", "description": "\u5546\u54C1\u89C6\u9891\uFF1A\u4FDD\u5B58\u4F9B\u7EE7\u7EED\u7F16\u8F91\u4F7F\u7528\u7684\u4FEE\u6539\u540E\u539F\u56FE\uFF1B\u9700\u8981 --out", "response": "file" },
|
|
2819
|
+
{ "id": "videos.getCommercialAdEditTimeline", "method": "GET", "path": "/api/showcase-videos/runs/:rootRunId/edit-timeline", "source": "web-src/src/lib/api.ts:2323", "group": "videos", "description": "\u5546\u54C1\u89C6\u9891\uFF1A\u67E5\u8BE2\u526A\u8F91\u65F6\u95F4\u7EBF" },
|
|
2820
|
+
{ "id": "drama.getStoryEditTimeline", "method": "GET", "path": "/api/projects/:projectId/director/edit-timeline", "source": "web-src/src/lib/api.ts:2800", "group": "drama", "description": "\u77ED\u5267\uFF1A\u67E5\u8BE2\u526A\u8F91\u65F6\u95F4\u7EBF" },
|
|
2821
|
+
{ "id": "speech.health", "method": "GET", "path": "/api/speech/health", "source": "web-src/src/components/domain/voice-composer.tsx:45", "group": "speech", "description": "\u8BED\u97F3\uFF1A\u67E5\u8BE2\u8BC6\u522B\u670D\u52A1\u72B6\u6001" },
|
|
2822
|
+
{ "id": "speech.transcribe", "method": "POST", "path": "/api/speech/transcribe", "source": "web-src/src/components/domain/voice-composer.tsx:47", "group": "speech", "description": "\u8BED\u97F3\uFF1A\u5C06\u5F55\u97F3\u8F6C\u4E3A\u6587\u5B57\uFF1B--file \u97F3\u9891\uFF0C\u6700\u591A 2 MiB\u30010.5 \u81F3 60 \u79D2", "body": "binary", "uploadPolicy": "speechTranscription" },
|
|
2823
|
+
{ "id": "public.publicCommercialAdInspirations", "method": "GET", "path": "/api/public/showcase-inspirations", "source": "web-src/src/lib/api.ts:2964", "group": "public", "description": "\u516C\u5F00\uFF1A\u67E5\u8BE2\u5546\u54C1\u89C6\u9891\u521B\u610F\u53C2\u8003", "public": true },
|
|
2824
|
+
{ "id": "videos.showcaseEntryDefault", "method": "GET", "path": "/api/showcase-videos/entry-default", "source": "web-src/src/lib/api.ts:2971", "group": "videos", "description": "\u5546\u54C1\u89C6\u9891\uFF1A\u67E5\u8BE2\u5F53\u524D\u8D26\u53F7\u7684\u521B\u5EFA\u9ED8\u8BA4\u503C" }
|
|
2808
2825
|
];
|
|
2809
2826
|
|
|
2810
2827
|
// src/web-operation-contract.ts
|
|
@@ -2871,9 +2888,14 @@ var MIME_BY_EXTENSION = {
|
|
|
2871
2888
|
function webUploadPolicy(operation, filename) {
|
|
2872
2889
|
const extension = extname(filename).toLowerCase();
|
|
2873
2890
|
const policy = operation.uploadPolicy;
|
|
2874
|
-
const
|
|
2891
|
+
const audioRecording = policy === "storySpeech" || policy === "speechTranscription";
|
|
2892
|
+
const mime = audioRecording && extension === ".webm" ? "audio/webm" : policy === "speechTranscription" && extension === ".mp4" ? "audio/mp4" : MIME_BY_EXTENSION[extension];
|
|
2875
2893
|
const unsupported = () => usageError(`\u64CD\u4F5C ${operation.id} \u4E0D\u652F\u6301\u6B64\u6587\u4EF6\u7C7B\u578B\uFF1A${extension || "\u65E0\u6269\u5C55\u540D"}`);
|
|
2876
2894
|
if (!mime || !policy) throw unsupported();
|
|
2895
|
+
if (policy === "speechTranscription") {
|
|
2896
|
+
if (!SPEECH.includes(mime) && !["audio/aac", "audio/flac"].includes(mime)) throw unsupported();
|
|
2897
|
+
return { mime, maxBytes: 2 * MIB };
|
|
2898
|
+
}
|
|
2877
2899
|
if (policy === "storySpeech") {
|
|
2878
2900
|
if (!SPEECH.includes(mime)) throw unsupported();
|
|
2879
2901
|
return { mime, maxBytes: 20 * MIB };
|
|
@@ -2903,6 +2925,7 @@ var MAX_DOWNLOAD_BYTES2 = 1024 * 1024 * 1024;
|
|
|
2903
2925
|
var secretFields = /* @__PURE__ */ new Set(["token", "sessiontoken", "accesstoken", "refreshtoken", "password", "currentpassword", "newpassword", "secret", "clientsecret", "authorization", "cookie", "privatekey", "rawkey"]);
|
|
2904
2926
|
function redactWebValue(value, secrets = []) {
|
|
2905
2927
|
if (typeof value === "string") return secrets.reduce((text, secret) => secret ? text.split(secret).join("[redacted]") : text, redactKeys(value));
|
|
2928
|
+
if (typeof value === "number" && secrets.includes(String(value))) return "[redacted]";
|
|
2906
2929
|
if (Array.isArray(value)) return value.map((item) => redactWebValue(item, secrets));
|
|
2907
2930
|
if (!value || typeof value !== "object") return value;
|
|
2908
2931
|
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
@@ -3111,7 +3134,16 @@ async function requestWeb(io, request) {
|
|
|
3111
3134
|
throw serverFailure(response.status, body, secrets);
|
|
3112
3135
|
}
|
|
3113
3136
|
const mime = response.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
3137
|
+
const sessionResponse = request.method === "POST" && (request.path === "/api/auth/login" || request.sessionResponse === true);
|
|
3138
|
+
if (sessionResponse && (!mime.includes("json") || ![200, 201].includes(response.status))) {
|
|
3139
|
+
await response.body?.cancel().catch(() => void 0);
|
|
3140
|
+
throw badResponse(response.status);
|
|
3141
|
+
}
|
|
3114
3142
|
if (mime === "text/event-stream") {
|
|
3143
|
+
if (request.expectedFile) {
|
|
3144
|
+
await response.body?.cancel().catch(() => void 0);
|
|
3145
|
+
throw badResponse(response.status);
|
|
3146
|
+
}
|
|
3115
3147
|
const decoder = new TextDecoder();
|
|
3116
3148
|
let buffer = "", eventCount = 0, completed = false;
|
|
3117
3149
|
const events = [];
|
|
@@ -3171,7 +3203,8 @@ async function requestWeb(io, request) {
|
|
|
3171
3203
|
if (mime.includes("json") || response.status === 204) {
|
|
3172
3204
|
const data = await jsonBody(response, controller.signal);
|
|
3173
3205
|
secrets.push(...webSecrets(data));
|
|
3174
|
-
if (
|
|
3206
|
+
if (sessionResponse) {
|
|
3207
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) throw badResponse(response.status);
|
|
3175
3208
|
const token = data.token;
|
|
3176
3209
|
if (typeof token === "string") secrets.push(token);
|
|
3177
3210
|
request.onLogin?.(data);
|
|
@@ -3533,12 +3566,13 @@ function object(value) {
|
|
|
3533
3566
|
}
|
|
3534
3567
|
function issuedSession(context, baseUrl, data) {
|
|
3535
3568
|
const user = data.user && typeof data.user === "object" && !Array.isArray(data.user) ? data.user : {};
|
|
3536
|
-
|
|
3569
|
+
const now = context.io.now?.() ?? /* @__PURE__ */ new Date();
|
|
3570
|
+
if (data.ok !== true || typeof data.expiresAt !== "string" || !Number.isFinite(Date.parse(data.expiresAt)) || Date.parse(data.expiresAt) <= now.getTime() || typeof user.id !== "string" || !user.id || typeof user.username !== "string" || !user.username || typeof user.workspaceId !== "string" || !user.workspaceId || !Array.isArray(user.workspaces) || !user.workspaces.some((item) => item && typeof item === "object" && item.id === user.workspaceId)) {
|
|
3537
3571
|
throw new CliError({ code: "CLI_BAD_RESPONSE", exitCode: EXIT.SERVER, message: "\u8BA4\u8BC1\u54CD\u5E94\u7F3A\u5C11\u5B8C\u6574\u4F1A\u8BDD\u6216\u7528\u6237\u8EAB\u4EFD\uFF0C\u539F\u4F1A\u8BDD\u4FDD\u6301\u4E0D\u53D8" });
|
|
3538
3572
|
}
|
|
3539
3573
|
const token = validateSessionToken(data.token);
|
|
3540
3574
|
context.out.protect(token);
|
|
3541
|
-
return { version: 1, baseUrl, token, savedAt:
|
|
3575
|
+
return { version: 1, baseUrl, token, savedAt: now.toISOString(), expiresAt: data.expiresAt };
|
|
3542
3576
|
}
|
|
3543
3577
|
async function optionData(context, name2) {
|
|
3544
3578
|
const file = textOption(context.values, name2);
|
|
@@ -3574,7 +3608,7 @@ function operationPath(operation, params, query) {
|
|
|
3574
3608
|
}
|
|
3575
3609
|
function fileOperation(operation) {
|
|
3576
3610
|
if (operation.method !== "GET") return false;
|
|
3577
|
-
return /\/(?:download(?:\.zip)?|video|audio|clip|subtitles\.srt)$/u.test(operation.path) || /\/edits\/:[^/]+\/subtitles$/u.test(operation.path) || /\/attachments\/:[^/]+\/file$/u.test(operation.path) || /^\/api\/delivery\/(?:packages|shared)\/:[^/]+\/files\/:[^/]+$/u.test(operation.path) || /^\/api\/membership\/renders\/:[^/]+\/output$/u.test(operation.path) || operation.path === "/api/graphic/runs/:runId/preview" || /^\/api\/showcase-videos\/runs\/:[^/]+\/image-edits\/area\/:[^/]+\/preview$/u.test(operation.path);
|
|
3611
|
+
return operation.response === "file" || /\/(?:download(?:\.zip)?|video|audio|clip|subtitles\.srt)$/u.test(operation.path) || /\/edits\/:[^/]+\/subtitles$/u.test(operation.path) || /\/attachments\/:[^/]+\/file$/u.test(operation.path) || /^\/api\/delivery\/(?:packages|shared)\/:[^/]+\/files\/:[^/]+$/u.test(operation.path) || /^\/api\/membership\/renders\/:[^/]+\/output$/u.test(operation.path) || operation.path === "/api/graphic/runs/:runId/preview" || /^\/api\/showcase-videos\/runs\/:[^/]+\/image-edits\/area\/:[^/]+\/preview$/u.test(operation.path);
|
|
3578
3612
|
}
|
|
3579
3613
|
async function upload2(path, operation) {
|
|
3580
3614
|
try {
|
|
@@ -3699,8 +3733,12 @@ async function web(context) {
|
|
|
3699
3733
|
const secretOutput = issueApiKey || operation.sensitiveOutput === true;
|
|
3700
3734
|
const output = textOption(values, "out");
|
|
3701
3735
|
if (secretOutput && !output) throw usageError("\u8BE5\u64CD\u4F5C\u7B7E\u53D1\u5BC6\u94A5\u6216\u79C1\u6709\u94FE\u63A5\uFF0C\u5FC5\u987B\u4F7F\u7528 --out <\u65B0\u6587\u4EF6>\uFF1B\u660E\u6587\u4E0D\u4F1A\u8F93\u51FA\u5230\u7EC8\u7AEF");
|
|
3736
|
+
if (operation.response === "file" && !output) throw usageError("\u8BE5\u64CD\u4F5C\u8FD4\u56DE\u56FE\u7247\u539F\u6587\u4EF6\uFF0C\u5FC5\u987B\u4F7F\u7528 --out <\u65B0\u6587\u4EF6> \u4FDD\u5B58");
|
|
3702
3737
|
if (output) await checkWebOutput(output);
|
|
3703
3738
|
const params = await optionData(context, "params"), query = await optionData(context, "query"), data = await optionData(context, "data");
|
|
3739
|
+
const authCodes = operation.group === "auth" && (typeof data.code === "string" || typeof data.code === "number") ? [String(data.code)] : [];
|
|
3740
|
+
const secrets = [...webSecrets(data), ...webSecrets(query), ...webSecrets(params), ...authCodes];
|
|
3741
|
+
for (const secret of secrets) out.protect(secret);
|
|
3704
3742
|
const bodyKey = operation.idempotencyBodyKey ? data[operation.idempotencyBodyKey] : void 0;
|
|
3705
3743
|
if (bodyKey !== void 0 && typeof bodyKey !== "string") throw usageError("\u6B63\u6587\u4E2D\u7684\u5E42\u7B49\u952E\u5FC5\u987B\u662F\u5B57\u7B26\u4E32");
|
|
3706
3744
|
if (suppliedKey && bodyKey !== void 0 && suppliedKey !== bodyKey) throw usageError("--idempotency-key \u4E0E\u6B63\u6587\u5E42\u7B49\u952E\u4E0D\u4E00\u81F4\uFF0C\u64CD\u4F5C\u672A\u63D0\u4EA4");
|
|
@@ -3721,8 +3759,6 @@ async function web(context) {
|
|
|
3721
3759
|
caller = { baseUrl: session.baseUrl, token: session.token, userId: identity.userId, workspaceId: identity.workspaceId };
|
|
3722
3760
|
}
|
|
3723
3761
|
const workspace = caller.workspaceId;
|
|
3724
|
-
const secrets = [...webSecrets(data), ...webSecrets(query), ...webSecrets(params)];
|
|
3725
|
-
for (const secret of secrets) out.protect(secret);
|
|
3726
3762
|
if (operation.membershipPaymentOnly) {
|
|
3727
3763
|
const id = target.params.id;
|
|
3728
3764
|
if (!id) throw usageError("\u4F1A\u5458\u652F\u4ED8\u64CD\u4F5C\u7F3A\u5C11\u8BA2\u5355\u7F16\u53F7");
|
|
@@ -3811,6 +3847,7 @@ async function web(context) {
|
|
|
3811
3847
|
if (!out.json) out.notice(singleLine(JSON.stringify(event)));
|
|
3812
3848
|
}
|
|
3813
3849
|
});
|
|
3850
|
+
if (operation.sessionResponse && !authenticated) throw new CliError({ code: "CLI_BAD_RESPONSE", exitCode: EXIT.SERVER, message: "\u8BA4\u8BC1\u54CD\u5E94\u6CA1\u6709\u6709\u6548\u4F1A\u8BDD\uFF0C\u539F\u4F1A\u8BDD\u4FDD\u6301\u4E0D\u53D8" });
|
|
3814
3851
|
if (authenticated) await writeWebState(io, "session.json", authenticated);
|
|
3815
3852
|
recovery.operationOutcome = result.status === 202 || recovery.operationOutcome === "accepted" ? "accepted" : "completed";
|
|
3816
3853
|
finishedAtMs = performance.timeOrigin + performance.now();
|