clean up
Anirudh Oppiliappan x@icyphox.sh
Tue, 08 Nov 2022 16:08:49 +0530
1 files changed,
9 insertions(+),
0 deletions(-)
jump to
M
web.go
→
web.go
@@ -2128,12 +2128,19 @@ j, err := GetJunkFast(uinfo.UserID, n)
if err != nil { dlog.Println("avatating: getting junk:", err) a = avatateautogen(r) + goto nope } pfpurl, _ := j.GetString("icon", "url") res, err := http.Get(pfpurl) + if res.StatusCode != 200 { + dlog.Printf("avatating: %n: not ok: %s", n, res.StatusCode) + a = avatateautogen(r) + goto nope + } if err != nil { dlog.Println("avatating: getting pfp url:", err) a = avatateautogen(r) + goto nope } defer res.Body.Close()@@ -2141,12 +2148,14 @@ pfpbytes, err := io.ReadAll(res.Body)
if err != nil { dlog.Println("avatating: bruh shits clapped:", err) a = avatateautogen(r) + goto nope } a = pfpbytes } else { a = avatateautogen(r) } +nope: if !develMode { w.Header().Set("Cache-Control", "max-age="+somedays()) }