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.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Make Git extension canonical at /git
Juan Denis3c4a2c0c9629
diff --git a/backend/app/api/plugins.py b/backend/app/api/plugins.pyindex 7e99ded4..4e6e3a74 100644--- a/backend/app/api/plugins.py+++ b/backend/app/api/plugins.py@@ -244,8 +244,8 @@ def list_builtin():"""Enumerate bundled extensions in BUILTIN_EXTENSIONS_DIR.Used by the Marketplace UI to show one-click installs for plugins- that ship with the repo (e.g. the opt-in Git wrapper) without- making the user paste an absolute path.+ that ship with the repo (e.g. the Git extension) without making the+ user paste an absolute path."""from app.services.plugin_service import list_builtin_extensionsreturn jsonify({'builtin': list_builtin_extensions()})diff --git a/backend/migrations/versions/007_canonical_git_extension_route.py b/backend/migrations/versions/007_canonical_git_extension_route.pynew file mode 100644index 00000000..5c29029d--- /dev/null+++ b/backend/migrations/versions/007_canonical_git_extension_route.py@@ -0,0 +1,90 @@+"""Move bundled Git extension contributions to canonical /git.++Revision ID: 007_canonical_git_extension_route+Revises: 006_default_full_permissions+Create Date: 2026-05-03+"""++from alembic import op+import sqlalchemy as sa+import json++revision = '007_canonical_git_extension_route'+down_revision = '006_default_full_permissions'+branch_labels = None+depends_on = None+++GIT_MANIFEST = {+ 'name': 'serverkit-git',+ 'display_name': 'Git Server',+ 'version': '1.0.0',+ 'description': 'Self-hosted Git server (Gitea) exposed through the ServerKit extension system.',+ 'author': 'ServerKit',+ 'license': 'MIT',+ 'category': 'deployment',+ 'homepage': 'https://github.com/jhd3197/ServerKit',+ 'permissions': ['docker', 'filesystem'],+ 'contributions': {+ 'nav': [+ {+ 'id': 'git',+ 'label': 'Git',+ 'route': '/git',+ 'category': 'infrastructure',+ 'icon': '<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/>',+ },+ ],+ 'routes': [+ {'path': 'git', 'component': 'GitExtensionPage'},+ {'path': 'git/:tab', 'component': 'GitExtensionPage'},+ ],+ 'page_titles': {+ '/git': 'Git Repositories',+ },+ 'command_palette': [+ {+ 'label': 'Git',+ 'path': '/git',+ 'category': 'Pages',+ 'keywords': 'git repos deploy extension plugin',+ },+ ],+ },+}+++def upgrade():+ conn = op.get_bind()+ inspector = sa.inspect(conn)+ if 'installed_plugins' not in inspector.get_table_names():+ return++ cols = {c['name'] for c in inspector.get_columns('installed_plugins')}+ if not {'slug', 'manifest_json'}.issubset(cols):+ return++ values = {+ 'slug': 'serverkit-git',+ 'display_name': GIT_MANIFEST['display_name'],+ 'description': GIT_MANIFEST['description'],+ 'manifest_json': json.dumps(GIT_MANIFEST),+ }+ assignments = ['manifest_json = :manifest_json']+ if 'display_name' in cols:+ assignments.append('display_name = :display_name')+ if 'description' in cols:+ assignments.append('description = :description')++ conn.execute(+ sa.text(+ f"UPDATE installed_plugins SET {', '.join(assignments)} WHERE slug = :slug"+ ),+ values,+ )+++def downgrade():+ # Keep the canonical route. Reintroducing /git-ext would recreate the+ # duplicated Git/Git (ext) UI this migration removes.+ passdiff --git a/builtin-extensions/serverkit-git/frontend/index.jsx b/builtin-extensions/serverkit-git/frontend/index.jsxindex 7820887a..b46c71a3 100644--- a/builtin-extensions/serverkit-git/frontend/index.jsx+++ b/builtin-extensions/serverkit-git/frontend/index.jsx@@ -1,14 +1,16 @@-// Re-exports the existing host Git page as GitExtPage so the-// contribution system can mount it at /git-ext while the hardcoded-// /git route stays in place. Both routes hit the same /api/v1/git-// backend and share state — this is intentional, the extension is-// the same feature surfaced through the opt-in plugin pipeline so-// you can A/B the two install paths.+// Re-exports the existing host Git page through the extension system.+// The extension owns the canonical /git route; the host keeps the page+// component as implementation detail until the Git UI is fully split.//// After install, this file lives at frontend/src/plugins/serverkit-git/// so the relative import resolves against the host's pages directory.import GitPage from '../../pages/Git';-export function GitExtPage() {- return <GitPage basePath="/git-ext" />;+export function GitExtensionPage() {+ return <GitPage basePath="/git" />;}++// Backward compatibility for older installed manifests that still point+// at GitExtPage. Contribution normalization rewrites those manifests, but+// keeping the export avoids a blank route if stale metadata slips through.+export const GitExtPage = GitExtensionPage;diff --git a/builtin-extensions/serverkit-git/plugin.json b/builtin-extensions/serverkit-git/plugin.jsonindex 9d21de00..181b4ea8 100644--- a/builtin-extensions/serverkit-git/plugin.json+++ b/builtin-extensions/serverkit-git/plugin.json@@ -1,8 +1,8 @@{"name": "serverkit-git",- "display_name": "Git Server (extension)",+ "display_name": "Git Server","version": "1.0.0",- "description": "Self-hosted Git server (Gitea) wrapper exposed as the /git-ext route. Runs alongside the built-in /git page so you can compare the opt-in extension flow against the hardcoded one.",+ "description": "Self-hosted Git server (Gitea) exposed through the ServerKit extension system.","author": "ServerKit","license": "MIT","category": "deployment",@@ -11,26 +11,26 @@"contributions": {"nav": [{- "id": "git-ext",- "label": "Git (ext)",- "route": "/git-ext",+ "id": "git",+ "label": "Git",+ "route": "/git","category": "infrastructure","icon": "<circle cx=\"18\" cy=\"18\" r=\"3\"/><circle cx=\"6\" cy=\"6\" r=\"3\"/><path d=\"M6 21V9a9 9 0 0 0 9 9\"/>"}],"routes": [- { "path": "git-ext", "component": "GitExtPage" },- { "path": "git-ext/:tab", "component": "GitExtPage" }+ { "path": "git", "component": "GitExtensionPage" },+ { "path": "git/:tab", "component": "GitExtensionPage" }],"page_titles": {- "/git-ext": "Git (extension)"+ "/git": "Git Repositories"},"command_palette": [{- "label": "Git (extension)",- "path": "/git-ext",+ "label": "Git",+ "path": "/git","category": "Pages",- "keywords": "git repos extension plugin"+ "keywords": "git repos deploy extension plugin"}]}diff --git a/frontend/src/App.jsx b/frontend/src/App.jsxindex c342d436..79b004d9 100644--- a/frontend/src/App.jsx+++ b/frontend/src/App.jsx@@ -1,5 +1,5 @@import { useEffect } from 'react';-import { BrowserRouter as Router, Routes, Route, Navigate, useLocation } from 'react-router-dom';+import { BrowserRouter as Router, Routes, Route, Navigate, useLocation, useParams } from 'react-router-dom';import { AuthProvider, useAuth } from './contexts/AuthContext';import { ToastProvider } from './contexts/ToastContext';import { ThemeProvider } from './contexts/ThemeContext';@@ -20,9 +20,8 @@ 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 Git from './pages/Git';-import CronJobs from './pages/CronJobs';+// Firewall is now part of Security page+import CronJobs from './pages/CronJobs';import Security from './pages/Security';import Services from './pages/Services';import NewService from './pages/NewService';@@ -77,7 +76,6 @@ const PAGE_TITLES = {'/docker': 'Docker','/servers': 'Servers','/downloads': 'Downloads',- '/git': 'Git Repositories','/files': 'File Manager','/ftp': 'FTP Server','/monitoring': 'Monitoring',@@ -171,7 +169,7 @@ function PublicRoute({ children }) {return isAuthenticated ? <Navigate to="/" /> : children;}-function SetupRoute({ children }) {+function SetupRoute({ children }) {const { loading, needsSetup, isAuthenticated } = useAuth();if (loading) {@@ -184,9 +182,14 @@ function SetupRoute({ children }) {}return children;-}--function AppRoutes() {+}++function LegacyGitExtRedirect() {+ const { tab } = useParams();+ return <Navigate to={tab ? `/git/${tab}` : '/git'} replace />;+}++function AppRoutes() {const { dashboardRoutes, standaloneGroups } = useExtensionRoutes();return (<Routes>@@ -275,12 +278,12 @@ function AppRoutes() {<Route path="style-guide/:tab" element={<StyleGuide />} /><Route path="app-map" element={<AppMap />} /><Route path="app-map/:tab" element={<AppMap />} />- <Route path="documentation" element={<Documentation />} />- <Route path="downloads" element={<Downloads />} />- <Route path="firewall" element={<Navigate to="/security/firewall" replace />} />- <Route path="git" element={<Git />} />- <Route path="git/:tab" element={<Git />} />- <Route path="files" element={<FileManager />} />+ <Route path="documentation" element={<Documentation />} />+ <Route path="downloads" element={<Downloads />} />+ <Route path="firewall" element={<Navigate to="/security/firewall" replace />} />+ <Route path="git-ext" element={<LegacyGitExtRedirect />} />+ <Route path="git-ext/:tab" element={<LegacyGitExtRedirect />} />+ <Route path="files" element={<FileManager />} /><Route path="ftp" element={<FTPServer />} /><Route path="ftp/:tab" element={<FTPServer />} /><Route path="monitoring" element={<Monitoring />} />diff --git a/frontend/src/components/CommandPalette.jsx b/frontend/src/components/CommandPalette.jsxindex e21fb1eb..c068baf6 100644--- a/frontend/src/components/CommandPalette.jsx+++ b/frontend/src/components/CommandPalette.jsx@@ -22,7 +22,6 @@ const STATIC_PAGES = [{ label: 'Workflow Builder', path: '/workflow', category: 'Pages', keywords: 'automation pipeline' },{ label: 'WordPress', path: '/wordpress', category: 'Pages', keywords: 'wp sites' },{ label: 'WordPress Projects', path: '/wordpress/projects', category: 'Pages', keywords: 'wp environments' },- { label: 'Git', path: '/git', category: 'Pages', keywords: 'repos deploy' },{ label: 'Files', path: '/files', category: 'Pages', keywords: 'file manager explorer' },{ label: 'FTP Server', path: '/ftp', category: 'Pages', keywords: 'sftp upload' },{ label: 'Monitoring', path: '/monitoring', category: 'Pages', keywords: 'metrics uptime' },diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsxindex 3501131a..017d6429 100644--- a/frontend/src/components/Sidebar.jsx+++ b/frontend/src/components/Sidebar.jsx@@ -5,7 +5,7 @@ import { useTheme } from '../contexts/ThemeContext';import { Star, Settings, LogOut, Sun, Moon, Monitor, ChevronRight, ChevronDown, ChevronUp, Layers, Palette, PanelLeft, Check } from 'lucide-react';import { api } from '../services/api';import ServerKitLogo from './ServerKitLogo';-import { SIDEBAR_CATEGORIES, CATEGORY_LABELS, SIDEBAR_PRESETS, getVisibleItems, SIDEBAR_ITEMS } from './sidebarItems';+import { SIDEBAR_CATEGORIES, CATEGORY_LABELS, SIDEBAR_PRESETS, getHiddenItemIds, getVisibleItems } from './sidebarItems';import { useContributions } from '../plugins/contributions';const Sidebar = () => {@@ -94,12 +94,17 @@ const Sidebar = () => {const visibleItems = useMemo(() => {const core = getVisibleItems(user?.sidebar_config);+ const hiddenIds = getHiddenItemIds(user?.sidebar_config);// Merge contributed nav items, dedup by id (core wins). Plugins// can claim a category; default to 'system' so they always land// somewhere visible.const existingIds = new Set(core.map((i) => i.id));const fromPlugins = (pluginNav || [])- .filter((item) => item && item.id && item.route && !existingIds.has(item.id))+ .filter((item) => (+ item && item.id && item.route+ && !existingIds.has(item.id)+ && !hiddenIds.has(item.id)+ )).map((item) => ({...item,category: item.category || 'system',diff --git a/frontend/src/components/sidebarItems.js b/frontend/src/components/sidebarItems.jsindex 322e2837..3886bd10 100644--- a/frontend/src/components/sidebarItems.js+++ b/frontend/src/components/sidebarItems.js@@ -88,13 +88,6 @@ export const SIDEBAR_ITEMS = [category: 'infrastructure',icon: '<rect x="2" y="7" width="6" height="6" rx="1"/><rect x="9" y="7" width="6" height="6" rx="1"/><rect x="16" y="7" width="6" height="6" rx="1"/><rect x="2" y="14" width="6" height="6" rx="1"/><rect x="9" y="14" width="6" height="6" rx="1"/>'},- {- id: 'git',- label: 'Git',- route: '/git',- category: 'infrastructure',- icon: '<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/>'- },{id: 'files',label: 'Files',@@ -198,15 +191,21 @@ export const SIDEBAR_PRESETS = {}};-// Get visible items based on config-export function getVisibleItems(sidebarConfig) {+export function getHiddenItemIds(sidebarConfig) {const { preset = 'full', hiddenItems = [] } = sidebarConfig || {};const hidden = preset === 'custom'? hiddenItems: (SIDEBAR_PRESETS[preset]?.hiddenItems || []);+ return new Set(hidden);+}++// Get visible items based on config+export function getVisibleItems(sidebarConfig) {+ const hidden = getHiddenItemIds(sidebarConfig);+return SIDEBAR_ITEMS.filter(item =>- item.alwaysVisible || !hidden.includes(item.id)+ item.alwaysVisible || !hidden.has(item.id));}diff --git a/frontend/src/plugins/contributions.js b/frontend/src/plugins/contributions.jsindex 6f592ce5..ced7417d 100644--- a/frontend/src/plugins/contributions.js+++ b/frontend/src/plugins/contributions.js@@ -77,6 +77,63 @@ const EMPTY = {layouts: [],};+const GIT_PLUGIN_SLUG = 'serverkit-git';+const GIT_ICON = '<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/>';++function normalizeContributions(value) {+ const out = { ...EMPTY, ...(value || {}) };+ const hasGitPlugin = [+ ...(out.nav || []),+ ...(out.routes || []),+ ...(out.command_palette || []),+ ].some((item) => item?.plugin === GIT_PLUGIN_SLUG);++ if (!hasGitPlugin) return out;++ const oldGitNav = (out.nav || []).find((item) => item?.plugin === GIT_PLUGIN_SLUG);++ // Compatibility for the initial Git extension experiment, which+ // contributed /git-ext while the host still owned /git. The extension+ // is now the canonical Git surface.+ return {+ ...out,+ nav: [+ ...(out.nav || []).filter((item) => item?.plugin !== GIT_PLUGIN_SLUG),+ {+ ...oldGitNav,+ plugin: GIT_PLUGIN_SLUG,+ id: 'git',+ label: 'Git',+ route: '/git',+ category: oldGitNav?.category || 'infrastructure',+ icon: oldGitNav?.icon || GIT_ICON,+ },+ ],+ routes: [+ ...(out.routes || []).filter((item) => item?.plugin !== GIT_PLUGIN_SLUG),+ { plugin: GIT_PLUGIN_SLUG, path: 'git', component: 'GitExtensionPage' },+ { plugin: GIT_PLUGIN_SLUG, path: 'git/:tab', component: 'GitExtensionPage' },+ ],+ page_titles: {+ ...(Object.fromEntries(+ Object.entries(out.page_titles || {})+ .filter(([path]) => path !== '/git-ext')+ )),+ '/git': 'Git Repositories',+ },+ command_palette: [+ ...(out.command_palette || []).filter((item) => item?.plugin !== GIT_PLUGIN_SLUG),+ {+ plugin: GIT_PLUGIN_SLUG,+ label: 'Git',+ path: '/git',+ category: 'Pages',+ keywords: 'git repos deploy extension plugin',+ },+ ],+ };+}+function tagItems(items, slug) {return (items || []).filter((item) => item && typeof item === 'object')@@ -162,7 +219,7 @@ function notify(value) {export function refreshContributions() {cachedPromise = api.getPluginContributions().then((data) => {- const merged = { ...EMPTY, ...(data || {}) };+ const merged = normalizeContributions({ ...EMPTY, ...(data || {}) });notify(merged);return merged;})@@ -171,7 +228,7 @@ export function refreshContributions() {// while running only the Vite dev server), use the active plugin// manifest baked into this frontend build instead of leaving// contributed routes blank.- const fallback = getBuildTimeContributions();+ const fallback = normalizeContributions(getBuildTimeContributions());notify(fallback);return fallback;});diff --git a/frontend/src/plugins/plugins-manifest.json b/frontend/src/plugins/plugins-manifest.jsonindex 62e78a1a..d0fe6a1c 100644--- a/frontend/src/plugins/plugins-manifest.json+++ b/frontend/src/plugins/plugins-manifest.json@@ -3,10 +3,10 @@{"name": "serverkit-git","slug": "serverkit-git",- "display_name": "Git Server (extension)",+ "display_name": "Git Server","version": "1.0.0","frontend_entry": "","path": "serverkit-git"}]-}\ No newline at end of file+}diff --git a/frontend/src/plugins/serverkit-git/index.jsx b/frontend/src/plugins/serverkit-git/index.jsxindex 7820887a..b46c71a3 100644--- a/frontend/src/plugins/serverkit-git/index.jsx+++ b/frontend/src/plugins/serverkit-git/index.jsx@@ -1,14 +1,16 @@-// Re-exports the existing host Git page as GitExtPage so the-// contribution system can mount it at /git-ext while the hardcoded-// /git route stays in place. Both routes hit the same /api/v1/git-// backend and share state — this is intentional, the extension is-// the same feature surfaced through the opt-in plugin pipeline so-// you can A/B the two install paths.+// Re-exports the existing host Git page through the extension system.+// The extension owns the canonical /git route; the host keeps the page+// component as implementation detail until the Git UI is fully split.//// After install, this file lives at frontend/src/plugins/serverkit-git/// so the relative import resolves against the host's pages directory.import GitPage from '../../pages/Git';-export function GitExtPage() {- return <GitPage basePath="/git-ext" />;+export function GitExtensionPage() {+ return <GitPage basePath="/git" />;}++// Backward compatibility for older installed manifests that still point+// at GitExtPage. Contribution normalization rewrites those manifests, but+// keeping the export avoids a blank route if stale metadata slips through.+export const GitExtPage = GitExtensionPage;diff --git a/frontend/src/plugins/serverkit-git/plugin.json b/frontend/src/plugins/serverkit-git/plugin.jsonindex e9fc6767..5076fb88 100644--- a/frontend/src/plugins/serverkit-git/plugin.json+++ b/frontend/src/plugins/serverkit-git/plugin.json@@ -1,8 +1,8 @@{"name": "serverkit-git",- "display_name": "Git Server (extension)",+ "display_name": "Git Server","version": "1.0.0",- "description": "Self-hosted Git server (Gitea) wrapper exposed as the /git-ext route. Runs alongside the built-in /git page so you can compare the opt-in extension flow against the hardcoded one.",+ "description": "Self-hosted Git server (Gitea) exposed through the ServerKit extension system.","author": "ServerKit","license": "MIT","category": "deployment",@@ -14,33 +14,33 @@"contributions": {"nav": [{- "id": "git-ext",- "label": "Git (ext)",- "route": "/git-ext",+ "id": "git",+ "label": "Git",+ "route": "/git","category": "infrastructure","icon": "<circle cx=\"18\" cy=\"18\" r=\"3\"/><circle cx=\"6\" cy=\"6\" r=\"3\"/><path d=\"M6 21V9a9 9 0 0 0 9 9\"/>"}],"routes": [{- "path": "git-ext",- "component": "GitExtPage"+ "path": "git",+ "component": "GitExtensionPage"},{- "path": "git-ext/:tab",- "component": "GitExtPage"+ "path": "git/:tab",+ "component": "GitExtensionPage"}],"page_titles": {- "/git-ext": "Git (extension)"+ "/git": "Git Repositories"},"command_palette": [{- "label": "Git (extension)",- "path": "/git-ext",+ "label": "Git",+ "path": "/git","category": "Pages",- "keywords": "git repos extension plugin"+ "keywords": "git repos deploy extension plugin"}]}-}\ No newline at end of file+}