Fixed multiple navigation issues

This commit is contained in:
Frikky
2025-03-18 13:29:36 +01:00
parent 5395ad40ec
commit 10811b4624
7 changed files with 272 additions and 71 deletions
+21 -10
View File
@@ -773,25 +773,36 @@ func handleBackendImageDownload(ctx context.Context, images string) error {
//time.Sleep(time.Duration(30) * time.Second)
newImages := []string{}
for _, image := range strings.Split(images, ",") {
image = strings.TrimSpace(image)
if shuffle.ArrayContains(handled, image) {
for _, curimage := range strings.Split(images, ",") {
curimage = strings.TrimSpace(curimage)
if shuffle.ArrayContains(handled, curimage) {
continue
}
handled = append(handled, image)
if !strings.Contains(image, "/") {
image = fmt.Sprintf("frikky/shuffle:%s", image)
handled = append(handled, curimage)
if !strings.Contains(curimage, "/") {
curimage = fmt.Sprintf("frikky/shuffle:%s", curimage)
}
newImages = append(newImages, image)
newImages = append(newImages, curimage)
log.Printf("[DEBUG] Downloading image: %s", image)
err := shuffle.DownloadDockerImageBackend(&http.Client{Timeout: imagedownloadTimeout}, image)
// Force remove the current image to avoid cached layers
_, err := dockercli.ImageRemove(ctx, curimage, image.RemoveOptions{
Force: true,
PruneChildren: true,
})
if err != nil {
log.Printf("[ERROR] Failed removing image for re-download: %s", err)
} else {
log.Printf("[DEBUG] Removed image: %s", curimage)
}
err = shuffle.DownloadDockerImageBackend(&http.Client{Timeout: imagedownloadTimeout}, curimage)
if err != nil {
log.Printf("[ERROR] Failed downloading image: %s", err)
} else {
log.Printf("[DEBUG] Downloaded image: %s", image)
log.Printf("[DEBUG] Downloaded image: %s", curimage)
}
}