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", {
|
export const cdn = new sst.aws.Router("CDNRouter", {
|
||||||
routes: {
|
routes: {
|
||||||
"/public": {
|
"/*": {
|
||||||
bucket: storage,
|
bucket: storage,
|
||||||
rewrite: {
|
rewrite: {
|
||||||
regex: "^/public/([a-zA-Z0-9_-]+)$",
|
regex: "^/([a-zA-Z0-9_-]+)$",
|
||||||
to: "/images/$1"
|
to: "/public/$1"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export const handler = bus.subscriber(
|
|||||||
await s3.send(
|
await s3.send(
|
||||||
new HeadObjectCommand({
|
new HeadObjectCommand({
|
||||||
Bucket: Resource.Storage.name,
|
Bucket: Resource.Storage.name,
|
||||||
Key: `images/${image.hash}`,
|
Key: `public/${image.hash}`,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ export const handler = bus.subscriber(
|
|||||||
await s3.send(
|
await s3.send(
|
||||||
new PutObjectCommand({
|
new PutObjectCommand({
|
||||||
Bucket: Resource.Storage.name,
|
Bucket: Resource.Storage.name,
|
||||||
Key: `images/${image.hash}`,
|
Key: `public/${image.hash}`,
|
||||||
Body: image.buffer,
|
Body: image.buffer,
|
||||||
...(image.format && { ContentType: `image/${image.format}` }),
|
...(image.format && { ContentType: `image/${image.format}` }),
|
||||||
Metadata: {
|
Metadata: {
|
||||||
@@ -91,7 +91,7 @@ export const handler = bus.subscriber(
|
|||||||
await s3.send(
|
await s3.send(
|
||||||
new HeadObjectCommand({
|
new HeadObjectCommand({
|
||||||
Bucket: Resource.Storage.name,
|
Bucket: Resource.Storage.name,
|
||||||
Key: `images/${image.hash}`,
|
Key: `public/${image.hash}`,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ export const handler = bus.subscriber(
|
|||||||
await s3.send(
|
await s3.send(
|
||||||
new PutObjectCommand({
|
new PutObjectCommand({
|
||||||
Bucket: Resource.Storage.name,
|
Bucket: Resource.Storage.name,
|
||||||
Key: `images/${image.hash}`,
|
Key: `public/${image.hash}`,
|
||||||
Body: image.buffer,
|
Body: image.buffer,
|
||||||
...(image.format && { ContentType: `image/${image.format}` }),
|
...(image.format && { ContentType: `image/${image.format}` }),
|
||||||
Metadata: {
|
Metadata: {
|
||||||
@@ -136,7 +136,7 @@ export const handler = bus.subscriber(
|
|||||||
await s3.send(
|
await s3.send(
|
||||||
new HeadObjectCommand({
|
new HeadObjectCommand({
|
||||||
Bucket: Resource.Storage.name,
|
Bucket: Resource.Storage.name,
|
||||||
Key: `images/${image.hash}`,
|
Key: `public/${image.hash}`,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ export const handler = bus.subscriber(
|
|||||||
await s3.send(
|
await s3.send(
|
||||||
new PutObjectCommand({
|
new PutObjectCommand({
|
||||||
Bucket: Resource.Storage.name,
|
Bucket: Resource.Storage.name,
|
||||||
Key: `images/${image.hash}`,
|
Key: `public/${image.hash}`,
|
||||||
Body: image.buffer,
|
Body: image.buffer,
|
||||||
...(image.format && { ContentType: `image/${image.format}` }),
|
...(image.format && { ContentType: `image/${image.format}` }),
|
||||||
Metadata: {
|
Metadata: {
|
||||||
|
|||||||
Reference in New Issue
Block a user