Prevent processing of already expired videoplayback links
All checks were successful
CI / build (push) Successful in 5m4s

This commit is contained in:
Fijxu 2024-11-05 13:50:53 -03:00
parent 3b89ea41e7
commit 56345e5bae
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -6,12 +6,26 @@ import (
"log"
"net/http"
"net/url"
"strconv"
"strings"
"sync/atomic"
"time"
)
func videoplayback(w http.ResponseWriter, req *http.Request) {
q := req.URL.Query()
expire, err := strconv.ParseInt(q.Get("expire"), 10, 64)
if err != nil {
w.WriteHeader(500)
}
// Prevent the process of already expired playbacks
// since they will return 403 from googlevideo servers.
if (expire - time.Now().Unix()) <= 0 {
w.WriteHeader(403)
return
}
host := q.Get("host")
q.Del("host")