Files
epochcli/manifest.go
Evan Burkey d0f7fdc76e
Some checks failed
Build Epoch Launcher / build (push) Failing after 42s
init
2025-06-02 12:43:33 -07:00

43 lines
691 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"`
URL string `json:"URL"`
Origin string `json:"Origin"`
}
type Manifest struct {
Version string `json:"Version"`
Files []File `json:"Files"`
}
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
}