mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2026-03-22 00:28:12 +05:00
fix memory skill issue downloading m4a/aac
This commit is contained in:
@@ -48,6 +48,7 @@ func Log(what ...any) {
|
||||
var HlsClient *fasthttp.HostClient
|
||||
var HlsStreamingOnlyClient *fasthttp.HostClient
|
||||
var HlsAacClient *fasthttp.HostClient
|
||||
var ImageStreamingOnlyClient *fasthttp.HostClient
|
||||
|
||||
func init() {
|
||||
if cfg.Restream || cfg.ProxyStreams {
|
||||
@@ -74,4 +75,15 @@ func init() {
|
||||
DialDualStack: cfg.DialDualStack,
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.Restream || cfg.ProxyImages {
|
||||
ImageStreamingOnlyClient = &fasthttp.HostClient{
|
||||
Addr: cfg.ImageCDN + ":443",
|
||||
IsTLS: true,
|
||||
MaxIdleConnDuration: cfg.MaxIdleConnDuration,
|
||||
StreamResponseBody: true,
|
||||
MaxResponseBodySize: 1,
|
||||
DialDualStack: cfg.DialDualStack,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
)
|
||||
|
||||
var al_httpc *fasthttp.HostClient
|
||||
var streaming_httpc *fasthttp.HostClient
|
||||
|
||||
func Load(r *fiber.App) {
|
||||
|
||||
@@ -21,15 +20,6 @@ func Load(r *fiber.App) {
|
||||
MaxResponseBodySize: 1,
|
||||
}
|
||||
|
||||
streaming_httpc = &fasthttp.HostClient{
|
||||
Addr: cfg.ImageCDN + ":443",
|
||||
IsTLS: true,
|
||||
MaxIdleConnDuration: cfg.MaxIdleConnDuration,
|
||||
StreamResponseBody: true,
|
||||
MaxResponseBodySize: 1,
|
||||
DialDualStack: cfg.DialDualStack,
|
||||
}
|
||||
|
||||
r.Get("/_/proxy/images", func(c fiber.Ctx) error {
|
||||
url := c.RequestCtx().QueryArgs().Peek("url")
|
||||
if len(url) == 0 {
|
||||
@@ -52,7 +42,7 @@ func Load(r *fiber.App) {
|
||||
var cl *fasthttp.HostClient
|
||||
if parsed.Host()[0] == 'i' {
|
||||
parsed.SetHost(cfg.ImageCDN)
|
||||
cl = streaming_httpc
|
||||
cl = misc.ImageStreamingOnlyClient
|
||||
} else if string(parsed.Host()[:2]) == "al" {
|
||||
cl = al_httpc
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ func Load(r *fiber.App) {
|
||||
if t.Artwork != "" {
|
||||
r.req.SetRequestURI(t.Artwork)
|
||||
|
||||
err := sc.DoWithRetry(image_httpc, r.req, r.resp)
|
||||
err := sc.DoWithRetry(misc.ImageStreamingOnlyClient, r.req, r.resp)
|
||||
if err == nil && r.resp.StatusCode() == 200 {
|
||||
parsed, _, err := image.Decode(r.resp.BodyStream())
|
||||
r.resp.CloseBodyStream()
|
||||
|
||||
Reference in New Issue
Block a user