also retry requests if connection closed; add /_/info endpoint

This commit is contained in:
Laptop
2024-10-26 21:34:59 +03:00
parent 796b47b9be
commit 2e1dabdc13
3 changed files with 26 additions and 1 deletions

22
main.go
View File

@@ -142,6 +142,28 @@ func main() {
proxystreams.Load(app)
}
if cfg.InstanceInfo {
type info struct {
ProxyImages bool
ProxyStreams bool
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)
})
}
app.Get("/:user/sets", func(c *fiber.Ctx) error {
user, err := sc.GetUser(c.Params("user"))
if err != nil {