Skip to content

Commit a0fb944

Browse files
committed
add missing config file for binding
correct layout Use cloudflare recommended layout Add wrangler.toml to root of build folder Output wrangler Attempt to reference media properly
1 parent eeb6c08 commit a0fb944

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

.github/workflows/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ jobs:
5151
with:
5252
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
5353
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
54-
command: pages deploy ./build --project-name=howoldaremycats
54+
command: pages deploy . --project-name=howoldaremycats
5555
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

functions/media/[[all]].js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export async function onRequestGet(ctx) {
2+
const path = new URL(ctx.request.url).pathname.replace("/media/", "");
3+
const file = await ctx.env.MEDIA.get(path);
4+
if (!file) return new Response(null, { status: 404 });
5+
return new Response(file.body, {
6+
headers: { "Content-Type": file.httpMetadata.contentType },
7+
});
8+
}

src/app/contents.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"deathdate": "",
162162
"images": [
163163
"https://i.imgur.com/7Z5UHr3.jpg",
164-
"https://pub-de0e381b0f7043a297494a2012c5777f.r2.dev/PixieHappyCountertop.mp4"
164+
"/media/PixieHappyCountertop.mp4"
165165
],
166166
"imageAlt": "Images of Pixie the cat",
167167
"sounds": [

wrangler.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pages_build_output_dir = "build"
2+
3+
[[r2_buckets]]
4+
binding = "MEDIA"
5+
bucket_name = "howoldaremycats-videos"

0 commit comments

Comments
 (0)