Skip to content

Commit

Permalink
fetch: dont use API tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
hayzamjs committed Mar 19, 2024
1 parent 851e885 commit d569293
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ build-linux-x86_64:
all: clean build-linux-aarch64 build-linux-x86_64

clean:
rm -rf bin/
rm -rf bin/*
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func main() {
utils.InstallService()
}()

updateTicker := time.NewTicker(10 * time.Minute)
updateTicker := time.NewTicker(10 * time.Second)

go func() {
for {
Expand Down
5 changes: 2 additions & 3 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func SelfUpdate(version string) {
return
}

url := FetchLatestReleaseDownloadURL("NodeBoxHQ", "nodebox-dashboard", "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", versionInt)
url := FetchLatestReleaseDownloadURL("NodeBoxHQ", "nodebox-dashboard", versionInt)

if url == "" {
return
Expand Down Expand Up @@ -215,14 +215,13 @@ type Release struct {
} `json:"assets"`
}

func FetchLatestReleaseDownloadURL(owner, repo, token string, version int) string {
func FetchLatestReleaseDownloadURL(owner, repo string, version int) string {
url := fmt.Sprintf("https://api.github.com/repos/%s/%s/releases", owner, repo)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return ""
}

req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Accept", "application/vnd.github+json")

client := &http.Client{}
Expand Down

0 comments on commit d569293

Please sign in to comment.