From: qydysky Date: Sun, 21 Jul 2024 12:44:37 +0000 (+0800) Subject: Improve 优化回放缓存 X-Git-Tag: v0.14.11~1 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=e227fec4b47f052b443bd3c5301524676d7cd9ca;p=bili_danmu%2F.git Improve 优化回放缓存 --- diff --git a/Reply/F.go b/Reply/F.go index ac7ac2d..73a13e4 100644 --- a/Reply/F.go +++ b/Reply/F.go @@ -1214,20 +1214,17 @@ func init() { w.Header().Set("content-type", "text/html") } - //cache - if bp, ok := cache.IsCache("html/streamList/" + p); ok { - w.Header().Set("Cache-Control", "max-age=60") - _, _ = w.Write(*bp) - return - } - w = cache.Cache("html/streamList/"+p, time.Minute, w) - f := file.New("html/streamList/"+p, 0, true) if !f.IsExist() || f.IsDir() { w.WriteHeader(http.StatusNotFound) return } + // mod + if info, e := f.Stat(); e == nil && pweb.NotModified(r, w, info.ModTime()) { + return + } + b, _ := f.ReadAll(humanize.KByte, humanize.MByte) _, _ = w.Write(b) }) @@ -1322,6 +1319,11 @@ func init() { return } + // mod + if info, e := f.Stat(); e == nil && pweb.NotModified(r, w, info.ModTime()) { + return + } + b, _ := f.ReadAll(humanize.KByte, humanize.MByte) _, _ = w.Write(b) }) @@ -1358,6 +1360,11 @@ func init() { return } + // mod + if info, e := f.Stat(); e == nil && pweb.NotModified(r, w, info.ModTime()) { + return + } + b, _ := f.ReadAll(humanize.KByte, humanize.MByte) _, _ = w.Write(b) }) diff --git a/demo/html/artPlayer/index.html b/demo/html/artPlayer/index.html index fc303de..ca37351 100644 --- a/demo/html/artPlayer/index.html +++ b/demo/html/artPlayer/index.html @@ -26,22 +26,6 @@
- + \ No newline at end of file diff --git a/go.mod b/go.mod index 931fdeb..f8de8d7 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.2 require ( github.com/gotk3/gotk3 v0.6.4 github.com/mdp/qrterminal/v3 v3.2.0 - github.com/qydysky/part v0.28.20240721025108 + github.com/qydysky/part v0.28.20240721124143 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 golang.org/x/text v0.16.0 diff --git a/go.sum b/go.sum index 2bfa75c..6b258fd 100644 --- a/go.sum +++ b/go.sum @@ -46,8 +46,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/qydysky/biliApi v0.0.0-20240707084224-dd146610f462 h1:SblV/m+0mx6QgH2YYvdjE5QxhyfE/EOQglJ1PGd3x3E= github.com/qydysky/biliApi v0.0.0-20240707084224-dd146610f462/go.mod h1:om024vfxALQ5vxsbaGoMm8IS0esLYBnEOpJI8FsGoDg= -github.com/qydysky/part v0.28.20240721025108 h1:3E8dRdVYfYDMNgMG1mIVigrj0i3fi4LsriKTHpo+EXc= -github.com/qydysky/part v0.28.20240721025108/go.mod h1:dgagZnPYRFZDbt7XJf7nADOJLoYwlebD9B8Z8g5aHhI= +github.com/qydysky/part v0.28.20240721124143 h1:PX5BIhrrrnKN/VJFJSeg+qzdAPKb+N199vDtPjyNK5g= +github.com/qydysky/part v0.28.20240721124143/go.mod h1:dgagZnPYRFZDbt7XJf7nADOJLoYwlebD9B8Z8g5aHhI= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=