mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-01-07 12:17:02 +08:00
feat: s3 AccessURL
This commit is contained in:
parent
77ab72044b
commit
7bfffacaa3
@ -156,16 +156,21 @@ func (t *thirdServer) AccessURL(ctx context.Context, req *third.AccessURLReq) (*
|
|||||||
opt := &s3.AccessURLOption{}
|
opt := &s3.AccessURLOption{}
|
||||||
if len(req.Query) > 0 {
|
if len(req.Query) > 0 {
|
||||||
switch req.Query["type"] {
|
switch req.Query["type"] {
|
||||||
|
case "":
|
||||||
case "image":
|
case "image":
|
||||||
|
opt.Image = &s3.Image{}
|
||||||
opt.Image.Format = req.Query["format"]
|
opt.Image.Format = req.Query["format"]
|
||||||
opt.Image.Width, _ = strconv.Atoi(req.Query["width"])
|
opt.Image.Width, _ = strconv.Atoi(req.Query["width"])
|
||||||
opt.Image.Height, _ = strconv.Atoi(req.Query["height"])
|
opt.Image.Height, _ = strconv.Atoi(req.Query["height"])
|
||||||
case "video":
|
case "video":
|
||||||
|
opt.Video = &s3.Video{}
|
||||||
opt.Video.Format = req.Query["format"]
|
opt.Video.Format = req.Query["format"]
|
||||||
opt.Video.Width, _ = strconv.Atoi(req.Query["width"])
|
opt.Video.Width, _ = strconv.Atoi(req.Query["width"])
|
||||||
opt.Video.Height, _ = strconv.Atoi(req.Query["height"])
|
opt.Video.Height, _ = strconv.Atoi(req.Query["height"])
|
||||||
millisecond, _ := strconv.Atoi(req.Query["time"])
|
millisecond, _ := strconv.Atoi(req.Query["time"])
|
||||||
opt.Video.Time = time.Millisecond * time.Duration(millisecond)
|
opt.Video.Time = time.Millisecond * time.Duration(millisecond)
|
||||||
|
default:
|
||||||
|
return nil, errs.ErrArgs.Wrap("invalid query type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expireTime, rawURL, err := t.s3dataBase.AccessURL(ctx, req.Name, t.defaultExpire, opt)
|
expireTime, rawURL, err := t.s3dataBase.AccessURL(ctx, req.Name, t.defaultExpire, opt)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user