Skip to content

Commit 24f284e

Browse files
committed
网页端视频链接加密
1 parent 70b0193 commit 24f284e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

controllers/DocumentController.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,10 @@ func (this *DocumentController) Read() {
299299
title := strings.TrimSpace(sel.Text())
300300
poster, _ := sel.Attr("poster")
301301
src, _ := sel.Attr("src")
302-
sign, _ := utils.GenerateSign(src, time.Duration(utils.MediaDuration)*time.Second)
303-
src = src + "?sign=" + sign
302+
if !(strings.HasPrefix(src, "https://") || strings.HasPrefix(src, "http://")) {
303+
sign, _ := utils.GenerateSign(src, time.Duration(utils.MediaDuration)*time.Second)
304+
src = src + "?sign=" + sign
305+
}
304306
if item == "video" {
305307
sel.BeforeHtml(fmt.Sprintf(videoBoxFmt, title, poster, src, title))
306308
sel.Remove()

0 commit comments

Comments
 (0)