mirror of
https://github.com/mindoc-org/mindoc.git
synced 2026-02-27 17:03:57 +08:00
实现文档编辑
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
// package conf 为配置相关.
|
||||
package conf
|
||||
|
||||
import "github.com/astaxie/beego"
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 登录用户的Session名
|
||||
const LoginSessionName = "LoginSessionName"
|
||||
@@ -53,4 +56,36 @@ func GetTokenSize() int {
|
||||
|
||||
func GetDefaultCover() string {
|
||||
return beego.AppConfig.DefaultString("cover","/static/images/book.jpg")
|
||||
}
|
||||
|
||||
func GetUploadFileExt() []string {
|
||||
ext := beego.AppConfig.DefaultString("upload_file_ext","png|jpg|jpeg|gif|txt|doc|docx|pdf")
|
||||
|
||||
temp := strings.Split(ext,"|")
|
||||
|
||||
exts := make([]string,len(temp))
|
||||
|
||||
i := 0
|
||||
for _,item := range temp {
|
||||
if item != "" {
|
||||
exts[i] = item
|
||||
i++
|
||||
}
|
||||
}
|
||||
return exts
|
||||
}
|
||||
|
||||
func IsAllowUploadFileExt(ext string) bool {
|
||||
|
||||
if strings.HasPrefix(ext,".") {
|
||||
ext = string(ext[1:])
|
||||
}
|
||||
exts := GetUploadFileExt()
|
||||
|
||||
for _,item := range exts {
|
||||
if strings.EqualFold(item,ext) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user