Remove CDN from repo#232
Conversation
pan93412
commented
May 20, 2026
- refactor: download assets to this repository
- chore: commit assets
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR removes reliance on an external Google Drive CDN by switching image URLs in loaders to point at locally committed WebP assets, and adds a pre-build script to download/convert those assets from Google Drive.
Changes:
- Added
scripts/assets-download.tsto download Google Drive images referenced in Sheets and convert them to WebP for local hosting. - Updated loaders to return local
/assets/drive/{id}.webppaths (prefixed with/${conference.year}) instead of CDN/thumbnail URLs. - Added
sharpdependency and anassets:downloadscript entry.
Reviewed changes
Copilot reviewed 7 out of 122 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/assets-download.ts | New asset download + WebP conversion pipeline (Google Sheets → Drive → local assets). |
| loaders/utils.ts | Replaces CDN URL construction with Drive ID extraction + local asset path mapping. |
| loaders/sponsor.data.ts | Switches sponsor image mapping to local asset paths (no async preload). |
| loaders/sponsor-news.data.ts | Switches sponsor-news images to local asset paths. |
| loaders/community.data.ts | Switches community images from Drive thumbnails to local asset paths. |
| package.json | Adds assets:download script and sharp dependency; bumps Node engine. |
| pnpm-lock.yaml | Locks sharp and related transitive dependencies. |
| .env.example | Removes obsolete DRIVE_IMAGE_CDN env var. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…v vars - Header comment now points at content/public/assets/drive/, matching the actual OUTPUT_DIR. - main() now lists every missing VITE_* env var instead of only checking SHEET_ID and API_KEY, so missing sheet names fail loudly upfront rather than as an undefined sheet name in the Sheets API response. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Google Drive 圖片不需要下載到這吧?目標不是移除 Bunny 而已嗎? |
|
|
preview 圖片跑不出來誒 |
看起來是因為 Vercel 沒有 base URL,但 GitHub Pages 和 Local 測試上正常 🤔 我重新用 Dockerfile 寫一個有正確 routing rules 的版本,Vercel 的我沒看太懂怎麼改 🥲 |
|
@mirumodapon 我重新 build 了,可以測試看看~ https://coscup-2025-preview.zeabur.app/2025/sponsor/
Dockerfile: FROM node:24.6-alpine AS builder
WORKDIR /app
ENV HUSKY=0
RUN corepack enable && corepack prepare pnpm@10.18.0 --activate
RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
--mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM zeabur/caddy-static:2.0
COPY --from=builder /app/.vitepress/dist /usr/share/caddy/2025
RUN cat <<'EOF' > /usr/share/caddy/_redirects
/ /2025/ 301
EOF
RUN addgroup -S app && adduser -S -G app app \
&& chown -R app:app /usr/share/caddy
USER app
EXPOSE 8080 |
