diff --git a/models/Getter.go b/models/Getter.go index 2e51700..48e0215 100644 --- a/models/Getter.go +++ b/models/Getter.go @@ -44,15 +44,18 @@ func (g Getter) Get(url string) string { r, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s%s", g.BaseURL, url), nil) if err != nil { + fmt.Println("Error creating request") panic(err) } r.Header.Add("Authorization", fmt.Sprintf("Basic %s", g.AuthToken)) resp, err := g.Client.Do(r) if err != nil { + fmt.Println("Error sending request") panic(err) } resBody, err := io.ReadAll(resp.Body) if err != nil { + fmt.Println("Error reading response") panic(err) } return string(resBody) diff --git a/overlay/index.html b/overlay/index.html index 39995a9..38e8991 100644 --- a/overlay/index.html +++ b/overlay/index.html @@ -64,7 +64,7 @@

TEAM 2

-

test

+

diff --git a/overlay/main.js b/overlay/main.js index b425c75..3877343 100644 --- a/overlay/main.js +++ b/overlay/main.js @@ -175,8 +175,7 @@ async function setupTeamInfo() { for (let i = 0; i < teamName.length; i++) { teamName[i].getElementsByTagName("h1")[0].innerText = selected[i]["name"]; - // REMOVE COMMENT FOR PRODUCTION ------------------------------------------------------------------------------------------------------------------------------------------------ - //teamName[i].getElementsByTagName("img")[0].src = `./teams_img/${selected[i]["tag"]}.png`; + teamName[i].getElementsByTagName("img")[0].src = `./teams_img/${selected[i]["tag"]}.png`; //teamName[i].children[1].innerText = selected[i]["tag"]; score[i].innerText = selected[i]["score"]; diff --git a/overlay/style.css b/overlay/style.css index 5c8c779..0e19158 100644 --- a/overlay/style.css +++ b/overlay/style.css @@ -140,40 +140,5 @@ .blob { height: 100vh; filter: blur(10px); - box-shadow: -10vmin 10vmin 0 rgba(255, 255, 255, 0.07); width: 500px; -} -/* -.shade2 .blob { - animation: AnimateBlobTwo 8s ease-out infinite alternate; -} - - -.shade1 .blob { - animation: AnimateBlobOne 10s ease-in infinite alternate; -} -*/ - -@keyframes AnimateBlobOne { - 0% { - border-radius: 0% 4% 5% 0% / 67% 37% 56% 34%; - width: 370px; - } - - 100% { - border-radius: 0% 31% 9% 0% / 20% 86% 16% 79%; - width: 350px; - } -} - -@keyframes AnimateBlobTwo { - 0% { - border-radius: 5% 0% 0% 10% / 67% 89% 56% 9%; - width: 370px; - } - - 100% { - border-radius: 20% 0% 0% 5% / 41% 37% 10% 34%; - width: 350px; - } } \ No newline at end of file diff --git a/routes/DraftRoutes.go b/routes/DraftRoutes.go index 3dbfabc..268830b 100644 --- a/routes/DraftRoutes.go +++ b/routes/DraftRoutes.go @@ -1,17 +1,28 @@ package routes import ( + "fmt" "oblivion/draft/api" "oblivion/draft/middleware" "oblivion/draft/models" + "time" + "github.com/ImOlli/go-lcu/lcu" "github.com/gofiber/fiber/v2" ) func DraftRoutes(app *fiber.App) { - g, err := models.NewGetter() - if err != nil { - panic(err) + var g models.Getter + var err error + for { + g, err = models.NewGetter() + if err != nil && !lcu.IsProcessNotFoundError(err) { + panic(err) + } else if err == nil { + break + } + fmt.Println("LeagueClient not found, retrying in 2 second") + time.Sleep(2 * time.Second) } r := app.Group("/draft") diff --git a/utils/GetName.go b/utils/GetName.go index 43ad34c..15aedfa 100644 --- a/utils/GetName.go +++ b/utils/GetName.go @@ -1,16 +1,20 @@ package utils import ( + "fmt" "oblivion/draft/models" "strings" ) func GetName(g models.Getter, summonerID string) string { - if summonerID == "0" { + if summonerID == "0" || summonerID == "" { return "Bot" } - raw := g.Get("/lol-summoner/v1/summoners/" + summonerID) + if strings.Contains(raw, "RPC_ERROR") { + fmt.Println("Error getting summoner name") + return "Bot" + } displayName := strings.Split(strings.Split(raw, "\"displayName\":\"")[1], "\"")[0] return displayName }