@odla-ai/brand 0.7.0 → 0.7.1
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/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2953,7 +2953,8 @@ async function handleDesignPreview(ctx, req, bookId, assetId) {
|
|
|
2953
2953
|
const asset = await linkedAsset(ctx, book, assetId);
|
|
2954
2954
|
if (asset.kind !== DESIGN_ASSET_KIND) throw new BrandNotFoundError(`design ${assetId}`);
|
|
2955
2955
|
const signed = await ctx.db.storage.sign(asset.path, SIGNED_READ_TTL_SECONDS);
|
|
2956
|
-
const
|
|
2956
|
+
const fetchPrivateAsset = ctx.fetchPrivateAsset;
|
|
2957
|
+
const fetched = await fetchPrivateAsset(signed, {
|
|
2957
2958
|
headers: { accept: "text/html" },
|
|
2958
2959
|
redirect: "manual",
|
|
2959
2960
|
signal: req.signal
|
|
@@ -3838,7 +3839,8 @@ async function handleBrandDiscussionAsset(ctx, req, target) {
|
|
|
3838
3839
|
await ctx.db.storage.sign(before.path, SIGN_TTL_SECONDS)
|
|
3839
3840
|
);
|
|
3840
3841
|
if (!signed) throw new BrandInputError("private asset signing failed");
|
|
3841
|
-
const
|
|
3842
|
+
const fetchPrivateAsset = ctx.fetchPrivateAsset;
|
|
3843
|
+
const response = await fetchPrivateAsset(signed, {
|
|
3842
3844
|
headers: { accept: contentType },
|
|
3843
3845
|
redirect: "manual",
|
|
3844
3846
|
signal: req.signal
|
|
@@ -4075,7 +4077,10 @@ function createBrandRoutes(options) {
|
|
|
4075
4077
|
newId: options.newId ?? (() => crypto.randomUUID()),
|
|
4076
4078
|
maxUploadBytes: options.maxUploadBytes ?? 8 * 1024 * 1024,
|
|
4077
4079
|
discussionBasePath: options.discussionBasePath ?? "/",
|
|
4078
|
-
|
|
4080
|
+
// Bound: this is stored on the context and invoked from route handlers,
|
|
4081
|
+
// where a property call would set the receiver to that context and
|
|
4082
|
+
// Cloudflare's fetch refuses a foreign receiver ("Illegal invocation").
|
|
4083
|
+
fetchPrivateAsset: options.fetchPrivateAsset ?? globalThis.fetch.bind(globalThis),
|
|
4079
4084
|
previewFrameAncestors: options.previewFrameAncestors ?? ["'self'"]
|
|
4080
4085
|
};
|
|
4081
4086
|
return async (req) => {
|