From d91ae9d84458a932e98c277b6ddc6a92ea9a3f32 Mon Sep 17 00:00:00 2001 From: NewName Date: Tue, 20 May 2025 20:03:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E8=B0=83=E8=AF=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ghproxy/public/search.html | 6 ------ ghproxy/search.go | 18 ------------------ 2 files changed, 24 deletions(-) diff --git a/ghproxy/public/search.html b/ghproxy/public/search.html index fca96d1..b63e877 100644 --- a/ghproxy/public/search.html +++ b/ghproxy/public/search.html @@ -612,15 +612,12 @@ targetRepo = repo.toLowerCase(); // 保存目标仓库名用于排序 } - console.log('执行搜索:', searchQuery); const response = await fetch(`/search?q=${encodeURIComponent(searchQuery)}&page=${currentPage}&page_size=25`); const data = await response.json(); if (!response.ok) { throw new Error(data.error || '搜索请求失败'); } - - console.log('搜索响应:', data); // 更新总页数和分页状态 totalPages = Math.ceil(data.count / 25); @@ -674,7 +671,6 @@ } if (isNaN(date.getTime())) { - console.warn('无法解析日期:', dateString); return '未知时间'; } } @@ -803,7 +799,6 @@ async function loadTags(namespace, name) { showLoading(); try { - console.log('加载标签:', namespace, name); if (!namespace || !name) { showToast('命名空间和镜像名称不能为空'); return; @@ -816,7 +811,6 @@ } const data = await response.json(); - console.log('标签数据:', data); displayTags(data); showTagList(); } catch (error) { diff --git a/ghproxy/search.go b/ghproxy/search.go index 4985611..5b1b9d9 100644 --- a/ghproxy/search.go +++ b/ghproxy/search.go @@ -254,7 +254,6 @@ func searchDockerHub(ctx context.Context, query string, page, pageSize int) (*Se } fullURL = fullURL + "?" + params.Encode() - fmt.Printf("搜索URL: %s\n", fullURL) // 发送请求 req, err := http.NewRequestWithContext(ctx, "GET", fullURL, nil) @@ -454,7 +453,6 @@ func getRepositoryTags(ctx context.Context, namespace, name string) ([]TagInfo, params.Set("ordering", "last_updated") fullURL := baseURL + "?" + params.Encode() - fmt.Printf("获取标签URL: %s\n", fullURL) req, err := http.NewRequestWithContext(ctx, "GET", fullURL, nil) if err != nil { @@ -484,9 +482,6 @@ func getRepositoryTags(ctx context.Context, namespace, name string) ([]TagInfo, return nil, fmt.Errorf("请求失败: 状态码=%d, 响应=%s", resp.StatusCode, string(body)) } - // 打印响应内容以便调试 - fmt.Printf("标签响应: %s\n", string(body)) - // 解析响应 var result struct { Count int `json:"count"` @@ -498,13 +493,6 @@ func getRepositoryTags(ctx context.Context, namespace, name string) ([]TagInfo, return nil, fmt.Errorf("解析响应失败: %v", err) } - // 打印解析后的结果 - fmt.Printf("标签结果: 总数=%d, 结果数=%d\n", result.Count, len(result.Results)) - for i, tag := range result.Results { - fmt.Printf("标签[%d]: 名称=%s, 大小=%d, 更新时间=%v\n", - i, tag.Name, tag.FullSize, tag.LastUpdated) - } - // 缓存结果 searchCache.Set(cacheKey, result.Results) return result.Results, nil @@ -529,11 +517,8 @@ func RegisterSearchRoute(r *gin.Engine) { fmt.Sscanf(ps, "%d", &pageSize) } - fmt.Printf("搜索请求: query=%s, page=%d, pageSize=%d\n", query, page, pageSize) - result, err := searchDockerHub(c.Request.Context(), query, page, pageSize) if err != nil { - fmt.Printf("搜索失败: %v\n", err) c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) return } @@ -546,8 +531,6 @@ func RegisterSearchRoute(r *gin.Engine) { namespace := c.Param("namespace") name := c.Param("name") - fmt.Printf("获取标签请求: namespace=%s, name=%s\n", namespace, name) - if namespace == "" || name == "" { c.JSON(http.StatusBadRequest, gin.H{"error": "命名空间和名称不能为空"}) return @@ -555,7 +538,6 @@ func RegisterSearchRoute(r *gin.Engine) { tags, err := getRepositoryTags(c.Request.Context(), namespace, name) if err != nil { - fmt.Printf("获取标签失败: %v\n", err) c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) return }