diff --git a/backend/app/api/main.go b/backend/app/api/main.go index 0c940812..4dfd04dc 100644 --- a/backend/app/api/main.go +++ b/backend/app/api/main.go @@ -21,7 +21,6 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/rs/zerolog/pkgerrors" - _ "github.com/shirou/gopsutil/v4/host" "github.com/sysadminsmedia/homebox/backend/internal/core/currencies" "github.com/sysadminsmedia/homebox/backend/internal/core/services" "github.com/sysadminsmedia/homebox/backend/internal/core/services/reporting/eventbus" @@ -101,17 +100,18 @@ func run(cfg *config.Config) error { } bodyReader := bytes.NewReader(jsonBody) req, err := http.NewRequest("POST", "https://a.sysadmins.zone/api/event", bodyReader) + if err != nil { + log.Error().Err(err).Msg("failed to create analytics request") + } req.Header.Set("Content-Type", "application/json") - req.Header.Set("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 OPR/71.0.3770.284") + req.Header.Set("User-Agent", "Homebox/"+version+"/"+build()+" (https://homebox.software)") client := &http.Client{ Timeout: 10 * time.Second, } - res, err := client.Do(req) + _, err = client.Do(req) if err != nil { - return err + log.Error().Err(err).Msg("failed to send analytics request") } - log.Info().Msgf("Analytics Response: %v", res) - log.Info().Msgf("Analytics Response: %v", json.NewEncoder(os.Stdout).Encode(analytics)) } // ========================================================================= diff --git a/backend/internal/sys/config/conf.go b/backend/internal/sys/config/conf.go index e3c4b830..85d0ea3e 100644 --- a/backend/internal/sys/config/conf.go +++ b/backend/internal/sys/config/conf.go @@ -32,7 +32,7 @@ type Options struct { AllowRegistration bool `yaml:"disable_registration" conf:"default:true"` AutoIncrementAssetID bool `yaml:"auto_increment_asset_id" conf:"default:true"` CurrencyConfig string `yaml:"currencies"` - AllowAnalytics bool `yaml:"allow_analytics" conf:"default:true"` + AllowAnalytics bool `yaml:"allow_analytics" conf:"default:false"` } type DebugConf struct {