Fix Invisible Character in lobby.
This commit is contained in:
parent
f54644e3e9
commit
5237402c5e
|
@ -110,56 +110,56 @@ func PostOAuthTokenPassword(c *fiber.Ctx, body *OAuthTokenBody) error {
|
||||||
func GetOAuthVerify(c *fiber.Ctx) error {
|
func GetOAuthVerify(c *fiber.Ctx) error {
|
||||||
auth := c.Get("Authorization")
|
auth := c.Get("Authorization")
|
||||||
if auth == "" {
|
if auth == "" {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Authorization Header is empty"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Authorization Header is empty"))
|
||||||
}
|
}
|
||||||
real := strings.ReplaceAll(auth, "bearer eg1~", "")
|
real := strings.ReplaceAll(auth, "bearer eg1~", "")
|
||||||
|
|
||||||
claims, err := aid.JWTVerify(real)
|
claims, err := aid.JWTVerify(real)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if claims["snow_id"] == nil {
|
if claims["snow_id"] == nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
snowId, ok := claims["snow_id"].(string)
|
snowId, ok := claims["snow_id"].(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
person := p.Find(snowId)
|
person := p.Find(snowId)
|
||||||
if person == nil {
|
if person == nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.SendStatus(fiber.StatusNoContent)
|
return c.SendStatus(fiber.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MiddlewareOAuthVerify(c *fiber.Ctx) error {
|
func MiddlewareOAuthVerify(c *fiber.Ctx) error {
|
||||||
auth := c.Get("Authorization")
|
auth := c.Get("Authorization")
|
||||||
if auth == "" {
|
if auth == "" {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Authorization Header is empty"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Authorization Header is empty"))
|
||||||
}
|
}
|
||||||
real := strings.ReplaceAll(auth, "bearer eg1~", "")
|
real := strings.ReplaceAll(auth, "bearer eg1~", "")
|
||||||
|
|
||||||
claims, err := aid.JWTVerify(real)
|
claims, err := aid.JWTVerify(real)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if claims["snow_id"] == nil {
|
if claims["snow_id"] == nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
snowId, ok := claims["snow_id"].(string)
|
snowId, ok := claims["snow_id"].(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
person := p.Find(snowId)
|
person := p.Find(snowId)
|
||||||
if person == nil {
|
if person == nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Locals("person", person)
|
c.Locals("person", person)
|
||||||
|
@ -180,9 +180,33 @@ func GetPublicAccount(c *fiber.Ctx) error {
|
||||||
return c.Status(fiber.StatusOK).JSON(aid.JSON{
|
return c.Status(fiber.StatusOK).JSON(aid.JSON{
|
||||||
"id": person.ID,
|
"id": person.ID,
|
||||||
"displayName": person.DisplayName,
|
"displayName": person.DisplayName,
|
||||||
|
"externalAuths": []aid.JSON{},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetPublicAccounts(c *fiber.Ctx) error {
|
||||||
|
response := []aid.JSON{}
|
||||||
|
|
||||||
|
accountIds := c.Request().URI().QueryArgs().PeekMulti("accountId")
|
||||||
|
for _, accountIdSlice := range accountIds {
|
||||||
|
person := p.Find(string(accountIdSlice))
|
||||||
|
if person == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
response = append(response, aid.JSON{
|
||||||
|
"id": person.ID,
|
||||||
|
"displayName": person.DisplayName,
|
||||||
|
"externalAuths": []aid.JSON{},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
aid.PrintJSON(accountIds)
|
||||||
|
aid.PrintJSON(response)
|
||||||
|
|
||||||
|
return c.Status(fiber.StatusOK).JSON(response)
|
||||||
|
}
|
||||||
|
|
||||||
func GetPublicAccountExternalAuths(c *fiber.Ctx) error {
|
func GetPublicAccountExternalAuths(c *fiber.Ctx) error {
|
||||||
person := p.Find(c.Params("accountId"))
|
person := p.Find(c.Params("accountId"))
|
||||||
if person == nil {
|
if person == nil {
|
||||||
|
@ -190,4 +214,17 @@ func GetPublicAccountExternalAuths(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.Status(fiber.StatusOK).JSON([]aid.JSON{})
|
return c.Status(fiber.StatusOK).JSON([]aid.JSON{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPublicAccountByDisplayName(c *fiber.Ctx) error {
|
||||||
|
person := p.FindByDisplay(c.Params("displayName"))
|
||||||
|
if person == nil {
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("No Account Found"))
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Status(fiber.StatusOK).JSON(aid.JSON{
|
||||||
|
"id": person.ID,
|
||||||
|
"displayName": person.DisplayName,
|
||||||
|
"externalAuths": []aid.JSON{},
|
||||||
|
})
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
13
main.go
13
main.go
|
@ -64,14 +64,15 @@ func main() {
|
||||||
r.Get("/content/api/pages/fortnite-game", handlers.GetContentPages)
|
r.Get("/content/api/pages/fortnite-game", handlers.GetContentPages)
|
||||||
|
|
||||||
account := r.Group("/account/api")
|
account := r.Group("/account/api")
|
||||||
|
account.Get("/public/account", handlers.GetPublicAccounts)
|
||||||
account.Get("/public/account/:accountId", handlers.GetPublicAccount)
|
account.Get("/public/account/:accountId", handlers.GetPublicAccount)
|
||||||
account.Get("/public/account/:accountId/externalAuths", handlers.GetPublicAccountExternalAuths)
|
account.Get("/public/account/:accountId/externalAuths", handlers.GetPublicAccountExternalAuths)
|
||||||
|
account.Get("/public/account/displayName/:displayName", handlers.GetPublicAccountByDisplayName)
|
||||||
account.Get("/oauth/verify", handlers.GetOAuthVerify)
|
account.Get("/oauth/verify", handlers.GetOAuthVerify)
|
||||||
account.Post("/oauth/token", handlers.PostOAuthToken)
|
account.Post("/oauth/token", handlers.PostOAuthToken)
|
||||||
account.Delete("/oauth/sessions/kill", handlers.DeleteOAuthSessions)
|
account.Delete("/oauth/sessions/kill", handlers.DeleteOAuthSessions)
|
||||||
|
|
||||||
fortnite := r.Group("/fortnite/api")
|
fortnite := r.Group("/fortnite/api")
|
||||||
fortnite.Use(handlers.MiddlewareOAuthVerify)
|
|
||||||
fortnite.Get("/receipts/v1/account/:accountId/receipts", handlers.GetFortniteReceipts)
|
fortnite.Get("/receipts/v1/account/:accountId/receipts", handlers.GetFortniteReceipts)
|
||||||
fortnite.Get("/v2/versioncheck/*", handlers.GetFortniteVersion)
|
fortnite.Get("/v2/versioncheck/*", handlers.GetFortniteVersion)
|
||||||
fortnite.Get("/calendar/v1/timeline", handlers.GetFortniteTimeline)
|
fortnite.Get("/calendar/v1/timeline", handlers.GetFortniteTimeline)
|
||||||
|
@ -88,12 +89,14 @@ func main() {
|
||||||
storage.Get("/system", handlers.GetCloudStorageFiles)
|
storage.Get("/system", handlers.GetCloudStorageFiles)
|
||||||
storage.Get("/system/config", handlers.GetCloudStorageConfig)
|
storage.Get("/system/config", handlers.GetCloudStorageConfig)
|
||||||
storage.Get("/system/:fileName", handlers.GetCloudStorageFile)
|
storage.Get("/system/:fileName", handlers.GetCloudStorageFile)
|
||||||
storage.Get("/user/:accountId", handlers.GetUserStorageFiles)
|
|
||||||
storage.Get("/user/:accountId/:fileName", handlers.GetUserStorageFile)
|
user := storage.Group("/user")
|
||||||
storage.Put("/user/:accountId/:fileName", handlers.PutUserStorageFile)
|
user.Use(handlers.MiddlewareOAuthVerify)
|
||||||
|
user.Get("/:accountId", handlers.GetUserStorageFiles)
|
||||||
|
user.Get("/:accountId/:fileName", handlers.GetUserStorageFile)
|
||||||
|
user.Put("/:accountId/:fileName", handlers.PutUserStorageFile)
|
||||||
|
|
||||||
game := fortnite.Group("/game/v2")
|
game := fortnite.Group("/game/v2")
|
||||||
game.Use(handlers.MiddlewareOAuthVerify)
|
|
||||||
game.Get("/enabled_features", handlers.GetGameEnabledFeatures)
|
game.Get("/enabled_features", handlers.GetGameEnabledFeatures)
|
||||||
game.Post("/tryPlayOnPlatform/account/:accountId", handlers.PostGamePlatform)
|
game.Post("/tryPlayOnPlatform/account/:accountId", handlers.PostGamePlatform)
|
||||||
game.Post("/grant_access/:accountId", handlers.PostGameAccess)
|
game.Post("/grant_access/:accountId", handlers.PostGameAccess)
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
{}
|
|
|
@ -6,12 +6,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
//go:embed assets/*
|
//go:embed mem/*
|
||||||
Assets embed.FS
|
Assets embed.FS
|
||||||
)
|
)
|
||||||
|
|
||||||
func Asset(file string) (*[]byte) {
|
func Asset(file string) (*[]byte) {
|
||||||
data, err := Assets.ReadFile("assets/" + strings.ToLower(file))
|
data, err := Assets.ReadFile("mem/" + strings.ToLower(file))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
1210
storage/mem/keychain.json
Normal file
1210
storage/mem/keychain.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user