From c220869abfcf6f90f1d307564f5723b4fd7f1337 Mon Sep 17 00:00:00 2001 From: eccentric Date: Thu, 7 Dec 2023 19:29:47 +0000 Subject: [PATCH] Add Crash Logs --- fortnite/interact.go | 9 +-------- go.mod | 21 ++++++++++++--------- main.go | 12 ++++++++++-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/fortnite/interact.go b/fortnite/interact.go index 7e595ac..f8ca586 100644 --- a/fortnite/interact.go +++ b/fortnite/interact.go @@ -248,10 +248,6 @@ func PreloadCosmetics(max int) error { } } - aid.Print("Preloaded", len(Cosmetics.Items), "cosmetics") - aid.Print("Preloaded", len(Cosmetics.Sets), "sets") - aid.Print("Preloaded", len(battlePassSkins), "battle pass skins") - found := make([]string, 0) characters := make([]string, 0) for id, item := range Cosmetics.Items { @@ -288,7 +284,6 @@ func PreloadCosmetics(max int) error { found = append(found, id) } - // print the perecentage of backpacks that have a character aid.Print("Preloaded", len(found), "backpacks with characters", "(", float64(len(found))/float64(len(characters))*100, "% )") DAv2 := *storage.Asset("assets.json") @@ -303,8 +298,6 @@ func PreloadCosmetics(max int) error { } KnownDisplayAssets = DAv2Data - - aid.Print("Preloaded", len(KnownDisplayAssets), "display assets") - + return nil } \ No newline at end of file diff --git a/go.mod b/go.mod index fb13d60..625c6b7 100644 --- a/go.mod +++ b/go.mod @@ -2,13 +2,21 @@ module github.com/ectrc/snow go 1.21.3 +require ( + github.com/goccy/go-json v0.10.2 + github.com/gofiber/fiber/v2 v2.50.0 + github.com/golang-jwt/jwt/v5 v5.0.0 + github.com/google/uuid v1.4.0 + github.com/lib/pq v1.10.9 + github.com/r3labs/diff/v3 v3.0.1 + gopkg.in/ini.v1 v1.67.0 + gorm.io/driver/postgres v1.5.3 + gorm.io/gorm v1.25.5 +) + require ( github.com/andybalholm/brotli v1.0.6 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/goccy/go-json v0.10.2 // indirect - github.com/gofiber/fiber/v2 v2.50.0 // indirect - github.com/golang-jwt/jwt/v5 v5.0.0 // indirect - github.com/google/uuid v1.4.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect @@ -16,7 +24,6 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/klauspost/compress v1.17.2 // indirect - github.com/lib/pq v1.10.9 // indirect github.com/lukechampine/randmap v0.0.0-20161125183226-9e3c222d0413 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -26,7 +33,6 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/philhofer/fwd v1.1.2 // indirect - github.com/r3labs/diff/v3 v3.0.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rs/zerolog v1.26.0 // indirect github.com/sagikazarmark/locafero v0.3.0 // indirect @@ -52,8 +58,5 @@ require ( golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gorm.io/driver/postgres v1.5.3 // indirect - gorm.io/gorm v1.25.5 // indirect ) diff --git a/main.go b/main.go index b3e91cd..99efe33 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "github.com/ectrc/snow/aid" "github.com/ectrc/snow/fortnite" "github.com/ectrc/snow/handlers" @@ -22,6 +24,8 @@ func init() { } postgresStorage.MigrateAll() device = postgresStorage + default: + panic("Invalid database type: " + aid.Config.Database.Type) } storage.Repo = storage.NewStorage(device) @@ -107,7 +111,11 @@ func main() { aid.Print("Listening on " + ld.Host + ":" + ld.Port) return nil }) - + r.All("*", func(c *fiber.Ctx) error { return c.Status(fiber.StatusNotFound).JSON(aid.ErrorNotFound) }) - r.Listen(aid.Config.API.Host + aid.Config.API.Port) + + err := r.Listen(aid.Config.API.Host + aid.Config.API.Port) + if err != nil { + panic(fmt.Sprintf("Failed to listen: %v", err)) + } } \ No newline at end of file