diff --git a/Makefile b/Makefile index aaa36f7..3017c64 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +GOCMD=go +GOFLAGS=-o trace -gcflags "all=-trimpath=$GOPATH" + all: clean darwin linux-386 linux-amd64 windows clean: @@ -7,19 +10,19 @@ clean: darwin: mkdir -p output - GOOS=darwin GOARCH=amd64 go build -o ./build/darwin/MultiMC-Curseforge.app/Contents/MacOS/MultiMC-Curseforge + GOOS=darwin GOARCH=amd64 $(GOCMD) build $(GOFLAGS) -o ./build/darwin/MultiMC-Curseforge.app/Contents/MacOS/MultiMC-Curseforge tar -czvf ./output/darwin.tar.gz --exclude .gitkeep -C ./build/darwin . linux-386: mkdir -p output - GOOS=linux GOARCH=386 go build -o ./build/linux/usr/bin/multimc-curseforge + GOOS=linux GOARCH=386 $(GOCMD) build $(GOFLAGS) -o ./build/linux/usr/bin/multimc-curseforge tar -czvf ./output/linux-386.tar.gz --exclude .gitkeep -C ./build/linux . linux-amd64: mkdir -p output - GOOS=linux GOARCH=amd64 go build -o ./build/linux/usr/bin/multimc-curseforge + GOOS=linux GOARCH=amd64 $(GOCMD) build $(GOFLAGS) -o ./build/linux/usr/bin/multimc-curseforge tar -czvf ./output/linux-amd64.tar.gz --exclude .gitkeep -C ./build/linux . windows: mkdir -p output - GOOS=windows GOARCH=386 go build -o ./output/MultiMC-Curseforge.exe \ No newline at end of file + GOOS=windows GOARCH=386 $(GOCMD) build $(GOFLAGS) -o ./output/MultiMC-Curseforge.exe \ No newline at end of file diff --git a/build/darwin/MultiMC-Curseforge.app/Contents/MacOS/MultiMC-Curseforge b/build/darwin/MultiMC-Curseforge.app/Contents/MacOS/MultiMC-Curseforge index 807a5bc..cfc11fb 100755 Binary files a/build/darwin/MultiMC-Curseforge.app/Contents/MacOS/MultiMC-Curseforge and b/build/darwin/MultiMC-Curseforge.app/Contents/MacOS/MultiMC-Curseforge differ diff --git a/build/linux/usr/bin/multimc-curseforge b/build/linux/usr/bin/multimc-curseforge index 1e80416..7cbbf95 100755 Binary files a/build/linux/usr/bin/multimc-curseforge and b/build/linux/usr/bin/multimc-curseforge differ diff --git a/main.go b/main.go index 9a81178..7dee2f1 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,6 @@ import ( "os" "os/exec" "runtime" - "strings" ) // Package - CCIP file structure @@ -31,8 +30,7 @@ func main() { url, err := url.ParseRequestURI(os.Args[1]) if err == nil && url.Scheme == "curseforge" { - paths := strings.Split(url.Path, "/") - pack = GetPackURL(paths[3], paths[5]) + pack = GetPackURL(url.Query().Get("addonId"), url.Query().Get("fileId")) } else { pkg := LoadXML(os.Args[1]) pack = GetPackURL(pkg.Project.ID, pkg.Project.File) @@ -70,8 +68,8 @@ func LoadXML(fileName string) Package { } // GetPackURL - Request the download url from Curseforge's API -func GetPackURL(id string, file string) string { - resp, err := http.Get("https://addons-ecs.forgesvc.net/api/v2/addon/" + id + "/file/" + file + "/download-url") +func GetPackURL(addon string, file string) string { + resp, err := http.Get("https://addons-ecs.forgesvc.net/api/v2/addon/" + addon + "/file/" + file + "/download-url") if err != nil { fmt.Println(err) os.Exit(1)