This commit is contained in:
eccentric 2023-12-19 21:48:01 +00:00
parent 9e983fff93
commit fa886b95fb
2 changed files with 9 additions and 9 deletions

View File

@ -145,7 +145,7 @@ func GetOAuthVerify(c *fiber.Ctx) error {
}) })
} }
func FortniteMiddleware(c *fiber.Ctx) error { func MiddlewareFortnite(c *fiber.Ctx) error {
auth := c.Get("Authorization") auth := c.Get("Authorization")
if auth == "" { if auth == "" {
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Authorization Header is empty")) return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Authorization Header is empty"))
@ -167,7 +167,7 @@ func FortniteMiddleware(c *fiber.Ctx) error {
return c.Next() return c.Next()
} }
func FrontendMiddleware(c *fiber.Ctx) error { func MiddlewareWeb(c *fiber.Ctx) error {
auth := c.Get("Authorization") auth := c.Get("Authorization")
if auth == "" { if auth == "" {
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Authorization Header is empty")) return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Authorization Header is empty"))
@ -188,7 +188,7 @@ func FrontendMiddleware(c *fiber.Ctx) error {
return c.Next() return c.Next()
} }
func DeleteOAuthSessions(c *fiber.Ctx) error { func DeleteToken(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(aid.JSON{}) return c.Status(fiber.StatusOK).JSON(aid.JSON{})
} }

12
main.go
View File

@ -72,7 +72,7 @@ func main() {
account.Get("/public/account/displayName/:displayName", handlers.GetPublicAccountByDisplayName) 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.PostFortniteToken) account.Post("/oauth/token", handlers.PostFortniteToken)
account.Delete("/oauth/sessions/kill", handlers.DeleteOAuthSessions) account.Delete("/oauth/sessions/kill", handlers.DeleteToken)
fortnite := r.Group("/fortnite/api") fortnite := r.Group("/fortnite/api")
fortnite.Get("/receipts/v1/account/:accountId/receipts", handlers.GetFortniteReceipts) fortnite.Get("/receipts/v1/account/:accountId/receipts", handlers.GetFortniteReceipts)
@ -80,7 +80,7 @@ func main() {
fortnite.Get("/calendar/v1/timeline", handlers.GetFortniteTimeline) fortnite.Get("/calendar/v1/timeline", handlers.GetFortniteTimeline)
storefront := fortnite.Group("/storefront/v2") storefront := fortnite.Group("/storefront/v2")
storefront.Use(handlers.FortniteMiddleware) storefront.Use(handlers.MiddlewareFortnite)
storefront.Get("/catalog", handlers.GetStorefrontCatalog) storefront.Get("/catalog", handlers.GetStorefrontCatalog)
storefront.Get("/keychain", handlers.GetStorefrontKeychain) storefront.Get("/keychain", handlers.GetStorefrontKeychain)
@ -93,7 +93,7 @@ func main() {
storage.Get("/system/:fileName", handlers.GetCloudStorageFile) storage.Get("/system/:fileName", handlers.GetCloudStorageFile)
user := storage.Group("/user") user := storage.Group("/user")
user.Use(handlers.FortniteMiddleware) user.Use(handlers.MiddlewareFortnite)
user.Get("/:accountId", handlers.GetUserStorageFiles) user.Get("/:accountId", handlers.GetUserStorageFiles)
user.Get("/:accountId/:fileName", handlers.GetUserStorageFile) user.Get("/:accountId/:fileName", handlers.GetUserStorageFile)
user.Put("/:accountId/:fileName", handlers.PutUserStorageFile) user.Put("/:accountId/:fileName", handlers.PutUserStorageFile)
@ -106,11 +106,11 @@ func main() {
game.Post("/profileToken/verify/:accountId", handlers.AnyNoContent) game.Post("/profileToken/verify/:accountId", handlers.AnyNoContent)
profile := game.Group("/profile/:accountId") profile := game.Group("/profile/:accountId")
profile.Use(handlers.FortniteMiddleware) profile.Use(handlers.MiddlewareFortnite)
profile.Post("/client/:action", handlers.PostProfileAction) profile.Post("/client/:action", handlers.PostProfileAction)
lightswitch := r.Group("/lightswitch/api") lightswitch := r.Group("/lightswitch/api")
lightswitch.Use(handlers.FortniteMiddleware) lightswitch.Use(handlers.MiddlewareFortnite)
lightswitch.Get("/service/bulk/status", handlers.GetLightswitchBulkStatus) lightswitch.Get("/service/bulk/status", handlers.GetLightswitchBulkStatus)
snow := r.Group("/snow") snow := r.Group("/snow")
@ -121,7 +121,7 @@ func main() {
discord.Get("/", handlers.GetDiscordOAuthURL) discord.Get("/", handlers.GetDiscordOAuthURL)
player := snow.Group("/player") player := snow.Group("/player")
player.Use(handlers.FrontendMiddleware) player.Use(handlers.MiddlewareWeb)
player.Get("/", handlers.GetPlayer) player.Get("/", handlers.GetPlayer)
player.Get("/locker", handlers.GetPlayerLocker) player.Get("/locker", handlers.GetPlayerLocker)