mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 09:48:49 +02:00
fix empty homepage name, incorrect image parsing, refactor
This commit is contained in:
@@ -7,17 +7,9 @@ import (
|
||||
"github.com/yusing/go-proxy/internal/utils/strutils"
|
||||
)
|
||||
|
||||
type (
|
||||
containerHelper struct {
|
||||
*container.Summary
|
||||
image *ContainerImage
|
||||
}
|
||||
ContainerImage struct {
|
||||
Author string
|
||||
Name string
|
||||
Tag string
|
||||
}
|
||||
)
|
||||
type containerHelper struct {
|
||||
*container.Summary
|
||||
}
|
||||
|
||||
// getDeleteLabel gets the value of a label and then deletes it from the container.
|
||||
// If the label does not exist, an empty string is returned.
|
||||
@@ -45,11 +37,10 @@ func (c containerHelper) parseImage() *ContainerImage {
|
||||
slashSep := strutils.SplitRune(colonSep[0], '/')
|
||||
im := new(ContainerImage)
|
||||
if len(slashSep) > 1 {
|
||||
im.Author = slashSep[len(slashSep)-1]
|
||||
im.Name = strings.Join(slashSep[:len(slashSep)-1], "/")
|
||||
im.Author = strings.Join(slashSep[:len(slashSep)-1], "/")
|
||||
im.Name = slashSep[len(slashSep)-1]
|
||||
} else {
|
||||
im.Author = "library"
|
||||
im.Name = colonSep[0]
|
||||
im.Name = slashSep[0]
|
||||
}
|
||||
if len(colonSep) > 1 {
|
||||
im.Tag = colonSep[1]
|
||||
@@ -75,10 +66,3 @@ func (c containerHelper) getPrivatePortMapping() PortMapping {
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func (c containerHelper) IsBlacklisted() bool {
|
||||
if c.image == nil {
|
||||
c.image = c.parseImage()
|
||||
}
|
||||
return c.image.IsBlacklisted()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user