mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
Add blurhash to file info struct
This commit is contained in:
parent
370913378a
commit
d014d56e85
1 changed files with 16 additions and 4 deletions
|
|
@ -199,10 +199,14 @@ type FileInfo struct {
|
|||
ThumbnailInfo *FileInfo `json:"thumbnail_info,omitempty"`
|
||||
ThumbnailURL id.ContentURIString `json:"thumbnail_url,omitempty"`
|
||||
ThumbnailFile *EncryptedFileInfo `json:"thumbnail_file,omitempty"`
|
||||
Width int `json:"-"`
|
||||
Height int `json:"-"`
|
||||
Duration int `json:"-"`
|
||||
Size int `json:"-"`
|
||||
|
||||
Blurhash string `json:"blurhash,omitempty"`
|
||||
AnoaBlurhash string `json:"xyz.amorgan.blurhash,omitempty"`
|
||||
|
||||
Width int `json:"-"`
|
||||
Height int `json:"-"`
|
||||
Duration int `json:"-"`
|
||||
Size int `json:"-"`
|
||||
}
|
||||
|
||||
type serializableFileInfo struct {
|
||||
|
|
@ -211,6 +215,9 @@ type serializableFileInfo struct {
|
|||
ThumbnailURL id.ContentURIString `json:"thumbnail_url,omitempty"`
|
||||
ThumbnailFile *EncryptedFileInfo `json:"thumbnail_file,omitempty"`
|
||||
|
||||
Blurhash string `json:"blurhash,omitempty"`
|
||||
AnoaBlurhash string `json:"xyz.amorgan.blurhash,omitempty"`
|
||||
|
||||
Width json.Number `json:"w,omitempty"`
|
||||
Height json.Number `json:"h,omitempty"`
|
||||
Duration json.Number `json:"duration,omitempty"`
|
||||
|
|
@ -226,6 +233,9 @@ func (sfi *serializableFileInfo) CopyFrom(fileInfo *FileInfo) *serializableFileI
|
|||
ThumbnailURL: fileInfo.ThumbnailURL,
|
||||
ThumbnailInfo: (&serializableFileInfo{}).CopyFrom(fileInfo.ThumbnailInfo),
|
||||
ThumbnailFile: fileInfo.ThumbnailFile,
|
||||
|
||||
Blurhash: fileInfo.Blurhash,
|
||||
AnoaBlurhash: fileInfo.AnoaBlurhash,
|
||||
}
|
||||
if fileInfo.Width > 0 {
|
||||
sfi.Width = json.Number(strconv.Itoa(fileInfo.Width))
|
||||
|
|
@ -252,6 +262,8 @@ func (sfi *serializableFileInfo) CopyTo(fileInfo *FileInfo) {
|
|||
MimeType: sfi.MimeType,
|
||||
ThumbnailURL: sfi.ThumbnailURL,
|
||||
ThumbnailFile: sfi.ThumbnailFile,
|
||||
Blurhash: sfi.Blurhash,
|
||||
AnoaBlurhash: sfi.AnoaBlurhash,
|
||||
}
|
||||
if sfi.ThumbnailInfo != nil {
|
||||
fileInfo.ThumbnailInfo = &FileInfo{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue