diff --git a/default.config.ini b/default.config.ini index 17ea99d..441ec9b 100644 --- a/default.config.ini +++ b/default.config.ini @@ -29,7 +29,7 @@ port=":3000" ; host that the api is running on ; e.g. if you are running the api on your local machine, you would set this to 127.0.0.1 ; if you are running the api on a server, you would set this to the ip of the server or the domain name -host="http://127.0.0.1" +host="127.0.0.1" [jwt] ; secret for jwt signing diff --git a/handlers/discord.go b/handlers/discord.go index 2d1ce1e..57e0f9c 100644 --- a/handlers/discord.go +++ b/handlers/discord.go @@ -16,7 +16,7 @@ import ( func GetDiscordOAuthURL(c *fiber.Ctx) error { code := c.Query("code") if code == "" { - return c.Status(200).SendString("https://discord.com/oauth2/authorize?client_id="+ aid.Config.Discord.ID +"&redirect_uri="+ url.QueryEscape(aid.Config.API.Host + aid.Config.API.Port +"/snow/discord") + "&response_type=code&scope=identify") + return c.Status(200).SendString("https://discord.com/oauth2/authorize?client_id="+ aid.Config.Discord.ID +"&redirect_uri="+ url.QueryEscape("http://" + aid.Config.API.Host + aid.Config.API.Port +"/snow/discord") + "&response_type=code&scope=identify") } client := &http.Client{} @@ -26,7 +26,7 @@ func GetDiscordOAuthURL(c *fiber.Ctx) error { "client_secret": {aid.Config.Discord.Secret}, "grant_type": {"authorization_code"}, "code": {code}, - "redirect_uri": {aid.Config.API.Host + aid.Config.API.Port +"/snow/discord"}, + "redirect_uri": {"http://" + aid.Config.API.Host + aid.Config.API.Port +"/snow/discord"}, }) if err != nil { return c.Status(500).JSON(aid.JSON{"error":err.Error()}) @@ -88,5 +88,5 @@ func GetDiscordOAuthURL(c *fiber.Ctx) error { Name: "access_token", Value: access, }) - return c.Redirect(aid.Config.API.Host + aid.Config.API.FrontendPort + "/attempt") + return c.Redirect("http://" + aid.Config.API.Host + aid.Config.API.FrontendPort + "/attempt") } \ No newline at end of file diff --git a/handlers/discovery.go b/handlers/discovery.go index acc8561..b1d6815 100644 --- a/handlers/discovery.go +++ b/handlers/discovery.go @@ -76,7 +76,7 @@ func createPlaylist(mnemonic string, image string) aid.JSON { func PostDiscovery(c *fiber.Ctx) error { results := []aid.JSON{} for playlist := range fortnite.PlaylistImages { - results = append(results, createPlaylist(playlist, aid.Config.API.Host + aid.Config.API.Port + "/snow/image/" + playlist + ".png?cache="+strconv.Itoa(rand.Intn(9999)))) + results = append(results, createPlaylist(playlist, "https://" + aid.Config.API.Host + aid.Config.API.Port + "/snow/image/" + playlist + ".png?cache="+strconv.Itoa(rand.Intn(9999)))) } results = append(results, createPlaylist("Playlist_DefaultSolo", "http://bucket.retrac.site/55737fa15677cd57fab9e7f4499d62f89cfde320.png")) @@ -158,7 +158,7 @@ func GetContentPages(c *fiber.Ctx) error { playlists := []aid.JSON{} for playlist := range fortnite.PlaylistImages { playlists = append(playlists, aid.JSON{ - "image": aid.Config.API.Host + aid.Config.API.Port + "/snow/image/" + playlist + ".png?cache="+strconv.Itoa(rand.Intn(9999)), + "image": "http://" +aid.Config.API.Host + aid.Config.API.Port + "/snow/image/" + playlist + ".png?cache="+strconv.Itoa(rand.Intn(9999)), "playlist_name": playlist, "hidden": false, }) diff --git a/handlers/storage.go b/handlers/storage.go index 25623d8..a52d4d9 100644 --- a/handlers/storage.go +++ b/handlers/storage.go @@ -1,12 +1,32 @@ package handlers import ( + "crypto/sha1" + "crypto/sha256" + "encoding/hex" + "github.com/ectrc/snow/aid" + "github.com/ectrc/snow/storage" "github.com/gofiber/fiber/v2" ) func GetCloudStorageFiles(c *fiber.Ctx) error { - return c.Status(fiber.StatusOK).JSON([]aid.JSON{}) + sum := sha1.Sum(storage.GetDefaultEngine()) + more := sha256.Sum256(storage.GetDefaultEngine()) + + return c.Status(fiber.StatusOK).JSON([]aid.JSON{ + { + "uniqueFilename": "DefaultEngine.ini", + "filename": "DefaultEngine.ini", + "hash": hex.EncodeToString(sum[:]), + "hash256": hex.EncodeToString(more[:]), + "length": len(storage.GetDefaultEngine()), + "contentType": "application/octet-stream", + "uploaded": "0000-00-00T00:00:00.000Z", + "storageType": "S3", + "doNotCache": false, + }, + }) } func GetCloudStorageConfig(c *fiber.Ctx) error { @@ -23,6 +43,11 @@ func GetCloudStorageConfig(c *fiber.Ctx) error { } func GetCloudStorageFile(c *fiber.Ctx) error { + switch c.Params("fileName") { + case "DefaultEngine.ini": + return c.Status(fiber.StatusOK).Send(storage.GetDefaultEngine()) + } + return c.Status(400).JSON(aid.ErrorBadRequest) } diff --git a/storage/hotfix.go b/storage/hotfix.go new file mode 100644 index 0000000..7628a10 --- /dev/null +++ b/storage/hotfix.go @@ -0,0 +1,25 @@ +package storage + +import "github.com/ectrc/snow/aid" + +func GetDefaultEngine() []byte { + return []byte(` +[OnlineSubsystemMcp] +bUsePartySystemV2=false + +[OnlineSubsystemMcp.OnlinePartySystemMcpAdapter] +bUsePartySystemV2=false + +[XMPP] +bEnableWebsockets=true + +[OnlineSubsystemMcp.Xmpp] +bUseSSL=false +ServerAddr="ws://` + aid.Config.API.Host + `/socket/presence" +ServerPort=` + aid.Config.API.Port + ` + +[OnlineSubsystemMcp.Xmpp Prod] +bUseSSL=false +ServerAddr="ws://` + aid.Config.API.Host + `/socket/presence" +ServerPort=` + aid.Config.API.Port + ``) +} \ No newline at end of file