Skip to content

feat: self-host remote images during build - #292

Open
pan93412 wants to merge 1 commit into
mainfrom
self-hosting-pretalx-avatars
Open

feat: self-host remote images during build#292
pan93412 wants to merge 1 commit into
mainfrom
self-hosting-pretalx-avatars

Conversation

@pan93412

@pan93412 pan93412 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

影像改下載後放在 GitHub Pages,不走 Pretalx 或 Google Drive 外部服務。

Fixed #285

CleanShot 2026-07-20 at 11 30 50@2x CleanShot 2026-07-20 at 11 30 37@2x

Summary by CodeRabbit

  • New Features

    • Remote images from event content, sponsors, speakers, and ads are now downloaded, optimized, and served directly by the site.
    • Google Drive image links are automatically converted into usable image URLs.
    • Previously processed images are reused during builds to improve consistency and efficiency.
  • Bug Fixes

    • Improved handling of unavailable speaker images by using a fallback placeholder instead of breaking image processing.
    • Updated image references across ads, sponsors, and speaker profiles to use locally hosted versions when available.

@pan93412 pan93412 self-assigned this Jul 20, 2026
@rileychh-dokploy-coscup

rileychh-dokploy-coscup Bot commented Jul 20, 2026

Copy link
Copy Markdown

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
Nuxt ❌ Failed Preview URL 2026-08-03T08:58:37.721Z

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@pan93412, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 88e518bf-e6bc-441e-8274-8f2c4872b2c5

📥 Commits

Reviewing files that changed from the base of the PR and between fd7f48e and ccf880c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • .github/workflows/deploy.yaml
  • .gitignore
  • modules/self-host-remote-images.ts
  • nuxt.config.ts
  • package.json
  • server/api/ad.get.ts
  • server/api/sponsor.get.ts
  • server/utils/opass/pretalxToOpass.ts
  • server/utils/pretalx/parser.ts
  • server/utils/remoteImages.ts
  • shared/utils/remoteImages.ts
📝 Walkthrough

Walkthrough

The PR adds build-time remote image self-hosting, cached WebP conversion, manifest-based runtime URL mapping, and integration across ad, sponsor, and speaker data. Nuxt configuration and deployment caching enable the image preparation workflow.

Changes

Remote image self-hosting

Layer / File(s) Summary
Image collection and build pipeline
modules/self-host-remote-images.ts, shared/utils/remoteImages.ts, package.json
The Nuxt module collects published Google Sheets images and Pretalx avatars, normalizes and de-duplicates URLs, downloads WebP files with Drive fallback handling, caches results, and writes a manifest.
Runtime manifest mapping
server/utils/remoteImages.ts, server/api/ad.get.ts, server/api/sponsor.get.ts, server/utils/opass/pretalxToOpass.ts, server/utils/pretalx/parser.ts
Runtime image fields use the cached manifest to return self-hosted paths, while unmapped sources remain unchanged.
Build and deployment wiring
nuxt.config.ts, .github/workflows/deploy.yaml, .gitignore
Nuxt enables the module, deployment restores the remote-image cache, and generated public image files are ignored. Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant NuxtBuild
  participant SelfHostRemoteImages
  participant GoogleSheets
  participant PretalxAPI
  participant RemoteImageCache
  participant AdAndSpeakerAPIs
  NuxtBuild->>SelfHostRemoteImages: run build:before
  SelfHostRemoteImages->>GoogleSheets: fetch published image URLs
  SelfHostRemoteImages->>PretalxAPI: fetch speaker avatar URLs
  SelfHostRemoteImages->>RemoteImageCache: download WebP files and write manifest
  AdAndSpeakerAPIs->>RemoteImageCache: resolve normalized image source
  RemoteImageCache-->>AdAndSpeakerAPIs: return self-hosted path or original URL
Loading

Possibly related PRs

  • COSCUP/2026#277: Both changes modify speaker avatar fallback behavior in server/utils/opass/pretalxToOpass.ts.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: self-hosting remote images during build.
Linked Issues check ✅ Passed The PR serves speaker avatars from the project domain, which addresses the Pretalx-hosted avatar navigation issue in #285.
Out of Scope Changes check ✅ Passed No clearly unrelated changes are present; the added image cache and URL rewriting support the stated self-hosting goal.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch self-hosting-pretalx-avatars

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pan93412
pan93412 marked this pull request as ready for review July 20, 2026 06:56
@pan93412
pan93412 requested a review from a team July 20, 2026 06:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72c7590215

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/utils/remoteImages.ts
Comment thread .github/workflows/deploy.yaml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/deploy.yaml:
- Around line 35-40: Update the “Restore remote image cache” step to include a
unique run identifier such as github.run_id in its primary key, and add
restore-keys using the stable remote-images and runner.os prefix so the newest
existing cache is restored while each run can save newly downloaded images.

In `@modules/self-host-remote-images.ts`:
- Around line 22-34: Update driveThumbnailUrl and isPretalxAvatar to handle
invalid source strings without throwing: wrap each new URL(source) parse in
try/catch and return null from driveThumbnailUrl or false from isPretalxAvatar
when parsing fails, while preserving existing behavior for valid URLs.
- Around line 154-160: Update the cache-check logic around cachedName in the
remote image processing flow to detect the PRETALX_PLACEHOLDER value and return
early before resolving or statting it. Keep normal .webp cache validation and
copying unchanged for other cached names.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 403905ce-fde7-4987-a0ab-fc225058ff1e

📥 Commits

Reviewing files that changed from the base of the PR and between 2719034 and 72c7590.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • .github/workflows/deploy.yaml
  • .gitignore
  • modules/self-host-remote-images.ts
  • nuxt.config.ts
  • package.json
  • server/api/ad.get.ts
  • server/api/sponsor.get.ts
  • server/utils/opass/pretalxToOpass.ts
  • server/utils/pretalx/parser.ts
  • server/utils/remoteImages.ts
  • shared/utils/remoteImages.ts

Comment thread .github/workflows/deploy.yaml
Comment thread modules/self-host-remote-images.ts
Comment thread modules/self-host-remote-images.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd7f48e102

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread modules/self-host-remote-images.ts
Comment thread server/utils/remoteImages.ts
@pan93412
pan93412 force-pushed the self-hosting-pretalx-avatars branch from fd7f48e to 5fd51a4 Compare August 1, 2026 14:00
@pan93412
pan93412 force-pushed the self-hosting-pretalx-avatars branch from 5fd51a4 to ccf880c Compare August 1, 2026 14:01

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ccf880c29c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread modules/self-host-remote-images.ts
Comment thread modules/self-host-remote-images.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve speaker avatar interaction in the schedule

1 participant