add settings

This commit is contained in:
微凉
2021-11-12 22:56:30 +08:00
parent 2c675ae909
commit e902c2ded7
4 changed files with 35 additions and 10 deletions

View File

@ -2,6 +2,7 @@ package model
import (
"github.com/Xhofe/alist/conf"
"strings"
)
const (
@ -50,3 +51,14 @@ func GetSettingByKey(key string) (*SettingItem, error) {
}
return &items, nil
}
func LoadSettings() {
textTypes, err := GetSettingByKey("text types")
if err == nil {
conf.TextTypes = strings.Split(textTypes.Value, ",")
}
checkParent, err := GetSettingByKey("check parent folder")
if err == nil {
conf.CheckParent = checkParent.Value == "true"
}
}