Serve downloads list

This commit is contained in:
Ben Sarmiento
2024-01-07 23:44:26 +01:00
parent 57e6b0b860
commit 62de3723c1
4 changed files with 68 additions and 2 deletions

View File

@@ -22,6 +22,22 @@ type Download struct {
Host string `json:"host"` // Host main domain
Download string `json:"download"` // Generated link
Streamable int `json:"streamable"`
Generated string `json:"-"` // jsonDate
}
func (d *Download) UnmarshalJSON(data []byte) error {
type Alias Download
aux := &struct {
Generated string `json:"generated"`
*Alias
}{
Alias: (*Alias)(d),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
d.Generated = strings.Replace(aux.Generated, "Z", "+01:00", 1)
return nil
}
type Torrent struct {