Feat: options to disable preview in file sharing

This commit is contained in:
HFO4
2020-01-29 11:03:09 +08:00
parent 1ff4d59978
commit 68704f8646
7 changed files with 47 additions and 14 deletions

View File

@@ -407,8 +407,6 @@ func (client *Client) MonitorUpload(uploadURL, callbackKey, path string, size ui
}
return
}
util.Log().Debug("无法获取上传会话状态,%s", err.Error())
return
}
util.Log().Debug("无法获取上传会话状态,继续下一轮,%s", err.Error())
}

View File

@@ -156,7 +156,7 @@ func (fs *FileSystem) DispatchHandler() error {
}
switch policyType {
case "mock":
case "mock", "anonymous":
return nil
case "local":
fs.Handler = local.Driver{

View File

@@ -16,6 +16,7 @@ type Share struct {
Downloads int `json:"downloads"`
Views int `json:"views"`
Expire int64 `json:"expire"`
Preview bool `json:"preview"`
Creator *shareCreator `json:"creator,omitempty"`
Source *shareSource `json:"source,omitempty"`
}
@@ -53,6 +54,8 @@ func BuildShareResponse(share *model.Share, unlocked bool) Share {
resp.IsDir = share.IsDir
resp.Downloads = share.Downloads
resp.Views = share.Views
resp.Preview = share.PreviewEnabled
if share.Expires != nil {
resp.Expire = share.Expires.Unix() - time.Now().Unix()
}