mirror of https://github.com/Xhofe/alist
parent
40b0e66efe
commit
221cdf3611
|
@ -99,8 +99,12 @@ func (d *S3) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*mo
|
|||
var link model.Link
|
||||
var err error
|
||||
if d.CustomHost != "" {
|
||||
if d.EnableCustomHostPresign {
|
||||
link.URL, err = req.Presign(time.Hour * time.Duration(d.SignURLExpire))
|
||||
} else {
|
||||
err = req.Build()
|
||||
link.URL = req.HTTPRequest.URL.String()
|
||||
}
|
||||
if d.RemoveBucket {
|
||||
link.URL = strings.Replace(link.URL, "/"+d.Bucket, "", 1)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ type Addition struct {
|
|||
SecretAccessKey string `json:"secret_access_key" required:"true"`
|
||||
SessionToken string `json:"session_token"`
|
||||
CustomHost string `json:"custom_host"`
|
||||
EnableCustomHostPresign bool `json:"enable_custom_host_presign"`
|
||||
SignURLExpire int `json:"sign_url_expire" type:"number" default:"4"`
|
||||
Placeholder string `json:"placeholder"`
|
||||
ForcePathStyle bool `json:"force_path_style"`
|
||||
|
|
Loading…
Reference in New Issue