diff --git a/README.md b/README.md index b6add44..a83f316 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ |---------------|-----------------| | 站点身份 | 站点身份 | | 颜色 | 颜色 | -| 页眉图片 | 页眉媒体 (暂不支持视频) | +| 页眉图片 | 页眉媒体 | | 背景图片 | 额外css | | 额外css | | diff --git a/app/pkg/dao/posts.go b/app/pkg/dao/posts.go index 6846d9c..6338fef 100644 --- a/app/pkg/dao/posts.go +++ b/app/pkg/dao/posts.go @@ -66,6 +66,7 @@ func GetPostsByIds(a ...any) (m map[uint64]models.Posts, err error) { } mm, ok := meta[pp.Id] if ok { + pp.Metas = mm attMeta, ok := mm["_wp_attachment_metadata"] if ok { att, ok := attMeta.(models.WpAttachmentMetadata) diff --git a/app/pkg/models/wp_postmeta.go b/app/pkg/models/wp_postmeta.go index b31bb72..fc61b24 100644 --- a/app/pkg/models/wp_postmeta.go +++ b/app/pkg/models/wp_postmeta.go @@ -22,6 +22,7 @@ type WpAttachmentMetadata struct { FileSize int `json:"filesize,omitempty"` Sizes map[string]MetaDataFileSize `json:"sizes,omitempty"` ImageMeta ImageMeta `json:"image_meta"` + VideoMeta } type ImageMeta struct { @@ -39,6 +40,16 @@ type ImageMeta struct { Keywords []string `json:"keywords,omitempty"` } +type VideoMeta struct { + Bitrate int `json:"bitrate,omitempty"` + MimeType string `json:"mime_type,omitempty"` + Length int `json:"length,omitempty"` + LengthFormatted string `json:"length_formatted,omitempty"` + FileFormat string `json:"fileformat,omitempty"` + DataFormat string `json:"dataformat,omitempty"` + CreatedTimestamp int64 `json:"created_timestamp"` +} + type MetaDataFileSize struct { File string `json:"file,omitempty"` Width int `json:"width,omitempty"` diff --git a/app/pkg/models/wp_posts.go b/app/pkg/models/wp_posts.go index 34d6e41..fd9bbdc 100644 --- a/app/pkg/models/wp_posts.go +++ b/app/pkg/models/wp_posts.go @@ -40,6 +40,7 @@ type Posts struct { IsSticky bool Thumbnail PostThumbnail AttachmentMetadata WpAttachmentMetadata + Metas map[string]any Author *Users } diff --git a/app/theme/twentyfifteen/customheader.go b/app/theme/twentyfifteen/customheader.go index 35169b5..838623c 100644 --- a/app/theme/twentyfifteen/customheader.go +++ b/app/theme/twentyfifteen/customheader.go @@ -83,8 +83,8 @@ var imgStyle = `.site-header { var header = reload.Vars(constraints.Defaults) -func calCustomHeader(h *wp.Handle) (r string, rand bool) { - img, rand := h.GetCustomHeader() +func calCustomHeaderImg(h *wp.Handle) (r string, rand bool) { + img, rand := h.GetCustomHeaderImg() if img.Path == "" && h.DisplayHeaderText() { return } @@ -112,7 +112,7 @@ func customHeader(h *wp.Handle) func() string { return func() string { headers := header.Load() if headers == constraints.Defaults { - headerss, rand := calCustomHeader(h) + headerss, rand := calCustomHeaderImg(h) headers = headerss if !rand { header.Store(headers) diff --git a/app/theme/twentyseventeen/layout/base.gohtml b/app/theme/twentyseventeen/layout/base.gohtml index a6048ee..55d2410 100644 --- a/app/theme/twentyseventeen/layout/base.gohtml +++ b/app/theme/twentyseventeen/layout/base.gohtml @@ -11,7 +11,7 @@