Skip to content
Snippets Groups Projects
Commit f1395569 authored by dos's avatar dos
Browse files

Merge branch 'category' into 'main'

apps: Rename "menu" field to "category"

See merge request !7
parents abb5aabf 9cf92ce2
No related branches found
No related tags found
1 merge request!7apps: Rename "menu" field to "category"
...@@ -255,6 +255,7 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec ...@@ -255,6 +255,7 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec
var data struct { var data struct {
App struct { App struct {
Name string Name string
Category string
Menu string Menu string
} }
Entry struct { Entry struct {
...@@ -276,13 +277,16 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec ...@@ -276,13 +277,16 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec
if data.App.Name == "" || len(data.App.Name) > 32 { if data.App.Name == "" || len(data.App.Name) > 32 {
return nil, fmt.Errorf("app name invalid (must be non-empty and <= 32 chars)") return nil, fmt.Errorf("app name invalid (must be non-empty and <= 32 chars)")
} }
if data.App.Category == "" {
data.App.Category = data.App.Menu
}
sections := map[string]bool{ sections := map[string]bool{
"Badge": true, "Badge": true,
"Apps": true, "Apps": true,
"Music": true, "Music": true,
} }
if !sections[data.App.Menu] { if !sections[data.App.Category] {
return nil, fmt.Errorf("app menu invalid (must be one of 'Badge', 'Apps', 'Music')") return nil, fmt.Errorf("app category invalid (must be one of 'Badge', 'Apps', 'Music')")
} }
if data.Entry.Class == "" { if data.Entry.Class == "" {
return nil, fmt.Errorf("no entry class") return nil, fmt.Errorf("no entry class")
...@@ -297,7 +301,7 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec ...@@ -297,7 +301,7 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec
return &appInfo{ return &appInfo{
name: data.App.Name, name: data.App.Name,
author: data.Metadata.Author, author: data.Metadata.Author,
menu: data.App.Menu, menu: data.App.Category,
description: data.Metadata.Description, description: data.Metadata.Description,
version: data.Metadata.Version, version: data.Metadata.Version,
commit: obj.Hash.String(), commit: obj.Hash.String(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment