Feat: generate share URL

This commit is contained in:
HFO4
2020-01-26 13:07:05 +08:00
parent 4abd5b2346
commit 0ee0ac5e89
14 changed files with 204 additions and 19 deletions

View File

@@ -15,6 +15,7 @@ func ParamErrorMsg(filed string, tag string) string {
"UserName": "邮箱",
"Password": "密码",
"Path": "路径",
"SourceID": "原始资源",
}
// 未通过的规则与中文对应
tagMap := map[string]string{

View File

@@ -0,0 +1,17 @@
package controllers
import (
"github.com/HFO4/cloudreve/service/share"
"github.com/gin-gonic/gin"
)
// CreateShare 创建分享
func CreateShare(c *gin.Context) {
var service share.ShareCreateService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.Create(c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}

View File

@@ -21,6 +21,8 @@ func SiteConfig(c *gin.Context) {
"email_active",
"themes",
"defaultTheme",
"score_enabled",
"share_score_rate",
})
// 如果已登录,则同时返回用户信息