diff --git a/server_apps.go b/server_apps.go index 02214792c8cc9c18e6d9a8c414458ca5cc00b202..ddedd333bb490ec602857af0b406ca8b8617658d 100644 --- a/server_apps.go +++ b/server_apps.go @@ -18,7 +18,7 @@ import ( "strings" "strconv" "time" - "math" + "math" "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" @@ -73,6 +73,7 @@ type appInfo struct { author string description string version int + slug string commit string stars int flow3rSeed string @@ -308,7 +309,7 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec Description string Version int } - Style map[string]interface{} + Style map[string]interface{} } dec := toml.NewDecoder(reader) err = dec.Decode(&data) @@ -481,6 +482,8 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string, slug * } app.targz = tbytes + app.slug = strings.ReplaceAll(slug_str, "/", "-") + // Calculate an 8 digit flow3r seed which can be used to install the // app. This is based on md5 so ambitious hack3rs can force a certain // app seed :) @@ -702,11 +705,12 @@ type jsonApp struct { Description string `json:"description"` Version int `json:"version"` Stars int `json:"stars"` + Slug string `json:"slug"` Tags []string `json:"tags"` Timestamp time.Time `json:"timestamp"` Flow3rSeed string `json:"flow3rSeed"` Status *jsonAppStatus `json:"status"` - Style *appStyle `json:"style"` + Style *appStyle `json:"style"` } func makeJsonApp(a *appDescriptor) jsonApp { @@ -724,7 +728,8 @@ func makeJsonApp(a *appDescriptor) jsonApp { Stars: a.appInfo.stars, Flow3rSeed: a.appInfo.flow3rSeed, Tags: a.appInfo.tags, - Style: a.appInfo.style, + Slug: a.appInfo.slug, + Style: a.appInfo.style, } if a.appInfo.status != nil{ ret.Status = &jsonAppStatus{