From a907946244a8052ea988a269f775c6dd8f11c0ff Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 14 Jul 2026 09:58:13 +0200 Subject: [PATCH] feat(plugins): let a plugin ship its own settings page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A plugin that declares capabilities.settingsUi: true gets its client/settings.html framed as a card under Settings -> Plugins — same opaque-origin sandbox and postMessage bridge as its widget, sized via trek:resize. Hosts that predate the flag strip it at install, so old instances keep working and simply don't show the card. --- client/src/components/Plugins/PluginFrame.tsx | 10 ++++-- .../components/Settings/PluginSettingsTab.tsx | 34 ++++++++++++++++++- client/src/store/pluginStore.ts | 2 ++ plugin-sdk/src/manifest.ts | 4 +++ plugin-sdk/test/sdk.test.ts | 5 +++ server/src/nest/plugins/install/manifest.ts | 6 ++++ .../nest/plugins/plugins-feed.controller.ts | 18 +++++++++- server/tests/unit/plugins/manifest.test.ts | 7 ++++ .../unit/plugins/plugins-service.test.ts | 9 +++++ wiki/Plugin-Development.md | 12 +++++++ 10 files changed, 103 insertions(+), 4 deletions(-) diff --git a/client/src/components/Plugins/PluginFrame.tsx b/client/src/components/Plugins/PluginFrame.tsx index 21e1d11d6..0fed34d22 100644 --- a/client/src/components/Plugins/PluginFrame.tsx +++ b/client/src/components/Plugins/PluginFrame.tsx @@ -97,6 +97,12 @@ interface PluginFrameProps { fill?: boolean className?: string title?: string + /** + * Entry document inside the plugin's client/ dir. Defaults to the widget's + * index.html; the user-settings surface loads settings.html instead. Host-set + * literals only — never user input (it becomes part of the frame URL). + */ + path?: string } type Inbound = @@ -118,7 +124,7 @@ interface ConfirmRequest { danger: boolean } -export default function PluginFrame({ pluginId, tripId = null, placeId = null, dayId = null, reservationId = null, fill = false, className, title }: PluginFrameProps) { +export default function PluginFrame({ pluginId, tripId = null, placeId = null, dayId = null, reservationId = null, fill = false, className, title, path = 'index.html' }: PluginFrameProps) { const frameRef = useRef(null) // A sandboxed frame may navigate ITSELF (connect-src can't stop that), and its // window identity keeps matching our iframe afterwards. Track loads and refuse @@ -369,7 +375,7 @@ export default function PluginFrame({ pluginId, tripId = null, placeId = null, d