mirror of https://github.com/Xhofe/alist
Add a SIGN button to the management panel.
parent
0e2a22ec8c
commit
ad7f3e2737
|
@ -8,6 +8,7 @@ import (
|
||||||
type Addition struct {
|
type Addition struct {
|
||||||
driver.RootPath
|
driver.RootPath
|
||||||
Thumbnail bool `json:"thumbnail" required:"true" help:"enable thumbnail"`
|
Thumbnail bool `json:"thumbnail" required:"true" help:"enable thumbnail"`
|
||||||
|
Sign bool `json:"sign" default:"false" required:"false" help:"enable sign"`
|
||||||
ShowHidden bool `json:"show_hidden" default:"true" required:"false" help:"show hidden directories and files"`
|
ShowHidden bool `json:"show_hidden" default:"true" required:"false" help:"show hidden directories and files"`
|
||||||
MkdirPerm string `json:"mkdir_perm" default:"777"`
|
MkdirPerm string `json:"mkdir_perm" default:"777"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,18 @@ import (
|
||||||
json "github.com/json-iterator/go"
|
json "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type signType struct {
|
||||||
|
Sign bool `json:"sign"`
|
||||||
|
}
|
||||||
|
|
||||||
func IsStorageSigned(rawPath string) bool {
|
func IsStorageSigned(rawPath string) bool {
|
||||||
|
var jsonData signType
|
||||||
storage := op.GetBalancedStorage(rawPath).GetStorage()
|
storage := op.GetBalancedStorage(rawPath).GetStorage()
|
||||||
var jsonData = map[string]interface{}{}
|
|
||||||
err := json.Unmarshal([]byte(storage.Addition), &jsonData)
|
err := json.Unmarshal([]byte(storage.Addition), &jsonData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if jsonData["sign"] == "true" {
|
if jsonData.Sign == true {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
## Put dist of frontend here.
|
|
Loading…
Reference in New Issue