Skip to content

feat: Add setting to disable embed endpoints and UI.#4316

Merged
ildyria merged 2 commits intomasterfrom
copilot/add-config-setting-is-embed-enabled
Apr 23, 2026
Merged

feat: Add setting to disable embed endpoints and UI.#4316
ildyria merged 2 commits intomasterfrom
copilot/add-config-setting-is-embed-enabled

Conversation

@ildyria
Copy link
Copy Markdown
Member

@ildyria ildyria commented Apr 23, 2026

We got news some people don't want that.

Summary by CodeRabbit

  • New Features
    • Added a new configuration option to enable or disable gallery embedding functionality.
    • When disabled, embed buttons are hidden and embedding is unavailable across the application.

@ildyria ildyria requested a review from a team as a code owner April 23, 2026 19:40
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

📝 Walkthrough

Walkthrough

A configuration feature enabling administrators to disable embed functionality globally. Changes include backend controller guards, a new database migration for the config setting, frontend state management integration, and UI components gated by the is_embed_enabled flag.

Changes

Cohort / File(s) Summary
Backend Configuration & API
app/Http/Controllers/Gallery/EmbedController.php, app/Http/Resources/GalleryConfigs/InitConfig.php, database/migrations/2026_04_22_000001_add_embed_enabled_config.php
Added is_embed_enabled config setting with early-abort guards in embed endpoints. Migration defines the config with UI metadata and boolean type. InitConfig resource exposes the setting with default true value.
Frontend State & Types
resources/js/stores/LycheeState.ts, resources/js/lychee.d.ts
Added is_embed_enabled boolean state to Pinia store, initialized from config payload. Updated TypeScript definitions to include the new property in InitConfig type.
Frontend UI Components
resources/js/components/gallery/albumModule/AlbumHero.vue, resources/js/composables/contextMenus/leftMenu.ts
Updated isEmbeddable computed to check is_embed_enabled state alongside existing login/policy conditions. Gated embed stream menu item access on the global embed flag.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A toggle to tame the embed,
From config springs the switch I thread,
No APIs shared when I say "nay,"
And buttons vanish when I play,
Control returns to warren's way! 🎛️

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

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


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
Copy Markdown

@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.

🧹 Nitpick comments (1)
resources/js/composables/contextMenus/leftMenu.ts (1)

124-124: Minor: ?? true fallback is dead code.

is_embed_enabled is typed as boolean (non-nullable) in lychee.d.ts and the store initializes it to true, so is_embed_enabled.value can never be null/undefined. The ?? true fallback can be dropped for clarity, though it's harmless.

♻️ Suggested simplification
-				access: (is_embed_enabled.value ?? true) && user.value?.id !== null,
+				access: is_embed_enabled.value && user.value?.id !== null,

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e8e758f-7b06-4f50-94bc-c9b16889bb16

📥 Commits

Reviewing files that changed from the base of the PR and between 2a99024 and 7482c27.

📒 Files selected for processing (7)
  • app/Http/Controllers/Gallery/EmbedController.php
  • app/Http/Resources/GalleryConfigs/InitConfig.php
  • database/migrations/2026_04_22_000001_add_embed_enabled_config.php
  • resources/js/components/gallery/albumModule/AlbumHero.vue
  • resources/js/composables/contextMenus/leftMenu.ts
  • resources/js/lychee.d.ts
  • resources/js/stores/LycheeState.ts

@ildyria ildyria merged commit 1cde981 into master Apr 23, 2026
88 checks passed
@ildyria ildyria deleted the copilot/add-config-setting-is-embed-enabled branch April 23, 2026 20: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.

2 participants