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
Feature templates the registry marks as featured
Juan Denisfe42d19048ad
diff --git a/backend/app/services/template_catalog.py b/backend/app/services/template_catalog.pyindex d170baa4..a3c06310 100644--- a/backend/app/services/template_catalog.py+++ b/backend/app/services/template_catalog.py@@ -277,6 +277,7 @@ class TemplateCatalogMixin:'description': template.get('description'),'icon': template.get('icon'),'categories': template.get('categories', []),+ 'featured': bool(template.get('featured')),'kind': kind,'source': 'local','filepath': filepath@@ -331,6 +332,8 @@ class TemplateCatalogMixin:'icon': t.get('icon'),'categories': t.get('categories', []),}+ if t.get('featured'):+ entry['featured'] = True# Carried in the index so a panel that syncs this repo can list the# engine catalog without fetching all 100+ template files first.if isinstance(t.get('engine'), dict):diff --git a/backend/tests/test_service_templates.py b/backend/tests/test_service_templates.pyindex 47a5cf51..75c64d30 100644--- a/backend/tests/test_service_templates.py+++ b/backend/tests/test_service_templates.py@@ -85,6 +85,19 @@ def test_repo_index_covers_all_templates():assert t.get("icon"), t[email protected]("flag, expected", [("featured: true\n", True), ("", False)])+def test_featured_flag_reaches_the_catalog(tmp_path, flag, expected):+ """The Templates page features any template whose YAML says `featured: true`."""+ path = tmp_path / "demo.yaml"+ path.write_text(+ "id: demo\nname: Demo\nversion: '1'\ndescription: d\n" + flag+ + "compose:\n services:\n app:\n image: nginx:1\n",+ encoding="utf-8",+ )+ entry = TemplateService._parse_local_entry(str(path), "demo")+ assert entry["featured"] is expected++def test_catalog_contains_roadmap_services():ids = {t["id"] for t in TemplateService.build_repo_index()["templates"]}missing = [e for e in ROADMAP_IDS if e not in ids]diff --git a/frontend/src/pages/Templates.jsx b/frontend/src/pages/Templates.jsxindex 457a117c..5fa5cc95 100644--- a/frontend/src/pages/Templates.jsx+++ b/frontend/src/pages/Templates.jsx@@ -175,7 +175,8 @@ const KIND_OPTIONS = [{ value: 'repo', labelKey: 'app.templates.gitRepo', label: 'Git repo' },];-const isFeatured = (templateId) => FEATURED_TEMPLATES.includes(templateId);+// A template can also feature itself with `featured: true` in its registry entry.+const isFeatured = (template) => Boolean(template.featured) || FEATURED_TEMPLATES.includes(template.id);const kindLabel = (template) => ((template.kind || 'compose') === 'repo' ? 'Git repo' : 'One-click');// The catalog stays a card grid — a template is something you read, not a row@@ -188,11 +189,11 @@ const templateColumns = [key: 'featured',headerKey: 'app.templates.featured', header: 'Featured',type: 'bool',- value: (t) => isFeatured(t.id),+ value: (t) => isFeatured(t),// 1/0 rather than the boolean: applyTableSorts compares booleans as the// strings "true"/"false", which happens to work and would stop working// the moment anyone renamed the labels.- sortValue: (t) => (isFeatured(t.id) ? 1 : 0),+ sortValue: (t) => (isFeatured(t) ? 1 : 0),},{ key: 'kind', headerKey: 'common.labels.type', header: 'Type', type: 'enum', enumOrder: ['One-click', 'Git repo'], value: kindLabel, sortValue: kindLabel },{ key: 'version', headerKey: 'common.labels.version', header: 'Version', type: 'text', value: (t) => t.version || '', sortValue: (t) => t.version || '' },@@ -594,7 +595,7 @@ const Templates = () => {title={template.name}sub={`v${template.version}`}tag={isRepo ? t('app.templates.gitRepo', 'Git repo') : t('app.templates.oneClick', 'One-click')}- featured={isFeatured(template.id)}+ featured={isFeatured(template)}description={template.description}facts={(template.categories || []).slice(0, 2).join(' · ')}onClick={deployManaged ? undefined : () => handleDeploy(template)}