Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
API
Commits
f6c41f9d
Commit
f6c41f9d
authored
5 months ago
by
moon2
Browse files
Options
Downloads
Plain Diff
Merge branch 'cleanups' into 'main'
apps.json cleanups: See merge request
!11
parents
4d0a9ad6
73ca334f
No related branches found
No related tags found
1 merge request
!11
apps.json cleanups:
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
server_apps.go
+25
-50
25 additions, 50 deletions
server_apps.go
with
25 additions
and
50 deletions
server_apps.go
+
25
−
50
View file @
f6c41f9d
...
...
@@ -28,14 +28,9 @@ import (
"github.com/pelletier/go-toml/v2"
)
type
appStyleFloatie
struct
{
Symbol
string
`json:"symbol"`
Color
string
`json:"color"`
}
type
appStyle
struct
{
Background
string
`json:"background"`
Floaties
[]
appStyleFloatie
`json:"floaties"
`
Background
string
`json:"background"
,omitempty
`
Color
string
`json:"color",omitempty
`
}
type
appPatch
struct
{
...
...
@@ -83,7 +78,7 @@ type appInfo struct {
targz
[]
byte
firstErr
error
tags
[]
string
featured
bool
status
*
appStatus
style
*
appStyle
}
...
...
@@ -354,31 +349,17 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec
style
:
nil
,
}
if
col
,
ok
:=
data
.
Style
[
"background"
]
.
(
string
);
ok
{
style
:=
appStyle
{
Background
:
col
,
}
if
floaties
,
ok
:=
data
.
Style
[
"floaties"
]
.
([]
interface
{});
ok
{
for
x
:=
0
;
x
<
len
(
floaties
);
x
++
{
floatie
,
ok
:=
floaties
[
x
]
.
(
map
[
string
]
interface
{})
if
!
ok
{
continue
}
col
,
ok
:=
floatie
[
"color"
]
.
(
string
)
if
!
ok
{
continue
}
symbol
,
ok
:=
floatie
[
"symbol"
]
.
(
string
)
if
!
ok
{
symbol
=
"flow3r"
}
f
:=
appStyleFloatie
{
Symbol
:
symbol
,
Color
:
col
,
}
style
.
Floaties
=
append
(
style
.
Floaties
,
f
)
style
:=
appStyle
{}
style_exists
:=
false
if
bg_col
,
ok
:=
data
.
Style
[
"background"
]
.
(
string
);
ok
{
style
.
Background
=
bg_col
style_exists
=
true
}
if
col
,
ok
:=
data
.
Style
[
"color"
]
.
(
string
);
ok
{
style
.
Color
=
col
style_exists
=
true
}
if
style_exists
{
ret
.
style
=
&
style
}
return
&
ret
,
nil
...
...
@@ -494,8 +475,6 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string, slug *
}
app
.
firstErr
=
firstErr
app
.
tags
=
make
([]
string
,
0
)
return
app
,
nil
}
...
...
@@ -637,15 +616,11 @@ func (s *server) getAppRegistry(ctx context.Context) (*appRegistry, error) {
})
}
else
if
flagmap
!=
nil
{
if
app_flags
,
ok
:=
(
*
flagmap
)[
app
.
repository
]
.
(
map
[
string
]
interface
{});
ok
{
info
.
status
=
new
(
appStatus
)
if
tags
,
ok
:=
app_flags
[
"tags"
]
.
([]
interface
{});
ok
{
for
_
,
tag
:=
range
tags
{
if
tagtxt
,
ok
:=
tag
.
(
string
);
ok
{
info
.
tags
=
append
(
info
.
tags
,
tagtxt
)
}
}
if
feat
,
ok
:=
app_flags
[
"featured"
]
.
(
bool
);
ok
{
info
.
featured
=
feat
}
if
status
,
ok
:=
app_flags
[
"status"
]
.
(
map
[
string
]
interface
{});
ok
{
info
.
status
=
new
(
appStatus
)
if
tested
,
ok
:=
status
[
"tested_version"
]
.
(
float64
);
ok
{
info
.
status
.
tested_version
=
int
(
math
.
Round
(
tested
))
}
...
...
@@ -691,7 +666,7 @@ type jsonAppPatch struct{
type
jsonAppStatus
struct
{
TestedVersion
int
`json:"tested_version"`
Broken
bool
`json:"broken"`
Patch
jsonAppPatch
`json:"patch"`
Patch
*
jsonAppPatch
`json:"patch"
,omitempty
`
}
type
jsonApp
struct
{
...
...
@@ -706,11 +681,11 @@ type jsonApp struct {
Version
int
`json:"version"`
Stars
int
`json:"stars"`
Slug
string
`json:"slug"`
Tags
[]
string
`json:"
tags
"`
Featured
bool
`json:"
featured
"`
Timestamp
time
.
Time
`json:"timestamp"`
Flow3rSeed
string
`json:"flow3rSeed"`
Status
*
jsonAppStatus
`json:"status"`
Style
*
appStyle
`json:"style"`
Status
*
jsonAppStatus
`json:"status"
,omitempty
`
Style
*
appStyle
`json:"style"
,omitempty
`
}
func
makeJsonApp
(
a
*
appDescriptor
)
jsonApp
{
...
...
@@ -727,7 +702,7 @@ func makeJsonApp(a *appDescriptor) jsonApp {
Timestamp
:
a
.
appInfo
.
commitObj
.
Committer
.
When
.
UTC
(),
Stars
:
a
.
appInfo
.
stars
,
Flow3rSeed
:
a
.
appInfo
.
flow3rSeed
,
Tags
:
a
.
appInfo
.
tags
,
Featured
:
a
.
appInfo
.
featured
,
Slug
:
a
.
appInfo
.
slug
,
Style
:
a
.
appInfo
.
style
,
}
...
...
@@ -738,7 +713,7 @@ func makeJsonApp(a *appDescriptor) jsonApp {
}
if
a
.
appInfo
.
status
.
patch
!=
nil
{
pa
:=
a
.
appInfo
.
status
.
patch
.
repository
ret
.
Status
.
Patch
=
jsonAppPatch
{
ret
.
Status
.
Patch
=
&
jsonAppPatch
{
RepoURL
:
"https://git.flow3r.garden/"
+
pa
,
DownloadURL
:
fmt
.
Sprintf
(
"%sapps/zip/%s.zip"
,
flagBaseURL
,
pa
),
TarDownloadURL
:
fmt
.
Sprintf
(
"%sapps/tar/%s.tar.gz"
,
flagBaseURL
,
pa
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment