Skip to content

Fix Gelbooru media imgproxy routing - #131

Merged
AlejandroAkbal merged 1 commit into
mainfrom
fix-gelbooru-imgproxy-media
Jun 12, 2026
Merged

Fix Gelbooru media imgproxy routing#131
AlejandroAkbal merged 1 commit into
mainfrom
fix-gelbooru-imgproxy-media

Conversation

@AlejandroAkbal

@AlejandroAkbal AlejandroAkbal commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • route Gelbooru imgproxy sources through the deployed Cloudflare media proxies instead of the VM-local nginx proxy
  • keep non-Gelbooru media on the existing nginx imgproxy source path
  • add provider tests for Gelbooru routing, nginx fallback, and deterministic multi-proxy selection

Verification

  • corepack pnpm vitest run test/assets/imgproxy-provider.test.ts
  • corepack pnpm typecheck
  • corepack pnpm lint
  • coderabbit review --agent -t uncommitted -c AGENTS.md, final pass raised 0 issues
  • live smoke: imgproxy2.r34.app with Worker source returned 200 image/webp for the sample Gelbooru image

Summary by CodeRabbit

  • New Features

    • Image provider now supports configurable outbound media proxy URLs for improved external image source handling and routing.
  • Tests

    • Added test coverage for media proxy selection and routing consistency.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7bc34fb0-e02a-4fb1-91fc-696be8630700

📥 Commits

Reviewing files that changed from the base of the PR and between 131d6d4 and fdbb390.

📒 Files selected for processing (4)
  • app/assets/js/nuxt-image/imgproxy.provider.ts
  • config/project.ts
  • nuxt.config.ts
  • test/assets/imgproxy-provider.test.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase with flat bracket keys for query filters (e.g., filter[sort], filter[rating]) instead of nested object notation

Files:

  • config/project.ts
  • app/assets/js/nuxt-image/imgproxy.provider.ts
  • test/assets/imgproxy-provider.test.ts
  • nuxt.config.ts
**/*.{js,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Separate write requests from realtime-triggered refreshes when debugging PocketBase sync performance by inspecting real network traces

Files:

  • config/project.ts
  • app/assets/js/nuxt-image/imgproxy.provider.ts
  • test/assets/imgproxy-provider.test.ts
  • nuxt.config.ts
**/*.{js,ts,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts,vue}: Use PocketBase batch writes for multi-record replacement/reorder operations instead of one HTTP write per changed row
For state immediately persisted after VueUse moveArrayElement(), build the reordered array synchronously instead of reading it before nextTick() applies the move

Files:

  • config/project.ts
  • app/assets/js/nuxt-image/imgproxy.provider.ts
  • test/assets/imgproxy-provider.test.ts
  • nuxt.config.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx,vue}: Default to Nitro middleware, server plugins, and SSR head tags. Reach for app/middleware only when SPA navigation truly requires client-side routing behavior
Use Prettier with 120-char print width, no semicolons, single quotes, trailing commas removed, and single attribute per line in Vue templates

Files:

  • config/project.ts
  • app/assets/js/nuxt-image/imgproxy.provider.ts
  • test/assets/imgproxy-provider.test.ts
  • nuxt.config.ts
app/assets/js/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

For URL validation/parsing, prefer URL.canParse() or URL.parse() over constructor try/catch; use URL.parse() when the parsed URL object is needed

Files:

  • app/assets/js/nuxt-image/imgproxy.provider.ts
test/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

test/**/*.ts: Use @nuxt/test-utils with Playwright inside describe blocks that call await setup({ browser: true })
Import localeCodes, prefixedLocaleCodes, and removedLocaleCodes from config/i18n in locale-related tests instead of hardcoding locale lists

Files:

  • test/assets/imgproxy-provider.test.ts
nuxt.config.ts

📄 CodeRabbit inference engine (AGENTS.md)

nuxt.config.ts: Place static global SEO tags (favicon, rating, monetization, color-scheme) in nuxt.config.ts head.meta
Mirror route rules for non-default locales via the mirroredRouteRules() helper so prefixed paths get the same caching/SSR rules

Files:

  • nuxt.config.ts
🔇 Additional comments (4)
config/project.ts (1)

41-45: LGTM!

Also applies to: 101-105

app/assets/js/nuxt-image/imgproxy.provider.ts (1)

58-96: LGTM!

Also applies to: 120-131

nuxt.config.ts (1)

342-343: LGTM!

test/assets/imgproxy-provider.test.ts (1)

1-63: LGTM!


📝 Walkthrough

Walkthrough

The PR extends the imgproxy provider to support optional outbound media proxy URLs for routing Gelbooru image sources through configured CORS proxies. Gelbooru URLs are detected and routed through a deterministically selected proxy, while other sources continue using the internal proxy. Configuration, implementation, and test coverage are included.

Changes

Media proxy routing for Gelbooru sources

Layer / File(s) Summary
Provider contract and configuration
config/project.ts
Imgproxy interface declares optional mediaProxyUrls: string[]. Project configuration provides two CORS-proxy worker URLs for the imgproxy section.
Provider implementation – Gelbooru routing
app/assets/js/nuxt-image/imgproxy.provider.ts
Helper functions detect Gelbooru source hostnames and deterministically select a proxy URL via hash-based indexing. getImage reads mediaProxyUrls and routes Gelbooru sources through the selected proxy URL or falls back to the internal proxy for other sources.
Nuxt configuration wiring
nuxt.config.ts
@nuxt/image imgproxy provider options are extended to pass mediaProxyUrls from project configuration. A whitespace adjustment is made in the adjacent i18n section.
Provider test suite
test/assets/imgproxy-provider.test.ts
Vitest suite verifies Gelbooru URLs route through configured media proxies with correct decoded sources, non-Gelbooru URLs use the internal proxy, and identical Gelbooru sources consistently select the same outbound proxy across repeated calls.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: routing Gelbooru media through imgproxy via configured media proxies instead of the local nginx proxy.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-gelbooru-imgproxy-media
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix-gelbooru-imgproxy-media

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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 and usage tips.

@AlejandroAkbal

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AlejandroAkbal
AlejandroAkbal merged commit 28339d5 into main Jun 12, 2026
1 check passed
@AlejandroAkbal
AlejandroAkbal deleted the fix-gelbooru-imgproxy-media branch June 12, 2026 08:39
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.

1 participant