fix bug when api version would be set to 0 if there is no m1k1o.neko_rooms.api_version label and org.opencontainers.image. contains different URL.

This commit is contained in:
Miroslav Šedivý
2024-09-13 20:14:57 +02:00
parent e61f6bf624
commit 3aeaf6acf9
+4 -3
View File
@@ -270,16 +270,17 @@ func (manager *RoomManagerCtx) Create(ctx context.Context, settings types.RoomSe
// based on opencontainers image url label
if val, ok := inspect.Config.Labels["org.opencontainers.image.url"]; ok {
// TODO: this should be removed in future, but since we have a lot of legacy images, we need to support it
switch val {
case "https://github.com/m1k1o/neko":
settings.ApiVersion = 2
case "https://github.com/demodesk/neko":
settings.ApiVersion = 3
}
} else
}
// unable to detect api version
{
// still unable to detect api version
if settings.ApiVersion == 0 {
// TODO: this should be removed in future, but since we have a lot of v2 images, we need to support it
log.Warn().Str("image", settings.NekoImage).Msg("unable to detect api version, fallback to v2")
settings.ApiVersion = 2