From f38f8f16d391c9fac1bbf9c06e61b26aa06a2a99 Mon Sep 17 00:00:00 2001 From: KodekaTeam Date: Sat, 22 Aug 2026 00:03:09 +0700 Subject: [PATCH] feat: add GitHub and Docker Hub links to app templates - Introduced `github` and `hub-docker` fields in the app template presentation schema. - Updated normalization logic to handle new fields and return appropriate values. - Enhanced frontend components to display GitHub and Docker Hub links for each app. - Added tests to validate the inclusion of new fields in app templates. --- src/app/apps/page.tsx | 131 ++++++++++++++++++- src/lib/api.ts | 2 + src/server/config/app-templates.ts | 128 ++++++++++++++++++ src/server/routes/apps.ts | 9 ++ src/server/services/app-catalog/normalize.ts | 11 +- tests/backend/app-catalog-validation.test.ts | 4 + 6 files changed, 280 insertions(+), 5 deletions(-) diff --git a/src/app/apps/page.tsx b/src/app/apps/page.tsx index 5fe23c3..9d2144c 100644 --- a/src/app/apps/page.tsx +++ b/src/app/apps/page.tsx @@ -3,6 +3,7 @@ import Link from "next/link"; import { type FormEvent, + type ReactNode, useCallback, useEffect, useMemo, @@ -349,6 +350,104 @@ function getTemplateVisual(template: AppTemplate | null) { }; } +function normalizeExternalUrl(value?: string) { + const trimmed = value?.trim(); + if (!trimmed) return ""; + + if (/^https?:\/\//i.test(trimmed)) { + return trimmed; + } + + return `https://${trimmed}`; +} + +function getTemplateLinks(template: AppTemplate) { + return { + github: normalizeExternalUrl(template.presentation?.github), + dockerHub: normalizeExternalUrl(template.presentation?.["hub-docker"]), + }; +} + +function SimpleIcon({ + src, + label, + size, +}: { + src: string; + label: string; + size: number; +}) { + return ( + // eslint-disable-next-line @next/next/no-img-element + {label} + ); +} + +function MaskIcon({ + src, + size, +}: { + src: string; + size: number; +}) { + return ( +