add hotfix support
This commit is contained in:
parent
e3161d9524
commit
a77e26502c
|
@ -29,7 +29,7 @@ port=":3000"
|
||||||
; host that the api is running on
|
; 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
|
; 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
|
; 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]
|
[jwt]
|
||||||
; secret for jwt signing
|
; secret for jwt signing
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
func GetDiscordOAuthURL(c *fiber.Ctx) error {
|
func GetDiscordOAuthURL(c *fiber.Ctx) error {
|
||||||
code := c.Query("code")
|
code := c.Query("code")
|
||||||
if 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{}
|
client := &http.Client{}
|
||||||
|
@ -26,7 +26,7 @@ func GetDiscordOAuthURL(c *fiber.Ctx) error {
|
||||||
"client_secret": {aid.Config.Discord.Secret},
|
"client_secret": {aid.Config.Discord.Secret},
|
||||||
"grant_type": {"authorization_code"},
|
"grant_type": {"authorization_code"},
|
||||||
"code": {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 {
|
if err != nil {
|
||||||
return c.Status(500).JSON(aid.JSON{"error":err.Error()})
|
return c.Status(500).JSON(aid.JSON{"error":err.Error()})
|
||||||
|
@ -88,5 +88,5 @@ func GetDiscordOAuthURL(c *fiber.Ctx) error {
|
||||||
Name: "access_token",
|
Name: "access_token",
|
||||||
Value: access,
|
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")
|
||||||
}
|
}
|
|
@ -76,7 +76,7 @@ func createPlaylist(mnemonic string, image string) aid.JSON {
|
||||||
func PostDiscovery(c *fiber.Ctx) error {
|
func PostDiscovery(c *fiber.Ctx) error {
|
||||||
results := []aid.JSON{}
|
results := []aid.JSON{}
|
||||||
for playlist := range fortnite.PlaylistImages {
|
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"))
|
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{}
|
playlists := []aid.JSON{}
|
||||||
for playlist := range fortnite.PlaylistImages {
|
for playlist := range fortnite.PlaylistImages {
|
||||||
playlists = append(playlists, aid.JSON{
|
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,
|
"playlist_name": playlist,
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,12 +1,32 @@
|
||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/sha1"
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
|
|
||||||
"github.com/ectrc/snow/aid"
|
"github.com/ectrc/snow/aid"
|
||||||
|
"github.com/ectrc/snow/storage"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetCloudStorageFiles(c *fiber.Ctx) error {
|
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 {
|
func GetCloudStorageConfig(c *fiber.Ctx) error {
|
||||||
|
@ -23,6 +43,11 @@ func GetCloudStorageConfig(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetCloudStorageFile(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)
|
return c.Status(400).JSON(aid.ErrorBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
25
storage/hotfix.go
Normal file
25
storage/hotfix.go
Normal file
|
@ -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 + ``)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user