diff --git a/cli/go.mod b/cli/go.mod index 8b338d5..a277585 100644 --- a/cli/go.mod +++ b/cli/go.mod @@ -9,7 +9,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/urfave/cli/v2 v2.27.5 github.com/vegidio/shared v0.0.0-00010101000000-000000000000 - github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424 + github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f ) require ( diff --git a/cli/go.sum b/cli/go.sum index 8a4d31f..0504ed6 100644 --- a/cli/go.sum +++ b/cli/go.sum @@ -91,8 +91,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= -github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424 h1:bzJUUbK8mk3gURXBeOpyx57+t/nfCiV2YJCneIbh3uQ= -github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424/go.mod h1:FL/zCnREdxKrt+4GUmFFJ6pgjthtjXODWG6lEu7HnJI= +github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f h1:8FocIek3sgD6sq36NfwziVSGngqLrvmk/qjTKlQQQkU= +github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f/go.mod h1:FL/zCnREdxKrt+4GUmFFJ6pgjthtjXODWG6lEu7HnJI= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= diff --git a/gui/go.mod b/gui/go.mod index 46b0d97..4baac5e 100644 --- a/gui/go.mod +++ b/gui/go.mod @@ -8,7 +8,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/spf13/afero v1.11.0 github.com/vegidio/shared v0.0.0-00010101000000-000000000000 - github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424 + github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f github.com/wailsapp/wails/v2 v2.9.2 ) diff --git a/gui/go.sum b/gui/go.sum index 21825d3..8e8358d 100644 --- a/gui/go.sum +++ b/gui/go.sum @@ -78,8 +78,8 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424 h1:bzJUUbK8mk3gURXBeOpyx57+t/nfCiV2YJCneIbh3uQ= -github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424/go.mod h1:FL/zCnREdxKrt+4GUmFFJ6pgjthtjXODWG6lEu7HnJI= +github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f h1:8FocIek3sgD6sq36NfwziVSGngqLrvmk/qjTKlQQQkU= +github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f/go.mod h1:FL/zCnREdxKrt+4GUmFFJ6pgjthtjXODWG6lEu7HnJI= github.com/wailsapp/go-webview2 v1.0.16 h1:wffnvnkkLvhRex/aOrA3R7FP7rkvOqL/bir1br7BekU= github.com/wailsapp/go-webview2 v1.0.16/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo= github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= diff --git a/shared/go.mod b/shared/go.mod index 31549f5..7b0244b 100644 --- a/shared/go.mod +++ b/shared/go.mod @@ -9,7 +9,7 @@ require ( github.com/go-resty/resty/v2 v2.16.2 github.com/samber/lo v1.47.0 github.com/spf13/afero v1.11.0 - github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424 + github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f ) require ( diff --git a/shared/go.sum b/shared/go.sum index 3400987..ed14151 100644 --- a/shared/go.sum +++ b/shared/go.sum @@ -38,6 +38,8 @@ github.com/vegidio/umd-lib v0.0.0-20241219154936-e165552cc079 h1:w4El80VkKRZu9yd github.com/vegidio/umd-lib v0.0.0-20241219154936-e165552cc079/go.mod h1:FL/zCnREdxKrt+4GUmFFJ6pgjthtjXODWG6lEu7HnJI= github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424 h1:bzJUUbK8mk3gURXBeOpyx57+t/nfCiV2YJCneIbh3uQ= github.com/vegidio/umd-lib v0.0.0-20241220121920-52096f944424/go.mod h1:FL/zCnREdxKrt+4GUmFFJ6pgjthtjXODWG6lEu7HnJI= +github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f h1:8FocIek3sgD6sq36NfwziVSGngqLrvmk/qjTKlQQQkU= +github.com/vegidio/umd-lib v0.0.0-20241224003918-03009332159f/go.mod h1:FL/zCnREdxKrt+4GUmFFJ6pgjthtjXODWG6lEu7HnJI= github.com/ysmood/fetchup v0.2.4 h1:2kfWr/UrdiHg4KYRrxL2Jcrqx4DZYD+OtWu7WPBZl5o= github.com/ysmood/fetchup v0.2.4/go.mod h1:hbysoq65PXL0NQeNzUczNYIKpwpkwFL4LXMDEvIQq9A= github.com/ysmood/goob v0.4.0 h1:HsxXhyLBeGzWXnqVKtmT9qM7EuVs/XOgkX7T6r1o1AQ= diff --git a/shared/telemetry.go b/shared/telemetry.go index a4313d2..991ba49 100644 --- a/shared/telemetry.go +++ b/shared/telemetry.go @@ -5,6 +5,7 @@ import ( "github.com/denisbrodbeck/machineid" "github.com/mixpanel/mixpanel-go" "runtime" + "strings" ) type MixPanel struct { @@ -22,7 +23,7 @@ func NewMixPanel(distinctId string) *MixPanel { func (m *MixPanel) Track(event string, fields map[string]any) { // Set the computer information id, _ := machineid.ID() - fields["machineId"] = id + fields["machineId"] = strings.ToLower(id) fields["os"] = runtime.GOOS fields["arch"] = runtime.GOARCH diff --git a/shared/utils.go b/shared/utils.go index 6f63fb4..7c3c419 100644 --- a/shared/utils.go +++ b/shared/utils.go @@ -8,6 +8,7 @@ import ( "github.com/spf13/afero" "path/filepath" "strconv" + "strings" ) var fs = afero.NewOsFs() @@ -56,9 +57,39 @@ func CreateReport(directory string, downloads []Download) { fileContent += "---\n" } + if len(failedDownloads) > 0 { + fileContent += createManualDownloadCommand(failedDownloads) + } + _, _ = file.WriteString(fileContent) } +func createManualDownloadCommand(downloads []Download) string { + fileContent := "\n## Retry Failed Downloads\n\n" + fileContent += "You can retry the failed downloads by using either [aria2](https://aria2.github.io) (recommended) or [wget](https://www.gnu.org/software/wget):\n\n" + fileContent += "### Aria2\n\n" + fileContent += "```bash\n" + + downloadList := lo.Reduce(downloads, func(acc string, d Download, _ int) string { + return acc + fmt.Sprintf(" %s", d.Url) + }, "$ aria2c --file-allocation=none --auto-file-renaming=false --always-resume=true --conditional-get=true -c -s 1 -x 5 -j 5 -m 10 -Z") + + line := "" + for _, part := range strings.Split(downloadList, " ") { + if (len(line) + len(part)) >= 118 { + fileContent += line + " \\\n" + line = " " + } + + line += " " + part + } + + fileContent += line + "\n" + fileContent += "```\n" + + return fileContent +} + func RemoveDuplicates(downloads []Download, onDuplicateDeleted func(download Download)) (int, []Download) { numDeleted := 0 remaining := make([]Download, 0)