Skip to content

Commit

Permalink
Merge pull request #74 from phachon/v0.1.3
Browse files Browse the repository at this point in the history
V0.1.3
  • Loading branch information
phachon authored Jun 2, 2019
2 parents 68932fb + e4fab15 commit a2103a1
Show file tree
Hide file tree
Showing 81 changed files with 13,555 additions and 110 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@

## v0.1.3 (2018-12)
### Fix Bug & Add Feature
#### 修复bug
1. 修复启动命令不支持绝对路径问题
2. 安装向导页面优化
3. 修复首页快捷链接没有按排序号排序问题
4. 代码 go fmt
5. 更新 copyright
6. 修改系统权限 #55
7. 修复私有文档未授权访问漏洞 #55
8. 修复文档导出漏洞 #66
9. 新建文档可回车提交 #43
10. 修复文档编辑窗口过短问题 #46
11. 安装的最小环境限制 #45
11. 空间名修改后没有更新 #53

#### 新增功能
1. 新增附件上传,附件列表查看,附件删除功能
2. 图片上传分目录存储,可查看图片列表并删除
3. 分页增加每一页数量控制功能
4. 导出文件同时导出附件和图片
5. 下载文件同时下载所有的图片和附件

### Upgrade
1. 下载新版本到部署该项目的根目录
Expand Down
48 changes: 40 additions & 8 deletions app/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/astaxie/beego"
"github.com/fatih/color"
"github.com/snail007/go-activerecord/mysql"

)

var (
Expand All @@ -35,7 +34,13 @@ var (

RootDir = ""

DocumentAbsDir = ""

MarkdownAbsDir = ""

ImageAbsDir = ""

AttachmentAbsDir = ""
)

func init() {
Expand Down Expand Up @@ -94,7 +99,11 @@ func initConfig() {
beego.BConfig.AppName = beego.AppConfig.String("sys.name")
beego.BConfig.ServerName = beego.AppConfig.String("sys.name")

RootDir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
RootDir, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
log.Println("init config error: "+err.Error())
os.Exit(1)
}

// set static path
beego.SetStaticPath("/static/", filepath.Join(RootDir, "./static"))
Expand Down Expand Up @@ -156,15 +165,26 @@ func initDocumentDir() {
os.Exit(1)
}

rootAbsDir, err := filepath.Abs(docRootDir)
documentAbsDir, err := filepath.Abs(docRootDir)
if err != nil {
beego.Error("document root dir " + docRootDir + " is error!")
os.Exit(1)
}

markDownAbsDir := path.Join(rootAbsDir, "markdowns")
imagesAbsDir := path.Join(rootAbsDir, "images")
DocumentAbsDir = documentAbsDir

// markdown save dir
markDownAbsDir := path.Join(documentAbsDir, "markdowns")
// image save dir
imagesAbsDir := path.Join(documentAbsDir, "images")
// attachment save dir
attachmentAbsDir := path.Join(documentAbsDir, "attachment")

MarkdownAbsDir = markDownAbsDir
ImageAbsDir = imagesAbsDir
AttachmentAbsDir = attachmentAbsDir

// create markdown dir
ok, _ = utils.File.PathIsExists(markDownAbsDir)
if !ok {
err := os.Mkdir(markDownAbsDir, 0777)
Expand All @@ -173,7 +193,7 @@ func initDocumentDir() {
os.Exit(1)
}
}

// create image dir
ok, _ = utils.File.PathIsExists(imagesAbsDir)
if !ok {
err := os.Mkdir(imagesAbsDir, 0777)
Expand All @@ -182,11 +202,23 @@ func initDocumentDir() {
os.Exit(1)
}
}
// create attachment dir
ok, _ = utils.File.PathIsExists(attachmentAbsDir)
if !ok {
err := os.Mkdir(attachmentAbsDir, 0777)
if err != nil {
beego.Error("create document attachment dir " + attachmentAbsDir + " error!")
os.Exit(1)
}
}

utils.Document.RootAbsDir = markDownAbsDir
ImageAbsDir = imagesAbsDir
// utils document
utils.Document.MarkdownAbsDir = markDownAbsDir
utils.Document.DocumentAbsDir = documentAbsDir

beego.SetStaticPath("/images/", ImageAbsDir)
// todo
beego.SetStaticPath("/images/:space_id/:document_id/", ImageAbsDir)
}

// check upgrade
Expand Down
Loading

0 comments on commit a2103a1

Please sign in to comment.