feat: add content length to file upload endpoint, cors for local dev
This commit is contained in:
parent
aa0e3e987c
commit
478859d9b5
@ -1,2 +1,3 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
awslocal s3 mb s3://comfyui-deploy
|
awslocal s3 mb s3://comfyui-deploy
|
||||||
|
awslocal s3api put-bucket-cors --bucket comfyui-deploy --cors-configuration file:///app/web/aws/cors-config.json
|
15
web/aws/cors-config.json
Normal file
15
web/aws/cors-config.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"CORSRules": [
|
||||||
|
{
|
||||||
|
"AllowedHeaders": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"AllowedMethods": [
|
||||||
|
"PUT"
|
||||||
|
],
|
||||||
|
"AllowedOrigins": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -27,4 +27,5 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 4566:4566
|
- 4566:4566
|
||||||
volumes:
|
volumes:
|
||||||
- ./aws:/etc/localstack/init/ready.d
|
- ./aws:/etc/localstack/init/ready.d
|
||||||
|
- ./aws:/app/web/aws
|
@ -23,6 +23,7 @@ export type ResourceObject = {
|
|||||||
resourceId: string;
|
resourceId: string;
|
||||||
resourceType: "image/png" | "application/zip" | string;
|
resourceType: "image/png" | "application/zip" | string;
|
||||||
isPublic?: boolean;
|
isPublic?: boolean;
|
||||||
|
size?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function handleResourceUpload(
|
export async function handleResourceUpload(
|
||||||
@ -32,6 +33,7 @@ export async function handleResourceUpload(
|
|||||||
Key: resource.resourceId,
|
Key: resource.resourceId,
|
||||||
Bucket: resource.resourceBucket,
|
Bucket: resource.resourceBucket,
|
||||||
ContentType: resource.resourceType,
|
ContentType: resource.resourceType,
|
||||||
|
ContentLength: resource.size,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Only set ACL if resource is public
|
// Only set ACL if resource is public
|
||||||
|
Loading…
x
Reference in New Issue
Block a user