mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
fix: Use public
This commit is contained in:
@@ -3,11 +3,11 @@ import { storage } from "./storage";
|
||||
|
||||
export const cdn = new sst.aws.Router("CDNRouter", {
|
||||
routes: {
|
||||
"/public": {
|
||||
"/*": {
|
||||
bucket: storage,
|
||||
rewrite: {
|
||||
regex: "^/public/([a-zA-Z0-9_-]+)$",
|
||||
to: "/images/$1"
|
||||
regex: "^/([a-zA-Z0-9_-]+)$",
|
||||
to: "/public/$1"
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -48,7 +48,7 @@ export const handler = bus.subscriber(
|
||||
await s3.send(
|
||||
new HeadObjectCommand({
|
||||
Bucket: Resource.Storage.name,
|
||||
Key: `images/${image.hash}`,
|
||||
Key: `public/${image.hash}`,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -57,7 +57,7 @@ export const handler = bus.subscriber(
|
||||
await s3.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: Resource.Storage.name,
|
||||
Key: `images/${image.hash}`,
|
||||
Key: `public/${image.hash}`,
|
||||
Body: image.buffer,
|
||||
...(image.format && { ContentType: `image/${image.format}` }),
|
||||
Metadata: {
|
||||
@@ -91,7 +91,7 @@ export const handler = bus.subscriber(
|
||||
await s3.send(
|
||||
new HeadObjectCommand({
|
||||
Bucket: Resource.Storage.name,
|
||||
Key: `images/${image.hash}`,
|
||||
Key: `public/${image.hash}`,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -100,7 +100,7 @@ export const handler = bus.subscriber(
|
||||
await s3.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: Resource.Storage.name,
|
||||
Key: `images/${image.hash}`,
|
||||
Key: `public/${image.hash}`,
|
||||
Body: image.buffer,
|
||||
...(image.format && { ContentType: `image/${image.format}` }),
|
||||
Metadata: {
|
||||
@@ -136,7 +136,7 @@ export const handler = bus.subscriber(
|
||||
await s3.send(
|
||||
new HeadObjectCommand({
|
||||
Bucket: Resource.Storage.name,
|
||||
Key: `images/${image.hash}`,
|
||||
Key: `public/${image.hash}`,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -145,7 +145,7 @@ export const handler = bus.subscriber(
|
||||
await s3.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: Resource.Storage.name,
|
||||
Key: `images/${image.hash}`,
|
||||
Key: `public/${image.hash}`,
|
||||
Body: image.buffer,
|
||||
...(image.format && { ContentType: `image/${image.format}` }),
|
||||
Metadata: {
|
||||
|
||||
Reference in New Issue
Block a user