Differentiate between installed and activated states for plugins (#7706)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9c0575ce6e
Коммит
16b845c0d7
31
model/plugins_response.go
Обычный файл
31
model/plugins_response.go
Обычный файл
@@ -0,0 +1,31 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
)
|
||||
|
||||
type PluginsResponse struct {
|
||||
Active []*Manifest `json:"active"`
|
||||
Inactive []*Manifest `json:"inactive"`
|
||||
}
|
||||
|
||||
func (m *PluginsResponse) ToJson() string {
|
||||
b, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
return ""
|
||||
} else {
|
||||
return string(b)
|
||||
}
|
||||
}
|
||||
|
||||
func PluginsResponseFromJson(data io.Reader) *PluginsResponse {
|
||||
decoder := json.NewDecoder(data)
|
||||
var m PluginsResponse
|
||||
err := decoder.Decode(&m)
|
||||
if err == nil {
|
||||
return &m
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user