agent-bridge-aun 1.0.23 → 1.0.24
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.
|
@@ -225,21 +225,9 @@ async function uploadAunAttachments(client, ownerAid, peerAid, items) {
|
|
|
225
225
|
const objectKey = `shared/${(0, node_crypto_1.randomUUID)()}/${filename.replace(/[^A-Za-z0-9._-]/g, "_")}`;
|
|
226
226
|
const sha256 = digest(item.data);
|
|
227
227
|
const ref = { ownerAid, bucket: "default", objectKey, filename, contentType: item.contentType.toLowerCase(), sizeBytes: item.data.byteLength, sha256 };
|
|
228
|
-
const uploaded = await client.storage.writeBytes(`/${objectKey}`, item.data, { contentType: item.contentType, public:
|
|
228
|
+
const uploaded = await client.storage.writeBytes(`/${objectKey}`, item.data, { contentType: item.contentType, public: true, overwrite: true });
|
|
229
229
|
checkedMetadata({ ...uploaded, size: uploaded.size ?? uploaded.size_bytes ?? item.data.byteLength }, ref);
|
|
230
|
-
|
|
231
|
-
if (share.owner_aid && share.owner_aid !== ownerAid || share.bucket && share.bucket !== "default" || share.object_key && share.object_key !== objectKey)
|
|
232
|
-
throw new Error("AUN 附件分享对象不一致");
|
|
233
|
-
if (share.allowed_aids !== undefined && (!Array.isArray(share.allowed_aids) || share.allowed_aids.length !== 1 || share.allowed_aids[0] !== peerAid))
|
|
234
|
-
throw new Error("AUN 附件分享授权不一致");
|
|
235
|
-
const shareId = typeof share.share_id === "string" && /^[A-Za-z0-9]{10}$/.test(share.share_id) ? share.share_id : undefined;
|
|
236
|
-
if (share.share_id !== undefined && !shareId)
|
|
237
|
-
throw new Error("AUN 附件分享标识无效");
|
|
238
|
-
const url = typeof share.path_url === "string" && share.path_url ? share.path_url : shareId ? `https://${ownerAid}/${objectKey}?t=${shareId}` : "";
|
|
239
|
-
const token = url ? pathToken(url, ownerAid, objectKey) : undefined;
|
|
240
|
-
if (!token || shareId && shareId !== token)
|
|
241
|
-
throw new Error("AUN 附件分享链接无效");
|
|
242
|
-
result.push({ owner_aid: ownerAid, bucket: "default", object_key: objectKey, url, filename, content_type: item.contentType, size_bytes: item.data.byteLength, sha256 });
|
|
230
|
+
result.push({ owner_aid: ownerAid, object_key: objectKey, filename, size_bytes: item.data.byteLength, sha256, content_type: item.contentType });
|
|
243
231
|
}
|
|
244
232
|
return result;
|
|
245
233
|
}
|
|
@@ -11,7 +11,7 @@ const node_url_1 = require("node:url");
|
|
|
11
11
|
const messages_1 = require("./messages");
|
|
12
12
|
const attachments_1 = require("./attachments");
|
|
13
13
|
const manifest = {
|
|
14
|
-
id: "aun", version: "1.0.
|
|
14
|
+
id: "aun", version: "1.0.24", type: "channel", displayName: "AUN 通道",
|
|
15
15
|
entry: "dist/src-ts/plugins/aun/index.js", apiVersion: "1", process: "in-process",
|
|
16
16
|
capabilities: ["channel", "channel.identity.create", "channel.receive", "channel.send", "health", "cli"],
|
|
17
17
|
configSchema: "config.schema.json",
|
package/package.json
CHANGED