Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(extensions): tab-group contributions (#43) + FTP as serverkit-ftp (#44)

Juan Denis50166b8f7892
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ba73dad3..2ec76f82 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,16 @@ awaiting a stable release:
### Added
+- **Extensions platform (Phase 7 — extensions can now contribute tabs to core
+ tab groups)** — a new `tabs` contribution kind lets an installed extension add
+ a real tab to a core-owned tab group (Files, Servers, Observability): the tab
+ joins the shared top-bar strip, its routes render inside the group's layout so
+ the chrome stays, and the group's sidebar item stays lit on the extension's
+ routes. First consumer: **the FTP Server page is now the `serverkit-ftp`
+ extension** — it appears as the familiar tab in the Files group when installed,
+ and tab + page + palette entry disappear together when uninstalled. Existing
+ panels auto-install it once on upgrade so nothing disappears; fresh installs
+ find it in the Marketplace.
- **Extensions platform (Phase 5 — Cloudflare zone-ops is now a bundled extension)** —
the Cloudflare per-zone control panel (zone settings, cache purge, WAF, Workers,
Tunnels, and R2/KV/D1 storage, reached from the "Open in Cloudflare" button on a
diff --git a/backend/app/api/plugins.py b/backend/app/api/plugins.py
index 18e48e19..c7cbab52 100644
--- a/backend/app/api/plugins.py
+++ b/backend/app/api/plugins.py
@@ -425,7 +425,9 @@ def get_manifest_spec():
'properties': {
'nav': {'type': 'array', 'description': 'Sidebar items: {id, label, route, category, icon}.'},
'routes': {'type': 'array',
- 'description': 'SPA routes: {path, component, layout?}. component matches a named export of the plugin index module. layout: padded (default) | full | bare | <custom-layout-id>.'},
+ 'description': 'SPA routes: {path, component, layout?, group?}. component matches a named export of the plugin index module. layout: padded (default) | full | bare | <custom-layout-id>. group nests the route inside that core tab group\'s TabGroupLayout instead (see tabs).'},
+ 'tabs': {'type': 'array',
+ 'description': 'Tabs added to a core-owned tab group: {group, to, label, icon?, end?, order?}. group is the core group id (files | servers | monitoring; == the sidebar item id). Pair with a route contribution carrying the same group. icon is raw inner-SVG markup; order is an optional insertion index (default: appended).'},
'page_titles': {'type': 'object', 'description': 'Map of route path → document title.'},
'command_palette': {'type': 'array', 'description': '{label, path, category, keywords}.'},
'widgets': {'type': 'array', 'description': '{slot, component}. slot=global renders globally inside DashboardLayout.'},
diff --git a/backend/app/services/contribution_service.py b/backend/app/services/contribution_service.py
index aa9d0d3a..8591ae61 100644
--- a/backend/app/services/contribution_service.py
+++ b/backend/app/services/contribution_service.py
@@ -5,13 +5,20 @@ A plugin manifest may declare a `contributions` block with any subset of:
{
"nav": [{ id, label, route, category, icon, ... }],
- "routes": [{ path, component, layout? }],
+ "routes": [{ path, component, layout?, group? }],
"page_titles": { "/some-path": "Title" },
"command_palette":[{ label, path, category, keywords }],
"widgets": [{ slot, component }],
- "layouts": [{ id, component }]
+ "layouts": [{ id, component }],
+ "tabs": [{ group, to, label, icon?, end?, order? }]
}
+A `tabs` entry adds a tab to a core-owned TabGroupLayout group; `group` is the
+core group id (== the sidebar item id: files | servers | monitoring). Pair it
+with a route contribution carrying the same `group` so the page renders INSIDE
+that group's TabGroupLayout (shared PageTopbar chrome) instead of as a flat
+dashboard route.
+
The `layout` field on a route may be one of:
"padded" (default) — render inside DashboardLayout, normal padding
@@ -54,6 +61,7 @@ def get_active_contributions():
command_palette = []
widgets = []
layouts = []
+ tabs = []
# AI assistant contributions: per-route suggested prompts + custom
# tool-result renderers, consumed by the core AIAssistant.
ai = {'suggested_prompts': [], 'tool_renderers': []}
@@ -68,6 +76,7 @@ def get_active_contributions():
command_palette.extend(_tag(contrib.get('command_palette'), p.slug))
widgets.extend(_tag(contrib.get('widgets'), p.slug))
layouts.extend(_tag(contrib.get('layouts'), p.slug))
+ tabs.extend(_tag(contrib.get('tabs'), p.slug))
ai_contrib = contrib.get('ai')
if isinstance(ai_contrib, dict):
@@ -87,5 +96,6 @@ def get_active_contributions():
'command_palette': command_palette,
'widgets': widgets,
'layouts': layouts,
+ 'tabs': tabs,
'ai': ai,
}
diff --git a/backend/app/services/extension_migration.py b/backend/app/services/extension_migration.py
index c79adb1b..cd4a261f 100644
--- a/backend/app/services/extension_migration.py
+++ b/backend/app/services/extension_migration.py
@@ -29,6 +29,7 @@ logger = logging.getLogger(__name__)
CONVERTED_BUILTIN_SLUGS = [
'serverkit-gpu',
'serverkit-workflows',
+ 'serverkit-ftp',
]
diff --git a/backend/tests/test_plugins_pipeline.py b/backend/tests/test_plugins_pipeline.py
index f0673e60..046ac197 100644
--- a/backend/tests/test_plugins_pipeline.py
+++ b/backend/tests/test_plugins_pipeline.py
@@ -51,10 +51,16 @@ def _write_builtin(builtin_dir, slug='serverkit-demo', version='1.0.0',
'contributions': {
'nav': [{'id': 'demo', 'label': 'Demo', 'route': '/demo',
'category': 'system', 'icon': '<circle cx="12" cy="12" r="8"/>'}],
- 'routes': [{'path': 'demo', 'component': 'DemoPage'}],
+ 'routes': [{'path': 'demo', 'component': 'DemoPage'},
+ {'path': 'demo-tab', 'component': 'DemoTabPage',
+ 'group': 'files'}],
'page_titles': {'/demo': 'Demo'},
'command_palette': [{'label': 'Demo', 'path': '/demo',
'category': 'Pages', 'keywords': 'demo'}],
+ # Tab-group contribution (#43): a tab added to a core-owned
+ # TabGroupLayout group, paired with the group route above.
+ 'tabs': [{'group': 'files', 'to': '/demo-tab', 'label': 'Demo Tab',
+ 'icon': '<circle cx="12" cy="12" r="8"/>'}],
},
}
(folder / 'plugin.json').write_text(json.dumps(manifest), encoding='utf-8')
@@ -157,7 +163,7 @@ def test_contributions_endpoint_envelope(app, client, auth_headers, plugin_dirs)
# The envelope always carries every key.
for key in ('nav', 'routes', 'page_titles', 'command_palette', 'widgets',
- 'layouts', 'ai'):
+ 'layouts', 'tabs', 'ai'):
assert key in data
# Contributions are tagged with the source plugin slug.
@@ -167,6 +173,13 @@ def test_contributions_endpoint_envelope(app, client, auth_headers, plugin_dirs)
for r in data['routes'])
assert data['page_titles'].get('/demo') == 'Demo'
+ # Tab-group contributions (#43): the tab entry and its group-nested route
+ # both survive the round-trip, tagged with the plugin slug.
+ assert any(t.get('plugin') == 'serverkit-demo' and t.get('group') == 'files'
+ and t.get('to') == '/demo-tab' for t in data['tabs'])
+ assert any(r.get('plugin') == 'serverkit-demo' and r.get('group') == 'files'
+ and r.get('component') == 'DemoTabPage' for r in data['routes'])
+
def test_disabled_plugin_drops_from_contributions(app, client, auth_headers, plugin_dirs):
_write_builtin(plugin_dirs['builtin'])
diff --git a/builtin-extensions/serverkit-ftp/frontend/index.jsx b/builtin-extensions/serverkit-ftp/frontend/index.jsx
new file mode 100644
index 00000000..9be9ae9d
--- /dev/null
+++ b/builtin-extensions/serverkit-ftp/frontend/index.jsx
@@ -0,0 +1,12 @@
+// FTP Server, contributed through the extension system. The page component and
+// its /api/v1/ftp backend stay in core for now (two-speed extraction, D2); this
+// extension owns the /ftp tab in the core Files group via a tab-group
+// contribution (#43) plus the routes/palette entries in its manifest.
+//
+// After sync this file lives at frontend/src/plugins/serverkit-ftp/ so the
+// relative import resolves against the host's pages directory.
+import FTPServer from '../../pages/FTPServer';
+
+export function FtpServerPage() {
+ return <FTPServer />;
+}
diff --git a/builtin-extensions/serverkit-ftp/plugin.json b/builtin-extensions/serverkit-ftp/plugin.json
new file mode 100644
index 00000000..27198e7d
--- /dev/null
+++ b/builtin-extensions/serverkit-ftp/plugin.json
@@ -0,0 +1,37 @@
+{
+ "name": "serverkit-ftp",
+ "display_name": "FTP Server",
+ "version": "1.0.0",
+ "description": "FTP server management (vsftpd/proftpd) — install, users, config and logs — as a tab in the Files group.",
+ "author": "ServerKit",
+ "license": "MIT",
+ "category": "utility",
+ "homepage": "https://github.com/jhd3197/ServerKit",
+ "permissions": ["shell", "filesystem"],
+ "icon": "<rect x=\"16\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"2\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"9\" y=\"2\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3\"/><path d=\"M12 12V8\"/>",
+ "contributions": {
+ "tabs": [
+ {
+ "group": "files",
+ "to": "/ftp",
+ "label": "FTP Server",
+ "icon": "<rect x=\"16\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"2\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"9\" y=\"2\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3\"/><path d=\"M12 12V8\"/>"
+ }
+ ],
+ "routes": [
+ { "path": "ftp", "component": "FtpServerPage", "group": "files" },
+ { "path": "ftp/:tab", "component": "FtpServerPage", "group": "files" }
+ ],
+ "page_titles": {
+ "/ftp": "FTP Server"
+ },
+ "command_palette": [
+ {
+ "label": "FTP Server",
+ "path": "/ftp",
+ "category": "Pages",
+ "keywords": "sftp upload vsftpd proftpd transfer"
+ }
+ ]
+ }
+}
diff --git a/docs/EXTENSIONS.md b/docs/EXTENSIONS.md
index 77ab7f34..7d84db11 100644
--- a/docs/EXTENSIONS.md
+++ b/docs/EXTENSIONS.md
@@ -107,6 +107,9 @@ tagged at runtime with its source `plugin` slug so the frontend can resolve
],
"widgets": [ { "slot": "dashboard.top", "component": "GitStatusWidget" } ],
"layouts": [ { "id": "my-fullscreen", "component": "MyLayout" } ],
+ "tabs": [
+ { "group": "files", "to": "/ftp", "label": "FTP Server", "icon": "<rect …/>" }
+ ],
"ai": {
"suggested_prompts": [ { "route": "/git", "label": "…", "prompt": "…" } ],
"tool_renderers": [ { "tool": "git__list_branches", "component": "BranchList" } ]
@@ -117,11 +120,12 @@ tagged at runtime with its source `plugin` slug so the frontend can resolve
| Kind | Shape | Notes |
|---|---|---|
| `nav` | `{id,label,route,category,icon,requiresCondition?}` | `icon` is raw inner-SVG markup. `category`: overview/infrastructure/operations/system. Merged into the sidebar; deduped by `id`. |
-| `routes` | `{path,component,layout?}` | `component` = a named export of the plugin's `index.{js,jsx}`. `layout`: `padded` (default) / `full` / `bare` / a custom layout id. |
+| `routes` | `{path,component,layout?,group?}` | `component` = a named export of the plugin's `index.{js,jsx}`. `layout`: `padded` (default) / `full` / `bare` / a custom layout id. `group` nests the route inside a core tab group instead — see [Tab-group contributions](#tab-group-contributions). |
| `page_titles` | `{ "/path": "Title" }` | Sets `document.title`. |
| `command_palette` | `{label,path,category,keywords}` | `category` defaults to `Extensions`. |
| `widgets` | `{slot,component}` | Slots: `global` (renders inside DashboardLayout), plus the enrich-core slots (`dashboard.top`, `service.detail.tab`, `domain.drawer.panel`). |
| `layouts` | `{id,component}` | Custom wrappers; the component must render `<Outlet/>`. Built-in ids `padded`/`full`/`bare` are reserved. |
+| `tabs` | `{group,to,label,icon?,end?,order?}` | Adds a tab to a core-owned tab group. `group` = the group id (`files` / `servers` / `monitoring`). See [Tab-group contributions](#tab-group-contributions). |
| `ai` | `{suggested_prompts,tool_renderers}` | See [AI](#extending-the-ai-assistant). |
### Route layouts
@@ -132,6 +136,36 @@ tagged at runtime with its source `plugin` slug so the frontend can resolve
fullscreen authenticated pages.
- `<custom-id>` — wrapped in a `layouts`-contributed component.
+### Tab-group contributions
+
+Some core surfaces are **tab groups** (one shared `PageTopbar` + routed tabs,
+rendered by `TabGroupLayout`). An extension can add a tab to one of these
+groups instead of contributing a standalone page, so its feature sits where
+users expect it (e.g. FTP as a tab of Files) and the group's chrome stays.
+
+Two halves, both required:
+
+```jsonc
+"tabs": [ { "group": "files", "to": "/ftp", "label": "FTP Server",
+ "icon": "<rect …/>", "order": 1 } ],
+"routes": [ { "path": "ftp", "component": "FtpServerPage", "group": "files" },
+ { "path": "ftp/:tab", "component": "FtpServerPage", "group": "files" } ]
+```
+
+- The `tabs` entry puts the tab in the strip; the `group`-tagged routes render
+ the page **inside** that group's `TabGroupLayout` (a `group` route ignores
+ `layout`).
+- `group` ids match the group's **sidebar item id**: `files`, `servers`,
+ `monitoring`. The host also extends that sidebar item's highlight to the
+ contributed tab's path, so the group stays lit. (Other groups can accept
+ contributions later by passing `groupId` to their `TabGroupLayout` in
+ `App.jsx`.)
+- `icon` is raw inner-SVG markup (24×24 viewBox, stroked), like nav icons.
+ `order` is an optional insertion index; default appends after the core tabs.
+ Core tabs always win a `to` collision.
+- Pages rendered in a tab group must not render their own top bar; publish
+ actions via the `useTopbarActions()` outlet context like core tab pages do.
+
---
## The production frontend constraint
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 401306f6..dd13deb0 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -21,7 +21,6 @@ import Backups from './pages/Backups';
import Terminal from './pages/Terminal';
import Settings from './pages/Settings';
import FileManager from './pages/FileManager';
-import FTPServer from './pages/FTPServer';
// Firewall is now part of Security page
import CronJobs from './pages/CronJobs';
import Security from './pages/Security';
@@ -97,7 +96,6 @@ const PAGE_TITLES = {
'/servers': 'Servers',
'/downloads': 'Downloads',
'/files': 'File Manager',
- '/ftp': 'FTP Server',
'/observability': 'Observability',
'/monitoring': 'Monitoring',
'/backups': 'Backups',
@@ -249,7 +247,7 @@ function LegacyGitExtRedirect() {
}
function AppRoutes() {
- const { dashboardRoutes, standaloneGroups } = useExtensionRoutes();
+ const { dashboardRoutes, groupRoutes, standaloneGroups } = useExtensionRoutes();
return (
<Routes>
<Route path="/migrate" element={<DatabaseMigration />} />
@@ -343,7 +341,7 @@ function AppRoutes() {
<Route path="databases/:tab" element={<Databases />} />
<Route path="docker" element={<Docker />} />
<Route path="docker/:tab" element={<Docker />} />
- <Route element={<TabGroupLayout tabs={SERVER_TABS} />}>
+ <Route element={<TabGroupLayout tabs={SERVER_TABS} groupId="servers" />}>
<Route path="servers" element={<Servers />} />
<Route path="fleet" element={<AgentFleet />} />
<Route path="fleet-monitor" element={<FleetMonitor />} />
@@ -351,6 +349,7 @@ function AppRoutes() {
<Route path="cloud" element={<CloudProvision />} />
<Route path="remote-access" element={<RemoteAccess />} />
<Route path="server-templates" element={<ServerTemplates />} />
+ {groupRoutes.servers}
</Route>
<Route path="servers/:id" element={<ServerDetail />} />
<Route path="servers/:id/:tab" element={<ServerDetail />} />
@@ -381,18 +380,22 @@ function AppRoutes() {
<Route path="firewall" element={<Navigate to="/security/firewall" replace />} />
<Route path="git-ext" element={<LegacyGitExtRedirect />} />
<Route path="git-ext/:tab" element={<LegacyGitExtRedirect />} />
- <Route element={<TabGroupLayout tabs={FILE_TABS} />}>
+ {/* /ftp is now the serverkit-ftp builtin extension: it joins
+ this group via a tabs contribution + group-nested routes
+ (groupRoutes.files), so tab + page disappear together when
+ it's uninstalled. */}
+ <Route element={<TabGroupLayout tabs={FILE_TABS} groupId="files" />}>
<Route path="files" element={<FileManager />} />
- <Route path="ftp" element={<FTPServer />} />
- <Route path="ftp/:tab" element={<FTPServer />} />
+ {groupRoutes.files}
</Route>
{/* Observability tab group (§4): Monitoring / Events / Status
Pages share one PageTopbar. /observability lands on Monitoring. */}
- <Route element={<TabGroupLayout tabs={MONITOR_TABS} />}>
+ <Route element={<TabGroupLayout tabs={MONITOR_TABS} groupId="monitoring" />}>
<Route path="monitoring" element={<Monitoring />} />
<Route path="monitoring/:tab" element={<Monitoring />} />
<Route path="telemetry" element={<Telemetry />} />
<Route path="status-pages" element={<StatusPages />} />
+ {groupRoutes.monitoring}
</Route>
<Route path="observability" element={<Navigate to="/monitoring" replace />} />
{/* /gpu is now the serverkit-gpu builtin extension. */}
diff --git a/frontend/src/components/CommandPalette.jsx b/frontend/src/components/CommandPalette.jsx
index ab066729..2196241e 100644
--- a/frontend/src/components/CommandPalette.jsx
+++ b/frontend/src/components/CommandPalette.jsx
@@ -21,7 +21,7 @@ const STATIC_PAGES = [
{ label: 'Deployments', path: '/deployments', category: 'Pages', keywords: 'deploy jobs status logs' },
// WordPress palette entries are contributed by the serverkit-wordpress extension.
{ label: 'Files', path: '/files', category: 'Pages', keywords: 'file manager explorer' },
- { label: 'FTP Server', path: '/ftp', category: 'Pages', keywords: 'sftp upload' },
+ // The FTP Server palette entry is contributed by the serverkit-ftp extension.
{ label: 'Observability', path: '/monitoring', category: 'Pages', keywords: 'metrics uptime monitoring alerts' },
{ label: 'Backups', path: '/backups', category: 'Pages', keywords: 'snapshots restore' },
{ label: 'Cron Jobs', path: '/cron', category: 'Pages', keywords: 'schedule tasks' },
diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx
index 6633da80..9af0732b 100644
--- a/frontend/src/components/Sidebar.jsx
+++ b/frontend/src/components/Sidebar.jsx
@@ -136,7 +136,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
api.updateCurrentUser({ sidebar_config: config }).catch(() => {});
};
- const { nav: pluginNav } = useContributions();
+ const { nav: pluginNav, tabs: pluginTabs } = useContributions();
const visibleItems = useMemo(() => {
const core = getVisibleItems(user?.sidebar_config);
@@ -159,9 +159,22 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
// only when a GPU is present, or the Email/WordPress modules being
// enabled), mirroring sub-item requiresCondition.
const conds = { wpInstalled, gpuAvailable, wordpressEnabled };
- const items = [...core, ...fromPlugins].filter(
+ let items = [...core, ...fromPlugins].filter(
(item) => !item.requiresCondition || conds[item.requiresCondition]
);
+ // Extension-contributed tab-group tabs (#43) keep the host group's
+ // sidebar item lit on extension-owned tab routes (group id == sidebar
+ // item id) — the core matchPrefixes only cover the group's own tabs.
+ const tabPrefixes = {};
+ for (const t of (pluginTabs || [])) {
+ if (!t || !t.group || !t.to) continue;
+ (tabPrefixes[t.group] = tabPrefixes[t.group] || []).push(t.to);
+ }
+ items = items.map((item) => (
+ tabPrefixes[item.id]
+ ? { ...item, matchPrefixes: [...(item.matchPrefixes || []), ...tabPrefixes[item.id]] }
+ : item
+ ));
// Apply workspace-level nav permissions if an active workspace is set
// and it defines a nav map. This lets a workspace restrict which sidebar
// items its members see based on their effective workspace role.
@@ -175,7 +188,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
}
}
return applyWorkspaceNavPermissions(items, activeWorkspace, user);
- }, [user?.sidebar_config, pluginNav, wpInstalled, gpuAvailable, wordpressEnabled, user]);
+ }, [user?.sidebar_config, pluginNav, pluginTabs, wpInstalled, gpuAvailable, wordpressEnabled, user]);
// Group visible items by category
const groupedItems = useMemo(() => {
diff --git a/frontend/src/components/files/fileTabs.jsx b/frontend/src/components/files/fileTabs.jsx
index 1004d1f3..e857aa0f 100644
--- a/frontend/src/components/files/fileTabs.jsx
+++ b/frontend/src/components/files/fileTabs.jsx
@@ -1,9 +1,10 @@
-import { FolderOpen, Network } from 'lucide-react';
+import { FolderOpen } from 'lucide-react';
-// Shared sub-nav for the Files page group (Files / FTP Server). Rendered in each
-// page's <PageTopbar tabs={FILE_TABS}> — the demo's top-bar layout replaces the
+// Shared sub-nav for the Files page group. Rendered in each page's
+// <PageTopbar tabs={FILE_TABS}> — the demo's top-bar layout replaces the
// old sidebar sub-menu (see docs/REDESIGN_MAP.md §6 decision 3).
+// The FTP Server tab is contributed by the serverkit-ftp builtin extension
+// (tab-group contribution, #43) and merged in by TabGroupLayout groupId="files".
export const FILE_TABS = [
{ to: '/files', label: 'Files', end: true, icon: <FolderOpen size={15} /> },
- { to: '/ftp', label: 'FTP Server', icon: <Network size={15} /> },
];
diff --git a/frontend/src/layouts/TabGroupLayout.jsx b/frontend/src/layouts/TabGroupLayout.jsx
index 89e54f39..5f07f99e 100644
--- a/frontend/src/layouts/TabGroupLayout.jsx
+++ b/frontend/src/layouts/TabGroupLayout.jsx
@@ -1,6 +1,8 @@
import { useState, useMemo } from 'react';
import { Outlet, useLocation } from 'react-router-dom';
import { PageTopbar } from '@/components/ds';
+import { useContributions } from '@/plugins/contributions';
+import { sanitizeSvgInner } from '@/utils/sanitizeSvg';
// Generic shell for a PageTopbar tab group (Servers, Domains, Services, Files,
// Monitoring, Marketplace, …). A parent route renders the PageTopbar + routed
@@ -14,21 +16,76 @@ import { PageTopbar } from '@/components/ds';
// <Route path="dns" element={<DNSZones />} />
// <Route path="ssl" element={<SSLCertificates />} />
// </Route>
+//
+// Groups that accept extension-contributed tabs (#43) also pass a `groupId`
+// (== the group's sidebar item id): installed extensions can then add entries
+// to the strip via a `tabs` contribution, paired with `group`-nested routes
+// mounted by App.jsx inside this same parent <Route>.
function matchTab(tab, path) {
if (tab.end) return path === tab.to;
// Segment-aware so "/fleet" doesn't swallow "/fleet-monitor".
return path === tab.to || path.startsWith(tab.to + '/');
}
-export default function TabGroupLayout({ tabs }) {
+// Contributed tab icons arrive as raw inner-SVG markup (same convention as
+// sidebar nav icons); wrap them in the lucide-compatible svg shell the core
+// tab entries use.
+function contributedIcon(inner) {
+ if (!inner) return null;
+ return (
+ <svg
+ width={15}
+ height={15}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ focusable="false"
+ dangerouslySetInnerHTML={{ __html: sanitizeSvgInner(inner) }}
+ />
+ );
+}
+
+export default function TabGroupLayout({ tabs, groupId }) {
const location = useLocation();
const [actions, setActions] = useState(null);
+ const { tabs: contributedTabs } = useContributions();
+
+ // Merge extension-contributed tabs for this group into the strip.
+ // Dedup by `to` (core wins); optional numeric `order` picks the
+ // insertion index, default appends at the end.
+ const mergedTabs = useMemo(() => {
+ if (!groupId) return tabs;
+ const extras = (contributedTabs || [])
+ .filter((t) => t && t.group === groupId && t.to && t.label)
+ .filter((t) => !tabs.some((core) => core.to === t.to))
+ .map((t) => ({
+ to: t.to,
+ label: t.label,
+ end: !!t.end,
+ icon: contributedIcon(t.icon),
+ order: t.order,
+ }));
+ if (!extras.length) return tabs;
+ const merged = [...tabs];
+ for (const t of extras) {
+ const { order, ...tab } = t;
+ const idx = Number.isInteger(order)
+ ? Math.min(Math.max(order, 0), merged.length)
+ : merged.length;
+ merged.splice(idx, 0, tab);
+ }
+ return merged;
+ }, [tabs, groupId, contributedTabs]);
// Title + icon mirror the active tab so the header always matches the lit
// sub-nav item.
const active = useMemo(
- () => tabs.find((t) => matchTab(t, location.pathname)) || tabs[0],
- [tabs, location.pathname]
+ () => mergedTabs.find((t) => matchTab(t, location.pathname)) || mergedTabs[0],
+ [mergedTabs, location.pathname]
);
return (
@@ -36,7 +93,7 @@ export default function TabGroupLayout({ tabs }) {
<PageTopbar
icon={active.icon}
title={active.label}
- tabs={tabs}
+ tabs={mergedTabs}
actions={actions}
/>
<div className="sk-tabgroup__content">
diff --git a/frontend/src/plugins/ExtensionRoutes.jsx b/frontend/src/plugins/ExtensionRoutes.jsx
index b55b3b50..dadede9a 100644
--- a/frontend/src/plugins/ExtensionRoutes.jsx
+++ b/frontend/src/plugins/ExtensionRoutes.jsx
@@ -6,6 +6,14 @@
* dashboardRoutes — render inside <DashboardLayout/> alongside core
* pages (layout: 'padded' (default) | 'full').
*
+ * groupRoutes — routes with a `group` field render INSIDE that
+ * core tab group's TabGroupLayout (tab-group
+ * contribution, #43). App.jsx mounts
+ * groupRoutes[<groupId>] as children of the
+ * matching group's parent <Route>, so the shared
+ * PageTopbar chrome stays. Pair with a `tabs`
+ * contribution so the strip shows the tab.
+ *
* standaloneGroups — render OUTSIDE DashboardLayout. One group per
* distinct layout id (built-in 'bare' or any
* plugin-contributed layout). App.jsx wraps each
@@ -59,12 +67,24 @@ export default function useExtensionRoutes() {
const { routes, layouts } = useContributions();
const dashboardRoutes = [];
+ const groupRoutes = {};
const groupsByLayout = new Map();
(routes || []).forEach((contrib, i) => {
const key = `${contrib.plugin}:${contrib.path}:${i}`;
const layoutId = contrib.layout || 'padded';
+ // Tab-group nested route (#43): collected per core group id and
+ // mounted by App.jsx inside that group's TabGroupLayout <Route>.
+ if (contrib.group) {
+ const node = buildRoute(contrib, key);
+ if (node) {
+ if (!groupRoutes[contrib.group]) groupRoutes[contrib.group] = [];
+ groupRoutes[contrib.group].push(node);
+ }
+ return;
+ }
+
if (isInsideDashboard(layoutId)) {
const node = buildRoute(contrib, key);
if (node) dashboardRoutes.push(node);
@@ -96,6 +116,7 @@ export default function useExtensionRoutes() {
return {
dashboardRoutes,
+ groupRoutes,
standaloneGroups: Array.from(groupsByLayout.values()),
};
}
diff --git a/frontend/src/plugins/contributions.js b/frontend/src/plugins/contributions.js
index fcfd19bb..16495138 100644
--- a/frontend/src/plugins/contributions.js
+++ b/frontend/src/plugins/contributions.js
@@ -75,6 +75,11 @@ const EMPTY = {
command_palette: [],
widgets: [],
layouts: [],
+ // Tabs contributed into core-owned TabGroupLayout groups (#43):
+ // { group, to, label, icon?, end?, order? }. `group` is the core group id
+ // (== the sidebar item id: files | servers | monitoring). Consumed by
+ // TabGroupLayout (tab strip merge) + Sidebar (group item stays lit).
+ tabs: [],
// AI assistant contributions: per-route suggested prompts + custom
// tool-result renderers. Consumed by the core AIAssistant via
// useContributions().ai.
@@ -106,6 +111,7 @@ function getBuildTimeContributions() {
const command_palette = [];
const widgets = [];
const layouts = [];
+ const tabs = [];
const ai = { suggested_prompts: [], tool_renderers: [] };
for (const entry of installed) {
@@ -121,6 +127,7 @@ function getBuildTimeContributions() {
command_palette.push(...tagItems(contrib.command_palette, slug));
widgets.push(...tagItems(contrib.widgets, slug));
layouts.push(...tagItems(contrib.layouts, slug));
+ tabs.push(...tagItems(contrib.tabs, slug));
if (contrib.ai && typeof contrib.ai === 'object') {
ai.suggested_prompts.push(...tagItems(contrib.ai.suggested_prompts, slug));
@@ -139,6 +146,7 @@ function getBuildTimeContributions() {
command_palette,
widgets,
layouts,
+ tabs,
ai,
};
}
diff --git a/frontend/src/plugins/serverkit-ftp/index.jsx b/frontend/src/plugins/serverkit-ftp/index.jsx
new file mode 100644
index 00000000..9be9ae9d
--- /dev/null
+++ b/frontend/src/plugins/serverkit-ftp/index.jsx
@@ -0,0 +1,12 @@
+// FTP Server, contributed through the extension system. The page component and
+// its /api/v1/ftp backend stay in core for now (two-speed extraction, D2); this
+// extension owns the /ftp tab in the core Files group via a tab-group
+// contribution (#43) plus the routes/palette entries in its manifest.
+//
+// After sync this file lives at frontend/src/plugins/serverkit-ftp/ so the
+// relative import resolves against the host's pages directory.
+import FTPServer from '../../pages/FTPServer';
+
+export function FtpServerPage() {
+ return <FTPServer />;
+}
diff --git a/frontend/src/plugins/serverkit-ftp/plugin.json b/frontend/src/plugins/serverkit-ftp/plugin.json
new file mode 100644
index 00000000..3521cb1a
--- /dev/null
+++ b/frontend/src/plugins/serverkit-ftp/plugin.json
@@ -0,0 +1,48 @@
+{
+ "name": "serverkit-ftp",
+ "display_name": "FTP Server",
+ "version": "1.0.0",
+ "description": "FTP server management (vsftpd/proftpd) — install, users, config and logs — as a tab in the Files group.",
+ "author": "ServerKit",
+ "license": "MIT",
+ "category": "utility",
+ "homepage": "https://github.com/jhd3197/ServerKit",
+ "permissions": [
+ "shell",
+ "filesystem"
+ ],
+ "icon": "<rect x=\"16\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"2\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"9\" y=\"2\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3\"/><path d=\"M12 12V8\"/>",
+ "contributions": {
+ "tabs": [
+ {
+ "group": "files",
+ "to": "/ftp",
+ "label": "FTP Server",
+ "icon": "<rect x=\"16\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"2\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"9\" y=\"2\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3\"/><path d=\"M12 12V8\"/>"
+ }
+ ],
+ "routes": [
+ {
+ "path": "ftp",
+ "component": "FtpServerPage",
+ "group": "files"
+ },
+ {
+ "path": "ftp/:tab",
+ "component": "FtpServerPage",
+ "group": "files"
+ }
+ ],
+ "page_titles": {
+ "/ftp": "FTP Server"
+ },
+ "command_palette": [
+ {
+ "label": "FTP Server",
+ "path": "/ftp",
+ "category": "Pages",
+ "keywords": "sftp upload vsftpd proftpd transfer"
+ }
+ ]
+ }
+}