mirror of
https://github.com/mindoc-org/mindoc.git
synced 2026-02-27 17:03:57 +08:00
1、实现富文本编辑器
2、实现文档转换为PDF、MOBI、EPUB、Word格式 3、实现登录后跳转到来源地址
This commit is contained in:
@@ -20,7 +20,7 @@ const RegexpEmail = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-
|
||||
const RegexpAccount = `^[a-zA-Z][a-zA-z0-9\.]{2,50}$`
|
||||
|
||||
// PageSize 默认分页条数.
|
||||
const PageSize = 15
|
||||
const PageSize = 10
|
||||
|
||||
// 用户权限
|
||||
const (
|
||||
@@ -44,23 +44,31 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
LoggerOperate = "operate"
|
||||
LoggerSystem = "system"
|
||||
LoggerOperate = "operate"
|
||||
LoggerSystem = "system"
|
||||
LoggerException = "exception"
|
||||
LoggerDocument = "document"
|
||||
LoggerDocument = "document"
|
||||
)
|
||||
const (
|
||||
//本地账户校验
|
||||
AuthMethodLocal = "local"
|
||||
//LDAP用户校验
|
||||
AuthMethodLDAP = "ldap"
|
||||
AuthMethodLDAP = "ldap"
|
||||
)
|
||||
|
||||
var (
|
||||
VERSION string
|
||||
BUILD_TIME string
|
||||
GO_VERSION string
|
||||
)
|
||||
|
||||
var (
|
||||
ConfigurationFile = "./conf/app.conf"
|
||||
WorkingDirectory = "./"
|
||||
LogFile = "./logs"
|
||||
BaseUrl = ""
|
||||
)
|
||||
|
||||
// app_key
|
||||
func GetAppKey() string {
|
||||
return beego.AppConfig.DefaultString("app_key", "godoc")
|
||||
@@ -102,29 +110,30 @@ func GetUploadFileExt() []string {
|
||||
}
|
||||
return exts
|
||||
}
|
||||
|
||||
// 获取上传文件允许的最大值
|
||||
func GetUploadFileSize() int64 {
|
||||
size := beego.AppConfig.DefaultString("upload_file_size","0")
|
||||
size := beego.AppConfig.DefaultString("upload_file_size", "0")
|
||||
|
||||
if strings.HasSuffix(size,"MB") {
|
||||
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
|
||||
if strings.HasSuffix(size, "MB") {
|
||||
if s, e := strconv.ParseInt(size[0:len(size)-2], 10, 64); e == nil {
|
||||
return s * 1024 * 1024
|
||||
}
|
||||
}
|
||||
if strings.HasSuffix(size,"GB") {
|
||||
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
|
||||
if strings.HasSuffix(size, "GB") {
|
||||
if s, e := strconv.ParseInt(size[0:len(size)-2], 10, 64); e == nil {
|
||||
return s * 1024 * 1024 * 1024
|
||||
}
|
||||
}
|
||||
if strings.HasSuffix(size,"KB") {
|
||||
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
|
||||
if strings.HasSuffix(size, "KB") {
|
||||
if s, e := strconv.ParseInt(size[0:len(size)-2], 10, 64); e == nil {
|
||||
return s * 1024
|
||||
}
|
||||
}
|
||||
if s,e := strconv.ParseInt(size, 10, 64);e == nil {
|
||||
if s, e := strconv.ParseInt(size, 10, 64); e == nil {
|
||||
return s * 1024
|
||||
}
|
||||
return 0
|
||||
return 0
|
||||
}
|
||||
|
||||
//判断是否是允许商城的文件类型.
|
||||
|
||||
30
conf/mail.go
30
conf/mail.go
@@ -6,33 +6,33 @@ import (
|
||||
)
|
||||
|
||||
type SmtpConf struct {
|
||||
EnableMail bool
|
||||
MailNumber int
|
||||
EnableMail bool
|
||||
MailNumber int
|
||||
SmtpUserName string
|
||||
SmtpHost string
|
||||
SmtpHost string
|
||||
SmtpPassword string
|
||||
SmtpPort int
|
||||
SmtpPort int
|
||||
FormUserName string
|
||||
MailExpired int
|
||||
MailExpired int
|
||||
}
|
||||
|
||||
func GetMailConfig() *SmtpConf {
|
||||
user_name := beego.AppConfig.String("smtp_user_name")
|
||||
password := beego.AppConfig.String("smtp_password")
|
||||
smtp_host := beego.AppConfig.String("smtp_host")
|
||||
smtp_port := beego.AppConfig.DefaultInt("smtp_port",25)
|
||||
smtp_port := beego.AppConfig.DefaultInt("smtp_port", 25)
|
||||
form_user_name := beego.AppConfig.String("form_user_name")
|
||||
enable_mail := beego.AppConfig.String("enable_mail")
|
||||
mail_number := beego.AppConfig.DefaultInt("mail_number",5)
|
||||
mail_number := beego.AppConfig.DefaultInt("mail_number", 5)
|
||||
|
||||
c := &SmtpConf{
|
||||
EnableMail : strings.EqualFold(enable_mail,"true"),
|
||||
MailNumber: mail_number,
|
||||
SmtpUserName:user_name,
|
||||
SmtpHost:smtp_host,
|
||||
SmtpPassword:password,
|
||||
FormUserName:form_user_name,
|
||||
SmtpPort:smtp_port,
|
||||
EnableMail: strings.EqualFold(enable_mail, "true"),
|
||||
MailNumber: mail_number,
|
||||
SmtpUserName: user_name,
|
||||
SmtpHost: smtp_host,
|
||||
SmtpPassword: password,
|
||||
FormUserName: form_user_name,
|
||||
SmtpPort: smtp_port,
|
||||
}
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user