mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
use sha1 instead of sha256
This commit is contained in:
parent
5c07741447
commit
faec4f4738
@ -93,7 +93,12 @@ func fetchMod(slug string) (Mod, error) {
|
|||||||
|
|
||||||
repoResp, err := http.Get(githubApiUrl + "repos/" + slug)
|
repoResp, err := http.Get(githubApiUrl + "repos/" + slug)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return mod, err
|
||||||
|
}
|
||||||
|
|
||||||
defer repoResp.Body.Close()
|
defer repoResp.Body.Close()
|
||||||
|
|
||||||
repoBody, err := ioutil.ReadAll(repoResp.Body)
|
repoBody, err := ioutil.ReadAll(repoResp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return mod, err
|
return mod, err
|
||||||
@ -209,7 +214,7 @@ func installVersion(mod Mod, version ModReleases, pack core.Pack) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
hash, error := file.getSha256()
|
hash, error := file.getSha1()
|
||||||
if error != nil || hash == "" {
|
if error != nil || hash == "" {
|
||||||
return errors.New("file doesn't have a hash")
|
return errors.New("file doesn't have a hash")
|
||||||
}
|
}
|
||||||
@ -220,7 +225,7 @@ func installVersion(mod Mod, version ModReleases, pack core.Pack) error {
|
|||||||
Side: "unknown",
|
Side: "unknown",
|
||||||
Download: core.ModDownload{
|
Download: core.ModDownload{
|
||||||
URL: file.BrowserDownloadURL,
|
URL: file.BrowserDownloadURL,
|
||||||
HashFormat: "sha256",
|
HashFormat: "sha1",
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
},
|
},
|
||||||
Update: updateMap,
|
Update: updateMap,
|
||||||
@ -336,9 +341,9 @@ type Asset struct {
|
|||||||
BrowserDownloadURL string `json:"browser_download_url"`
|
BrowserDownloadURL string `json:"browser_download_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u Asset) getSha256() (string, error) {
|
func (u Asset) getSha1() (string, error) {
|
||||||
// TODO potentionally cache downloads to speed things up and avoid getting ratelimited by github!
|
// TODO potentionally cache downloads to speed things up and avoid getting ratelimited by github!
|
||||||
mainHasher, err := core.GetHashImpl("sha256")
|
mainHasher, err := core.GetHashImpl("sha1")
|
||||||
resp, err := http.Get(u.BrowserDownloadURL)
|
resp, err := http.Get(u.BrowserDownloadURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -80,7 +80,7 @@ func (u ghUpdater) DoUpdate(mods []*core.Mod, cachedState []interface{}) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hash, error := file.getSha256()
|
hash, error := file.getSha1()
|
||||||
if error != nil || hash == "" {
|
if error != nil || hash == "" {
|
||||||
return errors.New("file doesn't have a hash")
|
return errors.New("file doesn't have a hash")
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ func (u ghUpdater) DoUpdate(mods []*core.Mod, cachedState []interface{}) error {
|
|||||||
mod.FileName = file.Name
|
mod.FileName = file.Name
|
||||||
mod.Download = core.ModDownload{
|
mod.Download = core.ModDownload{
|
||||||
URL: file.BrowserDownloadURL,
|
URL: file.BrowserDownloadURL,
|
||||||
HashFormat: "sha256",
|
HashFormat: "sha1",
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
}
|
}
|
||||||
mod.Update["github"]["version"] = version.ID
|
mod.Update["github"]["version"] = version.ID
|
||||||
|
Loading…
x
Reference in New Issue
Block a user