Feat: get policy from directory props / Feat: return source enabled flag in file list

This commit is contained in:
HFO4
2022-02-10 19:25:38 +08:00
parent c84d0114ae
commit 855c9d92c4
14 changed files with 101 additions and 91 deletions

View File

@@ -27,7 +27,6 @@ type User struct {
CreatedAt time.Time `json:"created_at"`
PreferredTheme string `json:"preferred_theme"`
Anonymous bool `json:"anonymous"`
Policy policy `json:"policy"`
Group group `json:"group"`
Tags []tag `json:"tags"`
}
@@ -98,13 +97,6 @@ func BuildUser(user model.User) User {
CreatedAt: user.CreatedAt,
PreferredTheme: user.OptionsSerialized.PreferredTheme,
Anonymous: user.IsAnonymous(),
Policy: policy{
SaveType: user.Policy.Type,
MaxSize: fmt.Sprintf("%.2fmb", float64(user.Policy.MaxSize)/(1024*1024)),
AllowedType: user.Policy.OptionsSerialized.FileType,
UploadURL: user.Policy.GetUploadURL(),
AllowGetSource: user.Policy.IsOriginLinkEnable,
},
Group: group{
ID: user.GroupID,
Name: user.Group.Name,