🎇 Pagination #257

This commit is contained in:
微凉
2022-01-04 21:21:27 +08:00
parent b60c7ecd9e
commit ef5cad1bf0
8 changed files with 98 additions and 43 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/eko/gocache/v2/cache"
"github.com/robfig/cron/v3"
"gorm.io/gorm"
"strconv"
)
var (
@ -38,16 +39,57 @@ var (
ImageTypes = []string{"jpg", "tiff", "jpeg", "png", "gif", "bmp", "svg", "ico"}
)
// settings
var settingsMap = make(map[string]string, 0)
func Set(key string, value string) {
settingsMap[key] = value
}
func GetStr(key string) string {
value, ok := settingsMap[key]
if !ok {
return ""
}
return value
}
func GetBool(key string) bool {
value, ok := settingsMap[key]
if !ok {
return false
}
return value == "true"
}
func GetInt(key string, defaultV int) int {
value, ok := settingsMap[key]
if !ok {
return defaultV
}
v, err := strconv.Atoi(value)
if err != nil {
return defaultV
}
return v
}
var (
LoadSettings = []string{
"check parent folder", "check down link", "WebDAV username", "WebDAV password",
"Visitor WebDAV username", "Visitor WebDAV password",
"default page size", "load type",
}
)
var (
RawIndexHtml string
IndexHtml string
CheckParent bool
CheckDown bool
Token string
Token string
DavUsername string
DavPassword string
VisitorDavUsername string
VisitorDavPassword string
//CheckParent bool
//CheckDown bool
//DavUsername string
//DavPassword string
//VisitorDavUsername string
//VisitorDavPassword string
)