mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-31 17:02:51 -05:00
plugins: represent featured plugins in built-in browsers
This commit is contained in:
@@ -27,6 +27,7 @@ type Plugin struct {
|
||||
Distro []string `json:"distro"`
|
||||
Screenshot string `json:"screenshot,omitempty"`
|
||||
RequiresDMS string `json:"requires_dms,omitempty"`
|
||||
Featured bool `json:"featured,omitempty"`
|
||||
}
|
||||
|
||||
type GitClient interface {
|
||||
|
||||
@@ -67,6 +67,9 @@ func FilterByCapability(capability string, plugins []Plugin) []Plugin {
|
||||
|
||||
func SortByFirstParty(plugins []Plugin) []Plugin {
|
||||
sort.SliceStable(plugins, func(i, j int) bool {
|
||||
if plugins[i].Featured != plugins[j].Featured {
|
||||
return plugins[i].Featured
|
||||
}
|
||||
isFirstPartyI := strings.HasPrefix(plugins[i].Repo, "https://github.com/AvengeMedia")
|
||||
isFirstPartyJ := strings.HasPrefix(plugins[j].Repo, "https://github.com/AvengeMedia")
|
||||
if isFirstPartyI != isFirstPartyJ {
|
||||
|
||||
@@ -44,6 +44,7 @@ func HandleList(conn net.Conn, req models.Request) {
|
||||
Dependencies: p.Dependencies,
|
||||
Installed: installed,
|
||||
FirstParty: strings.HasPrefix(p.Repo, "https://github.com/AvengeMedia"),
|
||||
Featured: p.Featured,
|
||||
RequiresDMS: p.RequiresDMS,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ type PluginInfo struct {
|
||||
Dependencies []string `json:"dependencies,omitempty"`
|
||||
Installed bool `json:"installed,omitempty"`
|
||||
FirstParty bool `json:"firstParty,omitempty"`
|
||||
Featured bool `json:"featured,omitempty"`
|
||||
Note string `json:"note,omitempty"`
|
||||
HasUpdate bool `json:"hasUpdate,omitempty"`
|
||||
RequiresDMS string `json:"requires_dms,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user