feat: update reset thumbnail feature (#2854)

* update reset thumbnail feature

* consolidate supported thumbnail extensions into site config; remove dedicated API

* allow patching thumb ; remove Reset Thumbnail API

* fix code formatting

---------

Co-authored-by: Aaron Liu <abslant.liu@gmail.com>
This commit is contained in:
Mason Liu
2025-09-23 11:24:38 +08:00
committed by GitHub
parent 440ab775b8
commit 668b542c59
4 changed files with 62 additions and 1 deletions

View File

@@ -97,6 +97,15 @@ var (
},
},
"dav": {},
// Allow manipulating thumbnail metadata via public PatchMetadata API
"thumb": {
// Only supported thumb metadata currently is thumb:disabled
dbfs.ThumbDisabledKey: func(ctx context.Context, m *manager, patch *fs.MetadataPatch) error {
// Presence of this key disables thumbnails; value is ignored.
// We allow both setting and removing this key.
return nil
},
},
customizeMetadataSuffix: {
iconColorMetadataKey: validateColor(false),
emojiIconMetadataKey: func(ctx context.Context, m *manager, patch *fs.MetadataPatch) error {

View File

@@ -19,6 +19,10 @@ import (
const thumbTempFolder = "thumb"
// BuiltinSupportedExts lists file extensions supported by the built-in
// thumbnail generator. Extensions are lowercased and do not include the dot.
var BuiltinSupportedExts = []string{"jpg", "jpeg", "png", "gif"}
// Thumb 缩略图
type Thumb struct {
src image.Image