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
Branches
Branches containing commit
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 (
...
@@ -28,14 +28,9 @@ import (
"github.com/pelletier/go-toml/v2"
"github.com/pelletier/go-toml/v2"
)
)
type
appStyleFloatie
struct
{
Symbol
string
`json:"symbol"`
Color
string
`json:"color"`
}
type
appStyle
struct
{
type
appStyle
struct
{
Background
string
`json:"background"`
Background
string
`json:"background"
,omitempty
`
Floaties
[]
appStyleFloatie
`json:"floaties"
`
Color
string
`json:"color",omitempty
`
}
}
type
appPatch
struct
{
type
appPatch
struct
{
...
@@ -83,7 +78,7 @@ type appInfo struct {
...
@@ -83,7 +78,7 @@ type appInfo struct {
targz
[]
byte
targz
[]
byte
firstErr
error
firstErr
error
tags
[]
string
featured
bool
status
*
appStatus
status
*
appStatus
style
*
appStyle
style
*
appStyle
}
}
...
@@ -354,31 +349,17 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec
...
@@ -354,31 +349,17 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec
style
:
nil
,
style
:
nil
,
}
}
if
col
,
ok
:=
data
.
Style
[
"background"
]
.
(
string
);
ok
{
style
:=
appStyle
{}
style
:=
appStyle
{
style_exists
:=
false
Background
:
col
,
if
bg_col
,
ok
:=
data
.
Style
[
"background"
]
.
(
string
);
ok
{
}
style
.
Background
=
bg_col
if
floaties
,
ok
:=
data
.
Style
[
"floaties"
]
.
([]
interface
{});
ok
{
style_exists
=
true
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
)
}
}
if
col
,
ok
:=
data
.
Style
[
"color"
]
.
(
string
);
ok
{
style
.
Color
=
col
style_exists
=
true
}
}
if
style_exists
{
ret
.
style
=
&
style
ret
.
style
=
&
style
}
}
return
&
ret
,
nil
return
&
ret
,
nil
...
@@ -494,8 +475,6 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string, slug *
...
@@ -494,8 +475,6 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string, slug *
}
}
app
.
firstErr
=
firstErr
app
.
firstErr
=
firstErr
app
.
tags
=
make
([]
string
,
0
)
return
app
,
nil
return
app
,
nil
}
}
...
@@ -637,15 +616,11 @@ func (s *server) getAppRegistry(ctx context.Context) (*appRegistry, error) {
...
@@ -637,15 +616,11 @@ func (s *server) getAppRegistry(ctx context.Context) (*appRegistry, error) {
})
})
}
else
if
flagmap
!=
nil
{
}
else
if
flagmap
!=
nil
{
if
app_flags
,
ok
:=
(
*
flagmap
)[
app
.
repository
]
.
(
map
[
string
]
interface
{});
ok
{
if
app_flags
,
ok
:=
(
*
flagmap
)[
app
.
repository
]
.
(
map
[
string
]
interface
{});
ok
{
info
.
status
=
new
(
appStatus
)
if
feat
,
ok
:=
app_flags
[
"featured"
]
.
(
bool
);
ok
{
if
tags
,
ok
:=
app_flags
[
"tags"
]
.
([]
interface
{});
ok
{
info
.
featured
=
feat
for
_
,
tag
:=
range
tags
{
if
tagtxt
,
ok
:=
tag
.
(
string
);
ok
{
info
.
tags
=
append
(
info
.
tags
,
tagtxt
)
}
}
}
}
if
status
,
ok
:=
app_flags
[
"status"
]
.
(
map
[
string
]
interface
{});
ok
{
if
status
,
ok
:=
app_flags
[
"status"
]
.
(
map
[
string
]
interface
{});
ok
{
info
.
status
=
new
(
appStatus
)
if
tested
,
ok
:=
status
[
"tested_version"
]
.
(
float64
);
ok
{
if
tested
,
ok
:=
status
[
"tested_version"
]
.
(
float64
);
ok
{
info
.
status
.
tested_version
=
int
(
math
.
Round
(
tested
))
info
.
status
.
tested_version
=
int
(
math
.
Round
(
tested
))
}
}
...
@@ -691,7 +666,7 @@ type jsonAppPatch struct{
...
@@ -691,7 +666,7 @@ type jsonAppPatch struct{
type
jsonAppStatus
struct
{
type
jsonAppStatus
struct
{
TestedVersion
int
`json:"tested_version"`
TestedVersion
int
`json:"tested_version"`
Broken
bool
`json:"broken"`
Broken
bool
`json:"broken"`
Patch
jsonAppPatch
`json:"patch"`
Patch
*
jsonAppPatch
`json:"patch"
,omitempty
`
}
}
type
jsonApp
struct
{
type
jsonApp
struct
{
...
@@ -706,11 +681,11 @@ type jsonApp struct {
...
@@ -706,11 +681,11 @@ type jsonApp struct {
Version
int
`json:"version"`
Version
int
`json:"version"`
Stars
int
`json:"stars"`
Stars
int
`json:"stars"`
Slug
string
`json:"slug"`
Slug
string
`json:"slug"`
Tags
[]
string
`json:"
tags
"`
Featured
bool
`json:"
featured
"`
Timestamp
time
.
Time
`json:"timestamp"`
Timestamp
time
.
Time
`json:"timestamp"`
Flow3rSeed
string
`json:"flow3rSeed"`
Flow3rSeed
string
`json:"flow3rSeed"`
Status
*
jsonAppStatus
`json:"status"`
Status
*
jsonAppStatus
`json:"status"
,omitempty
`
Style
*
appStyle
`json:"style"`
Style
*
appStyle
`json:"style"
,omitempty
`
}
}
func
makeJsonApp
(
a
*
appDescriptor
)
jsonApp
{
func
makeJsonApp
(
a
*
appDescriptor
)
jsonApp
{
...
@@ -727,7 +702,7 @@ func makeJsonApp(a *appDescriptor) jsonApp {
...
@@ -727,7 +702,7 @@ func makeJsonApp(a *appDescriptor) jsonApp {
Timestamp
:
a
.
appInfo
.
commitObj
.
Committer
.
When
.
UTC
(),
Timestamp
:
a
.
appInfo
.
commitObj
.
Committer
.
When
.
UTC
(),
Stars
:
a
.
appInfo
.
stars
,
Stars
:
a
.
appInfo
.
stars
,
Flow3rSeed
:
a
.
appInfo
.
flow3rSeed
,
Flow3rSeed
:
a
.
appInfo
.
flow3rSeed
,
Tags
:
a
.
appInfo
.
tags
,
Featured
:
a
.
appInfo
.
featured
,
Slug
:
a
.
appInfo
.
slug
,
Slug
:
a
.
appInfo
.
slug
,
Style
:
a
.
appInfo
.
style
,
Style
:
a
.
appInfo
.
style
,
}
}
...
@@ -738,7 +713,7 @@ func makeJsonApp(a *appDescriptor) jsonApp {
...
@@ -738,7 +713,7 @@ func makeJsonApp(a *appDescriptor) jsonApp {
}
}
if
a
.
appInfo
.
status
.
patch
!=
nil
{
if
a
.
appInfo
.
status
.
patch
!=
nil
{
pa
:=
a
.
appInfo
.
status
.
patch
.
repository
pa
:=
a
.
appInfo
.
status
.
patch
.
repository
ret
.
Status
.
Patch
=
jsonAppPatch
{
ret
.
Status
.
Patch
=
&
jsonAppPatch
{
RepoURL
:
"https://git.flow3r.garden/"
+
pa
,
RepoURL
:
"https://git.flow3r.garden/"
+
pa
,
DownloadURL
:
fmt
.
Sprintf
(
"%sapps/zip/%s.zip"
,
flagBaseURL
,
pa
),
DownloadURL
:
fmt
.
Sprintf
(
"%sapps/zip/%s.zip"
,
flagBaseURL
,
pa
),
TarDownloadURL
:
fmt
.
Sprintf
(
"%sapps/tar/%s.tar.gz"
,
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