feat(share): add option to automatically render and show README file (#2382)

This commit is contained in:
Aaron Liu
2025-07-04 14:40:32 +08:00
parent aada3aab02
commit fe2ccb4d4e
6 changed files with 10 additions and 2 deletions

View File

@@ -280,6 +280,7 @@ type Share struct {
CreatedAt time.Time `json:"created_at,omitempty"`
Expired bool `json:"expired"`
Url string `json:"url"`
ShowReadMe bool `json:"show_readme,omitempty"`
// Only viewable by owner
IsPrivate bool `json:"is_private,omitempty"`
@@ -313,6 +314,7 @@ func BuildShare(s *ent.Share, base *url.URL, hasher hashid.Encoder, requester *e
res.Downloaded = s.Downloads
res.Expires = s.Expires
res.Password = s.Password
res.ShowReadMe = s.Props != nil && s.Props.ShowReadMe
}
if requester.ID == owner.ID {