Skip to content

Conversation

@cdzombak
Copy link
Contributor

@cdzombak cdzombak commented Nov 25, 2025

This PR should fix embedded galleries for Lychee instances hosted at non-root paths (e.g. example.com/photos instead of photos.example.com).

Summary by CodeRabbit

  • Bug Fixes

    • Simplified embed preview error messaging for clarity.
    • Made embed base URL resolution more robust to avoid incorrect preview links.
  • Chores

    • Updated internal base URL configuration handling to use the centralized base URL and trim trailing slashes.

✏️ Tip: You can customize this high-level summary in your review settings.

@cdzombak cdzombak requested a review from a team as a code owner November 25, 2025 15:27
@coderabbitai
Copy link

coderabbitai bot commented Nov 25, 2025

📝 Walkthrough

Walkthrough

The EmbedCodeDialog component now imports a Constants module and uses Constants.BASE_URL (with trailing slashes trimmed) instead of window.location.origin to derive the base API/embed URL; no other behavioral changes are present.

Changes

Cohort / File(s) Summary
Embed URL resolution change
resources/js/components/forms/album/EmbedCodeDialog.vue
Adds import of Constants and replaces uses of window.location.origin with Constants.BASE_URL (trimming trailing slashes) to construct the API/embed base URL.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify Constants.BASE_URL is defined and correct across environments.
  • Check trimming logic covers edge cases (empty string, only slashes).
  • Confirm embed base URL resolution produces expected values in dev and production.

Poem

A rabbit nibbling code with care,
Swapped the origin for BASE_URL there,
Trims a slash, hops light and spry,
Embed links chase the open sky,
🐇✨

Pre-merge checks

✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc00fa4 and 4214cf0.

📒 Files selected for processing (1)
  • resources/js/components/forms/album/EmbedCodeDialog.vue (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • resources/js/components/forms/album/EmbedCodeDialog.vue

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
resources/js/components/forms/album/EmbedCodeDialog.vue (2)

219-223: apiUrl computation correctly handles non‑root base paths (optional normalization centralization)

Switching from window.location.origin to Constants.BASE_URL and trimming trailing slashes with .replace(/\/+$/, "") is a solid fix for instances mounted under a sub‑path and avoids double slashes when appending /embed. As a minor nit, if other call sites also need a normalized base URL, consider moving the trailing‑slash normalization into the constants service itself so callers can just use a pre‑normalized BASE_URL.


384-388: Simplified preview error message is fine; consider future i18n / dev‑hint tweak

The shorter "Failed to load preview." message is clear and has no functional implications. If you expect preview failures to be common in dev (e.g., embed assets not built/served) or want better localization, you might later move this string into the i18n bundle and/or include a brief hint that deployment/asset build can affect preview availability.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c1df62d and bc00fa4.

📒 Files selected for processing (1)
  • resources/js/components/forms/album/EmbedCodeDialog.vue (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-28T08:39:34.280Z
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3721
File: resources/js/stores/NsfwConsentedState.ts:3-5
Timestamp: 2025-09-28T08:39:34.280Z
Learning: In Lychee codebase, all Pinia store files follow the pattern of declaring the type alias before the store definition (e.g., `export type StoreType = ReturnType<typeof useStore>; export const useStore = defineStore(...)`). This pattern compiles successfully with TypeScript 5.9 and vue-tsc.

Applied to files:

  • resources/js/components/forms/album/EmbedCodeDialog.vue
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Install
  • GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- ImageProcessing
  • GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Webshop
  • GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Unit
  • GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- ImageProcessing
  • GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Webshop
  • GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- ImageProcessing
  • GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Webshop
  • GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Unit
  • GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Unit
  • GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Feature_v2
  • GitHub Check: 2️⃣ PHP 8.3 - License Check
  • GitHub Check: 2️⃣ PHP 8.3 - Code Style errors
  • GitHub Check: 2️⃣ PHP 8.3 - PHPStan
🔇 Additional comments (1)
resources/js/components/forms/album/EmbedCodeDialog.vue (1)

143-143: Importing shared Constants service is appropriate here

Using Constants keeps URL configuration centralized and consistent with the rest of the app; no issues with this addition.

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.43%. Comparing base (25ac354) to head (4214cf0).
⚠️ Report is 1 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria enabled auto-merge (squash) November 25, 2025 21:28
@ildyria ildyria merged commit 8f5ef22 into LycheeOrg:master Nov 25, 2025
35 checks passed
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.

2 participants