From a5eca5d97be65a3c9fc706e7d8552bef494e8342 Mon Sep 17 00:00:00 2001 From: user123456 Date: Thu, 12 Jun 2025 15:00:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E6=83=B3=E5=86=99=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/search.html | 1442 +++++++++++++++++++--------------------- src/public/skopeo.html | 1354 ++++++++++++++----------------------- src/skopeo_service.go | 52 -- 3 files changed, 1195 insertions(+), 1653 deletions(-) diff --git a/src/public/search.html b/src/public/search.html index 68a623a..5ab1629 100644 --- a/src/public/search.html +++ b/src/public/search.html @@ -8,93 +8,52 @@ Docker镜像搜索 + + @@ -767,117 +651,42 @@ - -
+
- -
-

Docker 镜像搜索

-

- 搜索 Docker Hub 上的镜像,查看详细信息和标签版本 -

-
- - -
-
- - +

Docker镜像搜索

+ +
+
+ +
+
- - -
-
-

正在搜索镜像...

-
- - - - - -
-
-

搜索结果

- -
- -
- - - -
- - -
- -
-
- -
+
+
+

正在加载...

+
+ + + +
+
+ + +
+ +
+ + +
+ \ No newline at end of file diff --git a/src/public/skopeo.html b/src/public/skopeo.html index dce9385..b1707d8 100644 --- a/src/public/skopeo.html +++ b/src/public/skopeo.html @@ -8,93 +8,52 @@ Docker镜像批量下载 + + + - -
+
- -
-

Docker 镜像批量下载

-

- 批量下载和打包Docker镜像,支持多架构和自定义标签选择 -

-
- - -
-
-

- 📦 下载配置 -

-

- 设置要下载的镜像列表、架构和输出格式 -

-
- -
- - - - 每行输入一个镜像名称,支持标签。例如:nginx:latest, mysql:8.0, redis:alpine - -
- -
- -
- -
-
- - - - -
-
- - - -
- - -
-
- - -
-
-

- 📈 下载进度 -

-
- -
-
准备中...
-
0/0
-
- -
-
-
- -
- -
-
+

Docker离线镜像包下载

+ +
+
每行输入一个镜像,跟docker pull的格式一样,多个镜像会自动打包到一起为zip包,单个镜像为tar包。导入镜像后需要手动为镜像添加名称和标签,例如:docker tag 1856948a5aa7 镜像名称:标签
+
-
- - -
- - - + +
+
镜像架构,默认为 amd64
+ +
+ + + +
+
0/0 - 0%
+ +
+ +
+ + +
+ + + + - \ No newline at end of file + \ No newline at end of file diff --git a/src/skopeo_service.go b/src/skopeo_service.go index fba2677..d048cc9 100644 --- a/src/skopeo_service.go +++ b/src/skopeo_service.go @@ -110,9 +110,6 @@ func initSkopeoRoutes(router *gin.Engine) { // 下载文件 router.GET("/api/files/:filename", serveFile) - - // 通过任务ID下载文件 - router.GET("/api/download/:taskId/file", serveFileByTaskId) // 启动清理过期文件的goroutine go cleanupTempFiles() @@ -1062,55 +1059,6 @@ func sendTaskUpdate(task *DownloadTask) { } } -// 通过任务ID提供文件下载 -func serveFileByTaskId(c *gin.Context) { - taskID := c.Param("taskId") - - tasksLock.Lock() - task, exists := tasks[taskID] - tasksLock.Unlock() - - if !exists { - c.JSON(http.StatusNotFound, gin.H{"error": "任务不存在"}) - return - } - - // 确保任务状态为已完成 - task.StatusLock.RLock() - isCompleted := task.Status == StatusCompleted - task.StatusLock.RUnlock() - - if !isCompleted { - c.JSON(http.StatusBadRequest, gin.H{"error": "任务尚未完成"}) - return - } - - // 确保所有进度都是100% - ensureTaskCompletion(task) - - // 检查文件是否存在 - filePath := task.OutputFile - if filePath == "" || !fileExists(filePath) { - c.JSON(http.StatusNotFound, gin.H{"error": "文件不存在"}) - return - } - - // 获取文件信息 - fileInfo, err := os.Stat(filePath) - if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"error": "无法获取文件信息"}) - return - } - - // 设置文件名 - downloadName := filepath.Base(filePath) - c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", downloadName)) - c.Header("Content-Length", fmt.Sprintf("%d", fileInfo.Size())) - - // 返回文件 - c.File(filePath) -} - // 提供文件下载 func serveFile(c *gin.Context) { filename := c.Param("filename")