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"
|
|
|
|
)
|
|
|
|
|
2022-11-11 08:24:25 +00:00
|
|
|
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 ""
|
|
|
|
}
|
2022-11-11 08:24:25 +00:00
|
|
|
return sign.Sign(stdpath.Join(parent, obj.GetName()))
|
2022-06-28 13:58:46 +00:00
|
|
|
}
|