|
|
@ -27,10 +27,11 @@ type User struct {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Policy struct {
|
|
|
|
type Policy struct {
|
|
|
|
SaveType string `json:"saveType"`
|
|
|
|
SaveType string `json:"saveType"`
|
|
|
|
MaxSize string `json:"maxSize"`
|
|
|
|
MaxSize string `json:"maxSize"`
|
|
|
|
AllowedType []string `json:"allowedType"`
|
|
|
|
AllowedType []string `json:"allowedType"`
|
|
|
|
UploadURL string `json:"upUrl"`
|
|
|
|
UploadURL string `json:"upUrl"`
|
|
|
|
|
|
|
|
AllowGetSource bool `json:"allowSource"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Group struct {
|
|
|
|
type Group struct {
|
|
|
@ -51,10 +52,11 @@ func BuildUser(user model.User) User {
|
|
|
|
CreatedAt: user.CreatedAt.Unix(),
|
|
|
|
CreatedAt: user.CreatedAt.Unix(),
|
|
|
|
PreferredTheme: user.OptionsSerialized.PreferredTheme,
|
|
|
|
PreferredTheme: user.OptionsSerialized.PreferredTheme,
|
|
|
|
Policy: Policy{
|
|
|
|
Policy: Policy{
|
|
|
|
SaveType: user.Policy.Type,
|
|
|
|
SaveType: user.Policy.Type,
|
|
|
|
MaxSize: fmt.Sprintf("%.2fmb", float64(user.Policy.MaxSize)/1024*1024),
|
|
|
|
MaxSize: fmt.Sprintf("%.2fmb", float64(user.Policy.MaxSize)/1024*1024),
|
|
|
|
AllowedType: user.Policy.OptionsSerialized.FileType,
|
|
|
|
AllowedType: user.Policy.OptionsSerialized.FileType,
|
|
|
|
UploadURL: user.Policy.Server,
|
|
|
|
UploadURL: user.Policy.Server,
|
|
|
|
|
|
|
|
AllowGetSource: user.Policy.IsOriginLinkEnable,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Group: Group{
|
|
|
|
Group: Group{
|
|
|
|
AllowShare: user.Group.ShareEnabled,
|
|
|
|
AllowShare: user.Group.ShareEnabled,
|
|
|
|