Skip to content

Commit 860070c

Browse files
committed
上传OSS的多媒体文件,设置为私有
1 parent 5638193 commit 860070c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

change.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333

3434
## v2.10 升级日志
3535
- [x] 支持音频和视频上传
36-
- [ ] 如果开启了OSS云存储,则将音视频上传上去的同时将音视频设置为私有
36+
- [x] 如果开启了OSS云存储,则将音视频上传上去的同时将音视频设置为私有
3737
- [x] 支持音频和视频播放管理
3838
- [x] 管理后台,恢复和优化附件管理功能
3939
- [ ] 如果管理员或者用户是书籍项目所有人,则音视频链接支持直链播放,否则对音视频链接进行一定的防盗链处理
40-
- [ ] 优化程序内的 `cmd` 执行
40+
- [x] 优化程序内的 `cmd` 执行
4141
- [x] 内容阅读页面音频视频播放功能
4242
- [x] 音频和视频播放倍速控制
4343
- [x] 视频画中画播放

controllers/DocumentController.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"time"
1414

1515
"github.com/TruthHun/BookStack/utils/html2md"
16+
"github.com/aliyun/aliyun-oss-go-sdk/oss"
1617

1718
"image/png"
1819

@@ -796,6 +797,12 @@ func (this *DocumentController) Upload() {
796797
if utils.StoreType == utils.StoreOss {
797798
if err := store.ModelStoreOss.MoveToOss(savePath, savePath, true, false); err != nil {
798799
beego.Error(err.Error())
800+
} else {
801+
if fileType == "video" || fileType == "audio" {
802+
if bucket, err := store.ModelStoreOss.GetBucket(); err == nil {
803+
bucket.SetObjectACL(savePath, oss.ACLPrivate)
804+
}
805+
}
799806
}
800807
}
801808

0 commit comments

Comments
 (0)