alist/server/common/sign.go

18 lines
438 B
Go
Raw Normal View History

2022-06-28 13:58:46 +00:00
package common
import (
2022-11-30 14:10:07 +00:00
stdpath "path"
"github.com/alist-org/alist/v3/internal/conf"
2022-06-28 13:58:46 +00:00
"github.com/alist-org/alist/v3/internal/model"
2022-11-30 14:10:07 +00:00
"github.com/alist-org/alist/v3/internal/setting"
2022-06-28 13:58:46 +00:00
"github.com/alist-org/alist/v3/internal/sign"
)
func Sign(obj model.Obj, parent string, encrypt bool) string {
2022-11-30 14:10:07 +00:00
if obj.IsDir() || (!encrypt && !setting.GetBool(conf.SignAll)) {
2022-06-28 13:58:46 +00:00
return ""
}
return sign.Sign(stdpath.Join(parent, obj.GetName()))
2022-06-28 13:58:46 +00:00
}