fixed github api limit

This commit is contained in:
2024-05-21 17:05:43 +02:00
parent 064f30fc39
commit 57dfe8a6af
4 changed files with 12 additions and 25 deletions
-12
View File
@@ -2,7 +2,6 @@ package main
import (
"archive/zip"
"encoding/json"
"fmt"
"io"
"io/ioutil"
@@ -119,17 +118,6 @@ func Unzip(src, dest string) error {
return nil
}
func getLatestVersion(repoU string) (string, error) {
jsonBody := []byte("")
res := sendRequest(http.MethodGet, fmt.Sprintf("https://api.github.com/repos%s/releases/latest", repoU), jsonBody)
var release Release
err := json.Unmarshal([]byte(string(res.Body)), &release)
if err != nil || res.StatusCode != 200 {
return "", err
}
return release.TagName, nil
}
func downloadPackage(repoU, tag string) error {
resp, err := http.Get(fmt.Sprintf("https://github.com/%s/archive/refs/tags/%s.zip", strings.Trim(repoU, "/"), tag))
if err != nil {