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{}
|
||||
if len(req.Query) > 0 {
|
||||
switch req.Query["type"] {
|
||||
case "":
|
||||
case "image":
|
||||
opt.Image = &s3.Image{}
|
||||
opt.Image.Format = req.Query["format"]
|
||||
opt.Image.Width, _ = strconv.Atoi(req.Query["width"])
|
||||
opt.Image.Height, _ = strconv.Atoi(req.Query["height"])
|
||||
case "video":
|
||||
opt.Video = &s3.Video{}
|
||||
opt.Video.Format = req.Query["format"]
|
||||
opt.Video.Width, _ = strconv.Atoi(req.Query["width"])
|
||||
opt.Video.Height, _ = strconv.Atoi(req.Query["height"])
|
||||
millisecond, _ := strconv.Atoi(req.Query["time"])
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user