feat: custom filename char mapping

fixes #2447 #2446 #2440 #2409 #2006 #1979 #1507 #324 #691 #518 #430
This commit is contained in:
Noah Hsu
2022-11-22 15:54:18 +08:00
parent 25fd343069
commit c09800790b
10 changed files with 43 additions and 18 deletions

View File

@ -6,7 +6,9 @@ import (
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
type SettingItemHook struct {
@ -65,6 +67,16 @@ var SettingItemHooks = map[string]SettingItemHook{
return nil
},
},
conf.FilenameCharMapping: {
Hook: func(item *model.SettingItem) error {
err := utils.Json.UnmarshalFromString(item.Value, &conf.FilenameCharMap)
if err != nil {
return err
}
log.Debugf("filename char mapping: %+v", conf.FilenameCharMap)
return nil
},
},
}
func HandleSettingItem(item *model.SettingItem) (bool, error) {