🎨 Remove petal id

This commit is contained in:
Liang Ding 2023-05-08 19:30:14 +08:00
parent 6468964bd2
commit fe9d83df13
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -17,8 +17,6 @@
package model package model
import ( import (
"crypto/sha1"
"fmt"
"os" "os"
"path/filepath" "path/filepath"
"sync" "sync"
@ -32,7 +30,6 @@ import (
// Petal represents a plugin's management status. // Petal represents a plugin's management status.
type Petal struct { type Petal struct {
ID string `json:"id"` // Plugin ID
Name string `json:"name"` // Plugin name Name string `json:"name"` // Plugin name
Enabled bool `json:"enabled"` // Whether enabled Enabled bool `json:"enabled"` // Whether enabled
@ -60,7 +57,6 @@ func SetPetalEnabled(name string, enabled bool) {
petal := getPetalByName(plugin.Name, petals) petal := getPetalByName(plugin.Name, petals)
if nil == petal { if nil == petal {
petal = &Petal{ petal = &Petal{
ID: hash(plugin.Name),
Name: plugin.Name, Name: plugin.Name,
Enabled: enabled, Enabled: enabled,
} }
@ -220,7 +216,3 @@ func getPetalByName(name string, petals []*Petal) (ret *Petal) {
} }
return return
} }
func hash(str string) string {
return fmt.Sprintf("%x", sha1.Sum([]byte(str)))
}