mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2025-12-23 20:29:37 +05:00
fix default avatar not proxying; simplify /_/info endpoint code and make it dynamic incase you somehow change the settings at runtime
This commit is contained in:
@@ -158,6 +158,11 @@ func (u *User) Fix(large bool) {
|
||||
u.Avatar = strings.Replace(u.Avatar, "-large.", "-t200x200.", 1)
|
||||
}
|
||||
|
||||
// maybe hardcoding it isn't the best decision, but it should be ok
|
||||
if u.Avatar == "https://a1.sndcdn.com/images/default_avatar_large.png" {
|
||||
u.Avatar = ""
|
||||
}
|
||||
|
||||
if cfg.ProxyImages && u.Avatar != "" {
|
||||
u.Avatar = "/_/proxy/images?url=" + url.QueryEscape(u.Avatar)
|
||||
}
|
||||
|
||||
16
main.go
16
main.go
@@ -149,18 +149,12 @@ func main() {
|
||||
FullyPreloadTrack bool
|
||||
}
|
||||
|
||||
data, err := cfg.JSON.Marshal(info{
|
||||
ProxyImages: cfg.ProxyImages,
|
||||
ProxyStreams: cfg.ProxyStreams,
|
||||
FullyPreloadTrack: cfg.FullyPreloadTrack,
|
||||
})
|
||||
if err != nil {
|
||||
log.Println("Failed to marshal instance info:", err)
|
||||
}
|
||||
|
||||
app.Get("/_/info", func(c *fiber.Ctx) error {
|
||||
c.Set("Content-Type", "application/json")
|
||||
return c.Send(data)
|
||||
return c.JSON(info{
|
||||
ProxyImages: cfg.ProxyImages,
|
||||
ProxyStreams: cfg.ProxyStreams,
|
||||
FullyPreloadTrack: cfg.FullyPreloadTrack,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user