Add Crash Logs

This commit is contained in:
eccentric 2023-12-07 19:29:47 +00:00
parent 045ac4ff1b
commit c220869abf
3 changed files with 23 additions and 19 deletions

View File

@ -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) found := make([]string, 0)
characters := make([]string, 0) characters := make([]string, 0)
for id, item := range Cosmetics.Items { for id, item := range Cosmetics.Items {
@ -288,7 +284,6 @@ func PreloadCosmetics(max int) error {
found = append(found, id) 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, "% )") aid.Print("Preloaded", len(found), "backpacks with characters", "(", float64(len(found))/float64(len(characters))*100, "% )")
DAv2 := *storage.Asset("assets.json") DAv2 := *storage.Asset("assets.json")
@ -304,7 +299,5 @@ func PreloadCosmetics(max int) error {
KnownDisplayAssets = DAv2Data KnownDisplayAssets = DAv2Data
aid.Print("Preloaded", len(KnownDisplayAssets), "display assets")
return nil return nil
} }

21
go.mod
View File

@ -2,13 +2,21 @@ module github.com/ectrc/snow
go 1.21.3 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 ( require (
github.com/andybalholm/brotli v1.0.6 // indirect github.com/andybalholm/brotli v1.0.6 // indirect
github.com/fsnotify/fsnotify v1.6.0 // 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/hashicorp/hcl v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // 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/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
github.com/klauspost/compress v1.17.2 // 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/lukechampine/randmap v0.0.0-20161125183226-9e3c222d0413 // indirect
github.com/magiconair/properties v1.8.7 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // 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/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/philhofer/fwd v1.1.2 // 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/rivo/uniseg v0.4.4 // indirect
github.com/rs/zerolog v1.26.0 // indirect github.com/rs/zerolog v1.26.0 // indirect
github.com/sagikazarmark/locafero v0.3.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/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sys v0.13.0 // indirect golang.org/x/sys v0.13.0 // indirect
golang.org/x/text 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 gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/postgres v1.5.3 // indirect
gorm.io/gorm v1.25.5 // indirect
) )

10
main.go
View File

@ -1,6 +1,8 @@
package main package main
import ( import (
"fmt"
"github.com/ectrc/snow/aid" "github.com/ectrc/snow/aid"
"github.com/ectrc/snow/fortnite" "github.com/ectrc/snow/fortnite"
"github.com/ectrc/snow/handlers" "github.com/ectrc/snow/handlers"
@ -22,6 +24,8 @@ func init() {
} }
postgresStorage.MigrateAll() postgresStorage.MigrateAll()
device = postgresStorage device = postgresStorage
default:
panic("Invalid database type: " + aid.Config.Database.Type)
} }
storage.Repo = storage.NewStorage(device) storage.Repo = storage.NewStorage(device)
@ -109,5 +113,9 @@ func main() {
}) })
r.All("*", func(c *fiber.Ctx) error { return c.Status(fiber.StatusNotFound).JSON(aid.ErrorNotFound) }) 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))
}
} }