From 47fb96fddaf38c1a9b5ce6cfef7a1b8711cb771f Mon Sep 17 00:00:00 2001 From: Laptop Date: Wed, 1 Jan 2025 08:59:21 +0200 Subject: [PATCH] update dependencies --- go.mod | 17 ++++++++++---- go.sum | 41 ++++++++++++++++++++++----------- main.go | 71 +++++++++++++++++++++++++++++---------------------------- 3 files changed, 76 insertions(+), 53 deletions(-) diff --git a/go.mod b/go.mod index 4f0f9ac..7b509bd 100644 --- a/go.mod +++ b/go.mod @@ -6,25 +6,32 @@ require ( github.com/a-h/templ v0.2.793 github.com/bogem/id3v2/v2 v2.1.4 github.com/dlclark/regexp2 v1.11.5-0.20240806004527-5bbbed8ea10b - github.com/gcottom/mp4meta v0.0.4 - github.com/gcottom/oggmeta v0.0.7 + github.com/gcottom/mp4meta v0.0.5 + github.com/gcottom/oggmeta v0.0.8 github.com/goccy/go-json v0.10.4 - github.com/gofiber/fiber/v3 v3.0.0-beta.3 + github.com/gofiber/fiber/v3 v3.0.0-beta.4 github.com/valyala/fasthttp v1.58.0 ) require ( - github.com/abema/go-mp4 v1.2.0 // indirect + github.com/abema/go-mp4 v1.3.0 // indirect github.com/aler9/writerseeker v1.1.0 // indirect github.com/andybalholm/brotli v1.1.1 // indirect - github.com/gofiber/utils/v2 v2.0.0-beta.4 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/gofiber/schema v1.2.0 // indirect + github.com/gofiber/utils/v2 v2.0.0-beta.7 // indirect github.com/google/uuid v1.6.0 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect github.com/sunfish-shogi/bufseekio v0.1.0 // indirect + github.com/tinylib/msgp v1.2.5 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect + github.com/x448/float16 v0.8.4 // indirect + golang.org/x/crypto v0.31.0 // indirect + golang.org/x/net v0.33.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect ) diff --git a/go.sum b/go.sum index 589a117..fd7c595 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/a-h/templ v0.2.793 h1:Io+/ocnfGWYO4VHdR0zBbf39PQlnzVCVVD+wEEs6/qY= github.com/a-h/templ v0.2.793/go.mod h1:lq48JXoUvuQrU0VThrK31yFwdRjTCnIE5bcPCM9IP1w= -github.com/abema/go-mp4 v1.2.0 h1:gi4X8xg/m179N/J15Fn5ugywN9vtI6PLk6iLldHGLAk= -github.com/abema/go-mp4 v1.2.0/go.mod h1:vPl9t5ZK7K0x68jh12/+ECWBCXoWuIDtNgPtU2f04ws= +github.com/abema/go-mp4 v1.3.0 h1:vr0PX0jk3E4GO1c28fNRsyZdkLwz38R+XRVncIH1XDk= +github.com/abema/go-mp4 v1.3.0/go.mod h1:vPl9t5ZK7K0x68jh12/+ECWBCXoWuIDtNgPtU2f04ws= github.com/aler9/writerseeker v1.1.0 h1:t+Sm3tjp8scNlqyoa8obpeqwciMNOvdvsxjxEb3Sx3g= github.com/aler9/writerseeker v1.1.0/go.mod h1:QNCcjSKnLsYoTfMmXkEEfgbz6nNXWxKSaBY+hGJGWDA= github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= @@ -14,16 +14,20 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.11.5-0.20240806004527-5bbbed8ea10b h1:AJKOdc+1fRSJ0/75Jty1npvxUUD0y7hQDg15LMAHhyU= github.com/dlclark/regexp2 v1.11.5-0.20240806004527-5bbbed8ea10b/go.mod h1:YvCrhrh/qlds8EhFKPtJprdXn5fWBllSw1qo99dZyiQ= -github.com/gcottom/mp4meta v0.0.4 h1:oHdl5Ad0A0PQCTxthD0KFEQG7pUxG8oOLmTWmgnbncQ= -github.com/gcottom/mp4meta v0.0.4/go.mod h1:qstBsqczbFF1e90C828qv966Xjx/LFPjWQITARCpyfA= -github.com/gcottom/oggmeta v0.0.7 h1:6mKm/9xhDeKKIOrB0K+daJoXOLbyRq84e5xV3dndDt8= -github.com/gcottom/oggmeta v0.0.7/go.mod h1:ifdINhphaEW587BIgA+m5TJwCoVk88JuZMCHwXc/gpM= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/gcottom/mp4meta v0.0.5 h1:pZZAMwRMisx7RaewO7MvjuD3t+tHCYRujpJkQI2yVHU= +github.com/gcottom/mp4meta v0.0.5/go.mod h1:Dxt8rM1fJDl9sOJCfsnQuprE3gWtmE/oXTJHA/g5WHY= +github.com/gcottom/oggmeta v0.0.8 h1:cai8PX7k4/6coKaYCeBZI5GD2f+bgzrCHbcFM5l5Vms= +github.com/gcottom/oggmeta v0.0.8/go.mod h1:as5q4K3n3GHJIuWKoJPjiroxPEtqDCNB52+sYzBSaGQ= github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= -github.com/gofiber/fiber/v3 v3.0.0-beta.3 h1:7Q2I+HsIqnIEEDB+9oe7Gadpakh6ZLhXpTYz/L20vrg= -github.com/gofiber/fiber/v3 v3.0.0-beta.3/go.mod h1:kcMur0Dxqk91R7p4vxEpJfDWZ9u5IfvrtQc8Bvv/JmY= -github.com/gofiber/utils/v2 v2.0.0-beta.4 h1:1gjbVFFwVwUb9arPcqiB6iEjHBwo7cHsyS41NeIW3co= -github.com/gofiber/utils/v2 v2.0.0-beta.4/go.mod h1:sdRsPU1FXX6YiDGGxd+q2aPJRMzpsxdzCXo9dz+xtOY= +github.com/gofiber/fiber/v3 v3.0.0-beta.4 h1:KzDSavvhG7m81NIsmnu5l3ZDbVS4feCidl4xlIfu6V0= +github.com/gofiber/fiber/v3 v3.0.0-beta.4/go.mod h1:/WFUoHRkZEsGHyy2+fYcdqi109IVOFbVwxv1n1RU+kk= +github.com/gofiber/schema v1.2.0 h1:j+ZRrNnUa/0ZuWrn/6kAtAufEr4jCJ+JuTURAMxNSZg= +github.com/gofiber/schema v1.2.0/go.mod h1:YYwj01w3hVfaNjhtJzaqetymL56VW642YS3qZPhuE6c= +github.com/gofiber/utils/v2 v2.0.0-beta.7 h1:NnHFrRHvhrufPABdWajcKZejz9HnCWmT/asoxRsiEbQ= +github.com/gofiber/utils/v2 v2.0.0-beta.7/go.mod h1:J/M03s+HMdZdvhAeyh76xT72IfVqBzuz/OJkrMa7cwU= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -42,31 +46,42 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/orcaman/writerseeker v0.0.0-20200621085525-1d3f536ff85e h1:s2RNOM/IGdY0Y6qfTeUKhDawdHDpK9RGBdx80qN4Ttw= github.com/orcaman/writerseeker v0.0.0-20200621085525-1d3f536ff85e/go.mod h1:nBdnFKj15wFbf94Rwfq4m30eAcyY9V/IyKAGQFtqkW0= +github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c h1:dAMKvw0MlJT1GshSTtih8C2gDs04w8dReiOGXrGLNoY= +github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/sunfish-shogi/bufseekio v0.0.0-20210207115823-a4185644b365/go.mod h1:dEzdXgvImkQ3WLI+0KQpmEx8T/C/ma9KeS3AfmU899I= github.com/sunfish-shogi/bufseekio v0.1.0 h1:zu38kFbv0KuuiwZQeuYeS02U9AM14j0pVA9xkHOCJ2A= github.com/sunfish-shogi/bufseekio v0.1.0/go.mod h1:dEzdXgvImkQ3WLI+0KQpmEx8T/C/ma9KeS3AfmU899I= +github.com/tinylib/msgp v1.2.5 h1:WeQg1whrXRFiZusidTQqzETkRpGjFjcIhW6uqWH09po= +github.com/tinylib/msgp v1.2.5/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.58.0 h1:GGB2dWxSbEprU9j0iMJHgdKYJVDyjrOwF9RE59PbRuE= github.com/valyala/fasthttp v1.58.0/go.mod h1:SYXvHHaFp7QZHGKSHmoMipInhrI5StHrhDTYVEjK/Kw= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/main.go b/main.go index 6859b36..9baee57 100644 --- a/main.go +++ b/main.go @@ -66,15 +66,16 @@ func (staticfs) Open(name string) (fs.File, error) { // stubby implementation of static middleware // why? mainly because of the pathrewrite // i hate seeing it trying to get root directory -func ServeFromFS(r fiber.Router, path string, filesystem fs.FS, cachecontrol string, compress bool) { - l := len(path) +func ServeFromFS(r fiber.Router, filesystem fs.FS) { + const path = "/_/static" + const l = len(path) fs := fasthttp.FS{ FS: filesystem, PathRewrite: func(ctx *fasthttp.RequestCtx) []byte { return ctx.Path()[l:] }, - Compress: compress, - CompressBrotli: compress, + Compress: true, + CompressBrotli: true, CompressedFileSuffixes: map[string]string{ "gzip": ".gzip", "br": ".br", @@ -85,9 +86,9 @@ func ServeFromFS(r fiber.Router, path string, filesystem fs.FS, cachecontrol str handler := fs.NewRequestHandler() r.Use(path, func(c fiber.Ctx) error { - handler(c.Context()) - if c.Context().Response.StatusCode() == 200 { - c.Set("Cache-Control", cachecontrol) + handler(c.RequestCtx()) + if c.RequestCtx().Response.StatusCode() == 200 { + c.Set("Cache-Control", "public, max-age=28800") } return nil @@ -100,8 +101,8 @@ func main() { JSONEncoder: json.Marshal, JSONDecoder: json.Unmarshal, - EnableTrustedProxyCheck: cfg.TrustedProxyCheck, - TrustedProxies: cfg.TrustedProxies, + TrustProxy: cfg.TrustedProxyCheck, + TrustProxyConfig: fiber.TrustProxyConfig{Proxies: cfg.TrustedProxies}, }) if !cfg.Debug { // you wanna catch any possible panics as soon as possible @@ -142,7 +143,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("", templates.MainPage(prefs), templates.MainPageHead()).Render(c.Context(), c) + return templates.Base("", templates.MainPage(prefs), templates.MainPageHead()).Render(c.RequestCtx(), c) } app.Get("/", mainPageHandler) @@ -152,10 +153,10 @@ func main() { const AssetsCacheControl = "public, max-age=28800" // 8hrs if cfg.EmbedFiles { misc.Log("using embedded files") - ServeFromFS(app, "/_/static", staticfs{}, AssetsCacheControl, true) + ServeFromFS(app, staticfs{}) } else { misc.Log("loading files dynamically") - ServeFromFS(app, "/_/static", osfs{}, AssetsCacheControl, true) + ServeFromFS(app, osfs{}) } // why? because when you load a page without link rel="icon" the browser will @@ -184,7 +185,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("tracks: "+q, templates.SearchTracks(p), nil).Render(c.Context(), c) + return templates.Base("tracks: "+q, templates.SearchTracks(p), nil).Render(c.RequestCtx(), c) case "users": p, err := sc.SearchUsers("", prefs, c.Query("pagination", "?q="+url.QueryEscape(q))) @@ -194,7 +195,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("users: "+q, templates.SearchUsers(p), nil).Render(c.Context(), c) + return templates.Base("users: "+q, templates.SearchUsers(p), nil).Render(c.RequestCtx(), c) case "playlists": p, err := sc.SearchPlaylists("", prefs, c.Query("pagination", "?q="+url.QueryEscape(q))) @@ -204,7 +205,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("playlists: "+q, templates.SearchPlaylists(p), nil).Render(c.Context(), c) + return templates.Base("playlists: "+q, templates.SearchPlaylists(p), nil).Render(c.RequestCtx(), c) } return c.SendStatus(404) @@ -299,7 +300,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.TrackEmbed(prefs, track, stream, displayErr).Render(c.Context(), c) + return templates.TrackEmbed(prefs, track, stream, displayErr).Render(c.RequestCtx(), c) }) app.Get("/tags/:tag", func(c fiber.Ctx) error { @@ -321,7 +322,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("Recent tracks tagged "+tag, templates.RecentTracks(tag, p), nil).Render(c.Context(), c) + return templates.Base("Recent tracks tagged "+tag, templates.RecentTracks(tag, p), nil).Render(c.RequestCtx(), c) }) app.Get("/tags/:tag/popular-tracks", func(c fiber.Ctx) error { @@ -343,7 +344,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("Popular tracks tagged "+tag, templates.PopularTracks(tag, p), nil).Render(c.Context(), c) + return templates.Base("Popular tracks tagged "+tag, templates.PopularTracks(tag, p), nil).Render(c.RequestCtx(), c) }) app.Get("/tags/:tag/playlists", func(c fiber.Ctx) error { @@ -366,7 +367,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("Playlists tagged "+tag, templates.TaggedPlaylists(tag, p), nil).Render(c.Context(), c) + return templates.Base("Playlists tagged "+tag, templates.TaggedPlaylists(tag, p), nil).Render(c.RequestCtx(), c) }) app.Get("/_/featured", func(c fiber.Ctx) error { @@ -382,7 +383,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("Featured Tracks", templates.FeaturedTracks(tracks), nil).Render(c.Context(), c) + return templates.Base("Featured Tracks", templates.FeaturedTracks(tracks), nil).Render(c.RequestCtx(), c) }) app.Get("/discover", func(c fiber.Ctx) error { @@ -398,7 +399,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base("Discover", templates.Discover(selections), nil).Render(c.Context(), c) + return templates.Base("Discover", templates.Discover(selections), nil).Render(c.RequestCtx(), c) }) if cfg.ProxyImages { @@ -489,7 +490,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(user.Username, templates.UserPlaylists(prefs, user, pl), templates.UserHeader(user)).Render(c.Context(), c) + return templates.Base(user.Username, templates.UserPlaylists(prefs, user, pl), templates.UserHeader(user)).Render(c.RequestCtx(), c) }) app.Get("/:user/albums", func(c fiber.Ctx) error { @@ -517,7 +518,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(user.Username, templates.UserAlbums(prefs, user, pl), templates.UserHeader(user)).Render(c.Context(), c) + return templates.Base(user.Username, templates.UserAlbums(prefs, user, pl), templates.UserHeader(user)).Render(c.RequestCtx(), c) }) app.Get("/:user/reposts", func(c fiber.Ctx) error { @@ -545,7 +546,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(user.Username, templates.UserReposts(prefs, user, p), templates.UserHeader(user)).Render(c.Context(), c) + return templates.Base(user.Username, templates.UserReposts(prefs, user, p), templates.UserHeader(user)).Render(c.RequestCtx(), c) }) app.Get("/:user/likes", func(c fiber.Ctx) error { @@ -573,7 +574,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(user.Username, templates.UserLikes(prefs, user, p), templates.UserHeader(user)).Render(c.Context(), c) + return templates.Base(user.Username, templates.UserLikes(prefs, user, p), templates.UserHeader(user)).Render(c.RequestCtx(), c) }) app.Get("/:user/popular-tracks", func(c fiber.Ctx) error { @@ -601,7 +602,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(user.Username, templates.UserTopTracks(prefs, user, p), templates.UserHeader(user)).Render(c.Context(), c) + return templates.Base(user.Username, templates.UserTopTracks(prefs, user, p), templates.UserHeader(user)).Render(c.RequestCtx(), c) }) app.Get("/:user/followers", func(c fiber.Ctx) error { @@ -629,7 +630,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(user.Username, templates.UserFollowers(prefs, user, p), templates.UserHeader(user)).Render(c.Context(), c) + return templates.Base(user.Username, templates.UserFollowers(prefs, user, p), templates.UserHeader(user)).Render(c.RequestCtx(), c) }) app.Get("/:user/following", func(c fiber.Ctx) error { @@ -657,7 +658,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(user.Username, templates.UserFollowing(prefs, user, p), templates.UserHeader(user)).Render(c.Context(), c) + return templates.Base(user.Username, templates.UserFollowing(prefs, user, p), templates.UserHeader(user)).Render(c.RequestCtx(), c) }) app.Get("/:user/:track", func(c fiber.Ctx) error { @@ -751,7 +752,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(track.Title+" by "+track.Author.Username, templates.Track(prefs, track, stream, displayErr, c.Query("autoplay") == "true", playlist, nextTrack, c.Query("volume"), mode, audio), templates.TrackHeader(prefs, track, true)).Render(c.Context(), c) + return templates.Base(track.Title+" by "+track.Author.Username, templates.Track(prefs, track, stream, displayErr, c.Query("autoplay") == "true", playlist, nextTrack, c.Query("volume"), mode, audio), templates.TrackHeader(prefs, track, true)).Render(c.RequestCtx(), c) }) app.Get("/:user", func(c fiber.Ctx) error { @@ -779,7 +780,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(usr.Username, templates.User(prefs, usr, p), templates.UserHeader(usr)).Render(c.Context(), c) + return templates.Base(usr.Username, templates.User(prefs, usr, p), templates.UserHeader(usr)).Render(c.RequestCtx(), c) }) app.Get("/:user/sets/:playlist", func(c fiber.Ctx) error { @@ -819,7 +820,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(playlist.Title+" by "+playlist.Author.Username, templates.Playlist(prefs, playlist), templates.PlaylistHeader(playlist)).Render(c.Context(), c) + return templates.Base(playlist.Title+" by "+playlist.Author.Username, templates.Playlist(prefs, playlist), templates.PlaylistHeader(playlist)).Render(c.RequestCtx(), c) }) app.Get("/:user/_/related", func(c fiber.Ctx) error { @@ -847,7 +848,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(user.Username, templates.UserRelated(prefs, user, r), templates.UserHeader(user)).Render(c.Context(), c) + return templates.Base(user.Username, templates.UserRelated(prefs, user, r), templates.UserHeader(user)).Render(c.RequestCtx(), c) }) // I'd like to make this "related" but keeping it "recommended" to have the same url as soundcloud @@ -876,7 +877,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(track.Title+" by "+track.Author.Username, templates.RelatedTracks(track, r), templates.TrackHeader(prefs, track, false)).Render(c.Context(), c) + return templates.Base(track.Title+" by "+track.Author.Username, templates.RelatedTracks(track, r), templates.TrackHeader(prefs, track, false)).Render(c.RequestCtx(), c) }) app.Get("/:user/:track/sets", func(c fiber.Ctx) error { @@ -904,7 +905,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(track.Title+" by "+track.Author.Username, templates.TrackInPlaylists(track, p), templates.TrackHeader(prefs, track, false)).Render(c.Context(), c) + return templates.Base(track.Title+" by "+track.Author.Username, templates.TrackInPlaylists(track, p), templates.TrackHeader(prefs, track, false)).Render(c.RequestCtx(), c) }) app.Get("/:user/:track/albums", func(c fiber.Ctx) error { @@ -932,7 +933,7 @@ func main() { } c.Set("Content-Type", "text/html") - return templates.Base(track.Title+" by "+track.Author.Username, templates.TrackInAlbums(track, p), templates.TrackHeader(prefs, track, false)).Render(c.Context(), c) + return templates.Base(track.Title+" by "+track.Author.Username, templates.TrackInAlbums(track, p), templates.TrackHeader(prefs, track, false)).Render(c.RequestCtx(), c) }) if cfg.CodegenConfig {