mirror of https://github.com/mindoc-org/mindoc.git
feat:实现Modules支持
parent
7104698000
commit
693de8f293
|
@ -286,7 +286,7 @@ func ResolveCommand(args []string) {
|
||||||
if err := flagSet.Parse(args); err != nil {
|
if err := flagSet.Parse(args); err != nil {
|
||||||
log.Fatal("解析命令失败 ->", err)
|
log.Fatal("解析命令失败 ->", err)
|
||||||
}
|
}
|
||||||
|
fmt.Println(conf.WorkingDirectory)
|
||||||
if conf.WorkingDirectory == "" {
|
if conf.WorkingDirectory == "" {
|
||||||
if p, err := filepath.Abs(os.Args[0]); err == nil {
|
if p, err := filepath.Abs(os.Args[0]); err == nil {
|
||||||
conf.WorkingDirectory = filepath.Dir(p)
|
conf.WorkingDirectory = filepath.Dir(p)
|
||||||
|
@ -519,7 +519,7 @@ func init() {
|
||||||
conf.ConfigurationFile = configPath
|
conf.ConfigurationFile = configPath
|
||||||
}
|
}
|
||||||
if err := gocaptcha.ReadFonts(conf.WorkingDir("static", "fonts"), ".ttf"); err != nil {
|
if err := gocaptcha.ReadFonts(conf.WorkingDir("static", "fonts"), ".ttf"); err != nil {
|
||||||
log.Fatal("读取字体文件失败 ->", err)
|
beego.Error("读取字体文件失败 ->", err)
|
||||||
}
|
}
|
||||||
gob.Register(models.Member{})
|
gob.Register(models.Member{})
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
package conf
|
package conf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
|
||||||
"strconv"
|
|
||||||
"path/filepath"
|
|
||||||
"os"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/astaxie/beego"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 登录用户的Session名
|
// 登录用户的Session名
|
||||||
|
@ -158,7 +159,7 @@ func GetExportProcessNum() int {
|
||||||
if exportProcessNum <= 0 || exportProcessNum > 4 {
|
if exportProcessNum <= 0 || exportProcessNum > 4 {
|
||||||
exportProcessNum = 1
|
exportProcessNum = 1
|
||||||
}
|
}
|
||||||
return exportProcessNum;
|
return exportProcessNum
|
||||||
}
|
}
|
||||||
|
|
||||||
//导出项目队列的并发数量
|
//导出项目队列的并发数量
|
||||||
|
@ -168,7 +169,7 @@ func GetExportLimitNum() int {
|
||||||
if exportLimitNum < 0 {
|
if exportLimitNum < 0 {
|
||||||
exportLimitNum = 1
|
exportLimitNum = 1
|
||||||
}
|
}
|
||||||
return exportLimitNum;
|
return exportLimitNum
|
||||||
}
|
}
|
||||||
|
|
||||||
//等待导出队列的长度
|
//等待导出队列的长度
|
||||||
|
@ -210,7 +211,7 @@ func IsAllowUploadFileExt(ext string) bool {
|
||||||
//重写生成URL的方法,加上完整的域名
|
//重写生成URL的方法,加上完整的域名
|
||||||
func URLFor(endpoint string, values ...interface{}) string {
|
func URLFor(endpoint string, values ...interface{}) string {
|
||||||
baseUrl := beego.AppConfig.DefaultString("baseurl", "")
|
baseUrl := beego.AppConfig.DefaultString("baseurl", "")
|
||||||
pathUrl := beego.URLFor(endpoint, values ...)
|
pathUrl := beego.URLFor(endpoint, values...)
|
||||||
|
|
||||||
if baseUrl == "" {
|
if baseUrl == "" {
|
||||||
baseUrl = BaseUrl
|
baseUrl = BaseUrl
|
||||||
|
@ -224,12 +225,12 @@ func URLFor(endpoint string, values ...interface{}) string {
|
||||||
if !strings.HasPrefix(pathUrl, "/") && !strings.HasSuffix(baseUrl, "/") {
|
if !strings.HasPrefix(pathUrl, "/") && !strings.HasSuffix(baseUrl, "/") {
|
||||||
return baseUrl + "/" + pathUrl
|
return baseUrl + "/" + pathUrl
|
||||||
}
|
}
|
||||||
return baseUrl + beego.URLFor(endpoint, values ...)
|
return baseUrl + beego.URLFor(endpoint, values...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func URLForNotHost(endpoint string,values ...interface{}) string {
|
func URLForNotHost(endpoint string, values ...interface{}) string {
|
||||||
baseUrl := beego.AppConfig.DefaultString("baseurl", "")
|
baseUrl := beego.AppConfig.DefaultString("baseurl", "")
|
||||||
pathUrl := beego.URLFor(endpoint, values ...)
|
pathUrl := beego.URLFor(endpoint, values...)
|
||||||
|
|
||||||
if baseUrl == "" {
|
if baseUrl == "" {
|
||||||
baseUrl = "/"
|
baseUrl = "/"
|
||||||
|
@ -243,7 +244,7 @@ func URLForNotHost(endpoint string,values ...interface{}) string {
|
||||||
if !strings.HasPrefix(pathUrl, "/") && !strings.HasSuffix(baseUrl, "/") {
|
if !strings.HasPrefix(pathUrl, "/") && !strings.HasSuffix(baseUrl, "/") {
|
||||||
return baseUrl + "/" + pathUrl
|
return baseUrl + "/" + pathUrl
|
||||||
}
|
}
|
||||||
return baseUrl + beego.URLFor(endpoint, values ...)
|
return baseUrl + beego.URLFor(endpoint, values...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func URLForWithCdnImage(p string) string {
|
func URLForWithCdnImage(p string) string {
|
||||||
|
@ -344,12 +345,12 @@ func WorkingDir(elem ...string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
if p, err := exec.LookPath(os.Args[0]); err == nil {
|
||||||
|
WorkingDirectory = p
|
||||||
|
}
|
||||||
if p, err := filepath.Abs("./conf/app.conf"); err == nil {
|
if p, err := filepath.Abs("./conf/app.conf"); err == nil {
|
||||||
ConfigurationFile = p
|
ConfigurationFile = p
|
||||||
}
|
}
|
||||||
if p, err := filepath.Abs("./"); err == nil {
|
|
||||||
WorkingDirectory = p
|
|
||||||
}
|
|
||||||
if p, err := filepath.Abs("./runtime/logs"); err == nil {
|
if p, err := filepath.Abs("./runtime/logs"); err == nil {
|
||||||
LogFile = p
|
LogFile = p
|
||||||
}
|
}
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -9,7 +9,7 @@ require (
|
||||||
github.com/howeyc/fsnotify v0.9.0
|
github.com/howeyc/fsnotify v0.9.0
|
||||||
github.com/kardianos/service v1.1.0
|
github.com/kardianos/service v1.1.0
|
||||||
github.com/lifei6671/gocaptcha v0.1.1
|
github.com/lifei6671/gocaptcha v0.1.1
|
||||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||||
github.com/russross/blackfriday v1.5.2
|
github.com/russross/blackfriday v1.5.2
|
||||||
github.com/russross/blackfriday/v2 v2.0.1
|
github.com/russross/blackfriday/v2 v2.0.1
|
||||||
|
|
Loading…
Reference in New Issue