From 5f11f9c902d6b1852d3239bba155cc65e4a79e1e Mon Sep 17 00:00:00 2001 From: NewName Date: Tue, 20 May 2025 17:09:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ghproxy/public/search.html | 11 ++++++++--- ghproxy/search.go | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ghproxy/public/search.html b/ghproxy/public/search.html index 4c9c868..9a04b18 100644 --- a/ghproxy/public/search.html +++ b/ghproxy/public/search.html @@ -625,6 +625,11 @@ return; } + // 处理官方镜像 + if (currentRepo.is_official) { + namespace = 'library'; + } + const response = await fetch(`/tags/${namespace}/${name}`); const data = await response.json(); @@ -645,7 +650,7 @@ function displayTags(tags) { const tagList = document.getElementById('tagList'); - const repoName = currentRepo.namespace ? `${currentRepo.namespace}/${currentRepo.name}` : currentRepo.name; + const repoName = currentRepo.repo_name; let header = `
@@ -653,12 +658,12 @@
${repoName} ${currentRepo.is_official ? '官方' : ''} + ${currentRepo.is_automated ? '自动构建' : ''}
-
${currentRepo.description || '暂无描述'}
+
${currentRepo.short_description || '暂无描述'}
${currentRepo.star_count > 0 ? `⭐ ${formatNumber(currentRepo.star_count)}` : ''} ${currentRepo.pull_count > 0 ? `⬇️ ${formatNumber(currentRepo.pull_count)}` : ''} - 更新于 ${formatTimeAgo(currentRepo.last_updated)}
docker pull ${repoName} diff --git a/ghproxy/search.go b/ghproxy/search.go index 5d64405..cb2898c 100644 --- a/ghproxy/search.go +++ b/ghproxy/search.go @@ -150,8 +150,8 @@ func searchDockerHub(ctx context.Context, query string, page, pageSize int) (*Se // 打印解析后的结果 fmt.Printf("搜索结果: 总数=%d, 结果数=%d\n", result.Count, len(result.Results)) for i, repo := range result.Results { - fmt.Printf("仓库[%d]: 名称=%s, 命名空间=%s, 描述=%s, 是否官方=%v\n", - i, repo.Name, repo.Namespace, repo.Description, repo.IsOfficial) + fmt.Printf("仓库[%d]: 名称=%s, 所有者=%s, 描述=%s, 是否官方=%v\n", + i, repo.Name, repo.RepoOwner, repo.Description, repo.IsOfficial) } setCacheResult(cacheKey, &result)