Files
epochcli/manifest.go
2025-07-07 10:01:38 -07:00

48 lines
861 B
Go

package main
import (
"encoding/json"
"io"
"net/http"
)
type File struct {
Path string `json:"Path"`
Hash string `json:"Hash"`
Size int `json:"Size"`
Custom bool `json:"Custom"`
Urls struct {
Digitalocean string `json:"digitalocean"`
Cloudflare string `json:"cloudflare"`
None string `json:"none"`
} `json:"Urls"`
}
type Manifest struct {
Version string `json:"Version"`
UID string `json:"Uid"`
Files []File `json:"Files"`
CheckedAt string `json:"checked_at"`
}
func getManifest() (*Manifest, error) {
resp, err := http.Get(manifestUrl)
if err != nil {
return nil, err
}
defer resp.Body.Close()
data, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
var manifest Manifest
err = json.Unmarshal(data, &manifest)
if err != nil {
return nil, err
}
return &manifest, nil
}