From 60d220e0075e8316ea39f1171018e8a1d023d031 Mon Sep 17 00:00:00 2001 From: Nicholas de Paola Date: Sat, 16 Mar 2024 13:05:58 +1000 Subject: [PATCH] add image cdn built on top of cloudflare workers and R2 todo: * google drive only lets you watch resources for a week :( some progress! after four months of putting this off. love to see it. will check if this has worked around 10am tomorrow no idea how long it will take to run a few things on the todo list to rattle off at 12am: * need to flesh out the env var docstrings a lot. i had to go into the YuukioFuyu repo to check their instructions * need a more robust way of generating google client ID / secret / refresh token * need to plug this into github actions to redeploy on master (or maybe on a branch called `image-cdn-release` in keeping with how the frontend deploys)? * docstrings for functions * a couple of dumb names here which we'll need to clean upu update wrangler npm audit fix add logging https://medium.com/@amanpal2072004/how-to-generate-refresh-token-and-use-them-to-access-google-api-f7565413c548 authorising with drive.readonly delete image IDs which 404 from system --- .run/Image CDN - Dev Server.run.xml | 12 + image-cdn/.editorconfig | 10 + image-cdn/.eslintrc.js | 13 + image-cdn/.eslintrc.json | 3 + image-cdn/.gitignore | 173 ++++ image-cdn/.prettierrc | 6 + image-cdn/package-lock.json | 1364 +++++++++++++++++++++++++++ image-cdn/package.json | 16 + image-cdn/src/index.ts | 226 +++++ image-cdn/tsconfig.json | 103 ++ image-cdn/worker-configuration.d.ts | 10 + image-cdn/wrangler.example.toml | 41 + 12 files changed, 1977 insertions(+) create mode 100644 .run/Image CDN - Dev Server.run.xml create mode 100644 image-cdn/.editorconfig create mode 100644 image-cdn/.eslintrc.js create mode 100644 image-cdn/.eslintrc.json create mode 100644 image-cdn/.gitignore create mode 100644 image-cdn/.prettierrc create mode 100644 image-cdn/package-lock.json create mode 100644 image-cdn/package.json create mode 100644 image-cdn/src/index.ts create mode 100644 image-cdn/tsconfig.json create mode 100644 image-cdn/worker-configuration.d.ts create mode 100644 image-cdn/wrangler.example.toml diff --git a/.run/Image CDN - Dev Server.run.xml b/.run/Image CDN - Dev Server.run.xml new file mode 100644 index 000000000..98d6131e1 --- /dev/null +++ b/.run/Image CDN - Dev Server.run.xml @@ -0,0 +1,12 @@ + + + + + +