diff --git a/middleware/Log.go b/middleware/Log.go index aeac6e3f..b08517f9 100644 --- a/middleware/Log.go +++ b/middleware/Log.go @@ -57,24 +57,28 @@ func logRequest(ctx *aero.Context, responseTime time.Duration) { } // Log every request + id := "[id]" + nick := "[guest]" + if user != nil { - request.Info(user.Nick, ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI()) - } else { - request.Info("[guest]", ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI()) + id = user.ID + nick = user.Nick } + request.Info(nick, id, ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI()) + // Log all requests that failed switch ctx.StatusCode { case http.StatusOK, http.StatusFound, http.StatusMovedPermanently, http.StatusPermanentRedirect, http.StatusTemporaryRedirect: // Ok. default: - err.Error(http.StatusText(ctx.StatusCode), ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI()) + err.Error(nick, id, ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI(), ctx.ErrorMessage) } // Notify us about long requests. // However ignore requests under /auth/ because those depend on 3rd party servers. if responseTime >= 300*time.Millisecond && !strings.HasPrefix(ctx.URI(), "/auth/") && !strings.HasPrefix(ctx.URI(), "/sitemap/") { - err.Error("Long response time", ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI()) + err.Error("Long response time", nick, id, ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI()) } } diff --git a/pages/admin/purchases.go b/pages/admin/purchases.go index 4cf1b70b..23eca5dd 100644 --- a/pages/admin/purchases.go +++ b/pages/admin/purchases.go @@ -15,11 +15,11 @@ func PurchaseHistory(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } if user.Role != "admin" { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } purchases, err := arn.AllPurchases() diff --git a/pages/admin/registrations.go b/pages/admin/registrations.go index 7fdf1623..a814214c 100644 --- a/pages/admin/registrations.go +++ b/pages/admin/registrations.go @@ -16,11 +16,11 @@ func UserRegistrations(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } if user.Role != "admin" { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } total := 0 diff --git a/pages/anime/editanime/editanime.go b/pages/anime/editanime/editanime.go index 060c74d7..95a1e0ae 100644 --- a/pages/anime/editanime/editanime.go +++ b/pages/anime/editanime/editanime.go @@ -16,7 +16,7 @@ func Main(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this anime", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this anime") } anime, err := arn.GetAnime(id) @@ -34,7 +34,7 @@ func Images(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this anime", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this anime") } anime, err := arn.GetAnime(id) @@ -52,7 +52,7 @@ func Characters(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit") } anime, err := arn.GetAnime(id) @@ -76,7 +76,7 @@ func Relations(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit") } anime, err := arn.GetAnime(id) @@ -100,7 +100,7 @@ func Episodes(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit") } anime, err := arn.GetAnime(id) diff --git a/pages/anime/redirect.go b/pages/anime/redirect.go index 1a4290ac..747f3ff0 100644 --- a/pages/anime/redirect.go +++ b/pages/anime/redirect.go @@ -16,7 +16,7 @@ func RedirectByMapping(mappingName string) func(*aero.Context) string { anime := finder.GetAnime(id) if anime == nil { - return ctx.Error(http.StatusNotFound, "Anime not found", nil) + return ctx.Error(http.StatusNotFound, "Anime not found") } return utils.SmartRedirect(ctx, "/anime/"+anime.ID) diff --git a/pages/animeimport/deletekitsu.go b/pages/animeimport/deletekitsu.go index c754caa4..c06bc1a2 100644 --- a/pages/animeimport/deletekitsu.go +++ b/pages/animeimport/deletekitsu.go @@ -17,7 +17,7 @@ func DeleteKitsu(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } // Check that the anime really exists diff --git a/pages/animeimport/kitsu.go b/pages/animeimport/kitsu.go index 799fe939..aeb5a9ce 100644 --- a/pages/animeimport/kitsu.go +++ b/pages/animeimport/kitsu.go @@ -19,7 +19,7 @@ func Kitsu(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } kitsuAnimeObj, err := arn.Kitsu.Get("Anime", id) diff --git a/pages/animelist/animelist.go b/pages/animelist/animelist.go index 9089ee5b..9847334e 100644 --- a/pages/animelist/animelist.go +++ b/pages/animelist/animelist.go @@ -38,7 +38,7 @@ func AnimeList(ctx *aero.Context, user *arn.User, status string) string { animeList := viewUser.AnimeList() if animeList == nil { - return ctx.Error(http.StatusNotFound, "Anime list not found", nil) + return ctx.Error(http.StatusNotFound, "Anime list not found") } statusList := animeList.FilterStatus(status) diff --git a/pages/animelist/redirect.go b/pages/animelist/redirect.go index 5b69f33a..0d0e7488 100644 --- a/pages/animelist/redirect.go +++ b/pages/animelist/redirect.go @@ -12,7 +12,7 @@ func Redirect(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } return ctx.Redirect("/+" + user.Nick + ctx.URI()) diff --git a/pages/charge/charge.go b/pages/charge/charge.go index 441b4563..859eb0a8 100644 --- a/pages/charge/charge.go +++ b/pages/charge/charge.go @@ -14,7 +14,7 @@ func Get(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } return ctx.HTML(components.Charge(user)) diff --git a/pages/dashboard/dashboard.go b/pages/dashboard/dashboard.go index d8c47495..c9e18a60 100644 --- a/pages/dashboard/dashboard.go +++ b/pages/dashboard/dashboard.go @@ -26,7 +26,7 @@ package dashboard // user := utils.GetUser(ctx) // if user == nil { -// return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) +// return ctx.Error(http.StatusUnauthorized, "Not logged in") // } // flow.Parallel(func() { diff --git a/pages/editlog/editlog.go b/pages/editlog/editlog.go index 965d9a04..24114fc9 100644 --- a/pages/editlog/editlog.go +++ b/pages/editlog/editlog.go @@ -24,7 +24,7 @@ func Get(ctx *aero.Context) string { nick := ctx.Get("nick") if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } viewUser, err := arn.GetUserByNick(nick) diff --git a/pages/editor/filteranime/utils.go b/pages/editor/filteranime/utils.go index 63a3e272..6d96f800 100644 --- a/pages/editor/filteranime/utils.go +++ b/pages/editor/filteranime/utils.go @@ -17,7 +17,7 @@ func editorList(ctx *aero.Context, title string, filter func(*arn.Anime) bool, s user := utils.GetUser(ctx) if user == nil || (user.Role != "admin" && user.Role != "editor") { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } animes, count := filterAnime(ctx, user, filter) diff --git a/pages/editor/filtersoundtracks/utils.go b/pages/editor/filtersoundtracks/utils.go index ab34ac07..d9e1029e 100644 --- a/pages/editor/filtersoundtracks/utils.go +++ b/pages/editor/filtersoundtracks/utils.go @@ -17,7 +17,7 @@ func editorList(ctx *aero.Context, title string, filter func(*arn.SoundTrack) bo user := utils.GetUser(ctx) if user == nil || (user.Role != "admin" && user.Role != "editor") { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } tracks, count := filterSoundTracks(ctx, user, filter) diff --git a/pages/editor/jobs/start.go b/pages/editor/jobs/start.go index 7560c035..b4b881b6 100644 --- a/pages/editor/jobs/start.go +++ b/pages/editor/jobs/start.go @@ -21,18 +21,18 @@ func Start(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } jobName := ctx.Get("job") job := jobInfo[jobName] if job == nil { - return ctx.Error(http.StatusBadRequest, "Job not available", nil) + return ctx.Error(http.StatusBadRequest, "Job not available") } if job.IsRunning() { - return ctx.Error(http.StatusBadRequest, "Job is currently running!", nil) + return ctx.Error(http.StatusBadRequest, "Job is currently running!") } job.Start() diff --git a/pages/embed/embed.go b/pages/embed/embed.go index 3a4c2500..68117f69 100644 --- a/pages/embed/embed.go +++ b/pages/embed/embed.go @@ -25,7 +25,7 @@ func Get(ctx *aero.Context) string { animeList := user.AnimeList() if animeList == nil { - return ctx.Error(http.StatusNotFound, "Anime list not found", nil) + return ctx.Error(http.StatusNotFound, "Anime list not found") } watchingList := animeList.Watching() diff --git a/pages/episode/episode.go b/pages/episode/episode.go index afb6094c..3d47bdb0 100644 --- a/pages/episode/episode.go +++ b/pages/episode/episode.go @@ -36,7 +36,7 @@ func Get(ctx *aero.Context) string { episode := animeEpisodes.Find(episodeNumber) if episode == nil { - return ctx.Error(http.StatusNotFound, "Anime episode not found", nil) + return ctx.Error(http.StatusNotFound, "Anime episode not found") } return ctx.HTML(components.AnimeEpisode(anime, episode, user)) diff --git a/pages/explore/explorerelations/sequels.go b/pages/explore/explorerelations/sequels.go index 4d96ea9b..271dd62a 100644 --- a/pages/explore/explorerelations/sequels.go +++ b/pages/explore/explorerelations/sequels.go @@ -16,7 +16,7 @@ func Sequels(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } animeList := user.AnimeList() diff --git a/pages/inventory/inventory.go b/pages/inventory/inventory.go index e7aa1904..a51730df 100644 --- a/pages/inventory/inventory.go +++ b/pages/inventory/inventory.go @@ -17,7 +17,7 @@ func Get(ctx *aero.Context) string { viewUser := user if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } inventory, err := arn.GetInventory(viewUser.ID) diff --git a/pages/listimport/listimport.go b/pages/listimport/listimport.go index 8956baf7..f4a0843b 100644 --- a/pages/listimport/listimport.go +++ b/pages/listimport/listimport.go @@ -13,7 +13,7 @@ func Get(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } return ctx.HTML(components.ImportLists(user)) diff --git a/pages/listimport/listimportanilist/anilist.go b/pages/listimport/listimportanilist/anilist.go index fb81d5e5..a2695bf3 100644 --- a/pages/listimport/listimportanilist/anilist.go +++ b/pages/listimport/listimportanilist/anilist.go @@ -16,7 +16,7 @@ func Preview(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } matches, response := getMatches(ctx) @@ -33,7 +33,7 @@ func Finish(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } matches, response := getMatches(ctx) @@ -76,7 +76,7 @@ func getMatches(ctx *aero.Context) ([]*arn.AniListMatch, string) { user := utils.GetUser(ctx) if user == nil { - return nil, ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return nil, ctx.Error(http.StatusBadRequest, "Not logged in") } // Get user diff --git a/pages/listimport/listimportkitsu/kitsu.go b/pages/listimport/listimportkitsu/kitsu.go index dc4245c2..b1fd726d 100644 --- a/pages/listimport/listimportkitsu/kitsu.go +++ b/pages/listimport/listimportkitsu/kitsu.go @@ -15,7 +15,7 @@ func Preview(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } matches, response := getMatches(ctx) @@ -32,7 +32,7 @@ func Finish(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } matches, response := getMatches(ctx) @@ -87,7 +87,7 @@ func getMatches(ctx *aero.Context) ([]*arn.KitsuMatch, string) { user := utils.GetUser(ctx) if user == nil { - return nil, ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return nil, ctx.Error(http.StatusBadRequest, "Not logged in") } kitsuUser, err := kitsu.GetUser(user.Accounts.Kitsu.Nick) diff --git a/pages/listimport/listimportmyanimelist/myanimelist.go b/pages/listimport/listimportmyanimelist/myanimelist.go index b770200d..7e4cfcc7 100644 --- a/pages/listimport/listimportmyanimelist/myanimelist.go +++ b/pages/listimport/listimportmyanimelist/myanimelist.go @@ -16,7 +16,7 @@ func Preview(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } matches, response := getMatches(ctx) @@ -33,7 +33,7 @@ func Finish(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } matches, response := getMatches(ctx) @@ -83,7 +83,7 @@ func getMatches(ctx *aero.Context) ([]*arn.MyAnimeListMatch, string) { user := utils.GetUser(ctx) if user == nil { - return nil, ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return nil, ctx.Error(http.StatusBadRequest, "Not logged in") } malAnimeList, err := mal.GetAnimeList(user.Accounts.MyAnimeList.Nick) diff --git a/pages/newthread/newthread.go b/pages/newthread/newthread.go index 614af029..29e7b3a1 100644 --- a/pages/newthread/newthread.go +++ b/pages/newthread/newthread.go @@ -13,7 +13,7 @@ func Get(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } return ctx.HTML(components.NewThread(user)) diff --git a/pages/notifications/api.go b/pages/notifications/api.go index ff144ec2..982597ea 100644 --- a/pages/notifications/api.go +++ b/pages/notifications/api.go @@ -14,7 +14,7 @@ func CountUnseen(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } unseen := user.Notifications().CountUnseen() @@ -27,7 +27,7 @@ func MarkNotificationsAsSeen(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } notifications := user.Notifications().Notifications() @@ -45,7 +45,7 @@ func Test(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } user.SendNotification(&arn.PushNotification{ diff --git a/pages/notifications/notifications.go b/pages/notifications/notifications.go index 58cd72f5..7ef16113 100644 --- a/pages/notifications/notifications.go +++ b/pages/notifications/notifications.go @@ -18,7 +18,7 @@ func ByUser(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } var viewUser *arn.User diff --git a/pages/paypal/paypal.go b/pages/paypal/paypal.go index 389bd778..a264e7e4 100644 --- a/pages/paypal/paypal.go +++ b/pages/paypal/paypal.go @@ -15,7 +15,7 @@ func CreatePayment(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } // Verify amount @@ -29,7 +29,7 @@ func CreatePayment(ctx *aero.Context) string { case "1000", "2000", "3000", "6000", "12000", "25000", "50000", "75000": // OK default: - return ctx.Error(http.StatusBadRequest, "Incorrect amount", nil) + return ctx.Error(http.StatusBadRequest, "Incorrect amount") } // Initiate PayPal client diff --git a/pages/paypal/success.go b/pages/paypal/success.go index 7ffe9a3b..e1b1046c 100644 --- a/pages/paypal/success.go +++ b/pages/paypal/success.go @@ -20,7 +20,7 @@ func Success(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } paymentID := ctx.Query("paymentId") diff --git a/pages/post/editpost/editpost.go b/pages/post/editpost/editpost.go index d124e1b3..6ae3837a 100644 --- a/pages/post/editpost/editpost.go +++ b/pages/post/editpost/editpost.go @@ -16,7 +16,7 @@ func Get(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this post", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this post") } post, err := arn.GetPost(id) diff --git a/pages/settings/settings.go b/pages/settings/settings.go index 87c47159..f4a4b31a 100644 --- a/pages/settings/settings.go +++ b/pages/settings/settings.go @@ -14,7 +14,7 @@ func Get(component func(*arn.User) string) func(*aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } return ctx.HTML(component(user)) diff --git a/pages/shop/buyitem.go b/pages/shop/buyitem.go index 27c24990..f9296952 100644 --- a/pages/shop/buyitem.go +++ b/pages/shop/buyitem.go @@ -21,7 +21,7 @@ func BuyItem(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } // Item ID and quantity @@ -42,7 +42,7 @@ func BuyItem(ctx *aero.Context) string { totalPrice := int(item.Price) * quantity if user.Balance < totalPrice { - return ctx.Error(http.StatusBadRequest, "Not enough gems. You need to charge up your balance before you can buy this item.", nil) + return ctx.Error(http.StatusBadRequest, "Not enough gems. You need to charge up your balance before you can buy this item.") } user.Balance -= totalPrice diff --git a/pages/shop/history.go b/pages/shop/history.go index 87b77d80..9960b8f0 100644 --- a/pages/shop/history.go +++ b/pages/shop/history.go @@ -15,7 +15,7 @@ func PurchaseHistory(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } purchases, err := arn.FilterPurchases(func(purchase *arn.Purchase) bool { diff --git a/pages/shop/shop.go b/pages/shop/shop.go index 8ace9807..d2f3495b 100644 --- a/pages/shop/shop.go +++ b/pages/shop/shop.go @@ -16,7 +16,7 @@ func Get(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } items, err := arn.AllShopItems() diff --git a/pages/thread/editthread/editthread.go b/pages/thread/editthread/editthread.go index 8790d27e..2ce92604 100644 --- a/pages/thread/editthread/editthread.go +++ b/pages/thread/editthread/editthread.go @@ -16,7 +16,7 @@ func Get(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this thread", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this thread") } thread, err := arn.GetThread(id) diff --git a/pages/upload/amv.go b/pages/upload/amv.go index 86f8bfe8..716f8de8 100644 --- a/pages/upload/amv.go +++ b/pages/upload/amv.go @@ -15,7 +15,7 @@ func AMVFile(ctx *aero.Context) string { amvID := ctx.Get("id") if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } amv, err := arn.GetAMV(amvID) diff --git a/pages/upload/anime-image.go b/pages/upload/anime-image.go index bcc6a17d..28d17644 100644 --- a/pages/upload/anime-image.go +++ b/pages/upload/anime-image.go @@ -15,7 +15,7 @@ func AnimeImage(ctx *aero.Context) string { animeID := ctx.Get("id") if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } anime, err := arn.GetAnime(animeID) diff --git a/pages/upload/avatar.go b/pages/upload/avatar.go index cd4d1bb9..53be2869 100644 --- a/pages/upload/avatar.go +++ b/pages/upload/avatar.go @@ -12,7 +12,7 @@ func Avatar(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } // Retrieve file from post body diff --git a/pages/upload/character.go b/pages/upload/character.go index 7c5078af..76297e1d 100644 --- a/pages/upload/character.go +++ b/pages/upload/character.go @@ -15,7 +15,7 @@ func CharacterImage(ctx *aero.Context) string { characterID := ctx.Get("id") if user == nil || (user.Role != "editor" && user.Role != "admin") { - return ctx.Error(http.StatusUnauthorized, "Not authorized", nil) + return ctx.Error(http.StatusUnauthorized, "Not authorized") } character, err := arn.GetCharacter(characterID) diff --git a/pages/upload/cover.go b/pages/upload/cover.go index c88ad4cd..ea895440 100644 --- a/pages/upload/cover.go +++ b/pages/upload/cover.go @@ -12,11 +12,11 @@ func Cover(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusUnauthorized, "Not logged in", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in") } if !user.IsPro() { - return ctx.Error(http.StatusUnauthorized, "Only available for PRO users", nil) + return ctx.Error(http.StatusUnauthorized, "Only available for PRO users") } // Retrieve file from post body diff --git a/pages/user/edit.go b/pages/user/edit.go index 988bb31a..b07355d7 100644 --- a/pages/user/edit.go +++ b/pages/user/edit.go @@ -15,7 +15,7 @@ func Edit(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil || user.Role != "admin" { - return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this user", nil) + return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this user") } viewUser, err := arn.GetUserByNick(nick) diff --git a/pages/user/user.go b/pages/user/user.go index fabf39f0..916609db 100644 --- a/pages/user/user.go +++ b/pages/user/user.go @@ -13,11 +13,11 @@ func Get(ctx *aero.Context) string { user := utils.GetUser(ctx) if user == nil { - return ctx.Error(http.StatusBadRequest, "Not logged in", nil) + return ctx.Error(http.StatusBadRequest, "Not logged in") } if user.Nick == "" { - return ctx.Error(http.StatusInternalServerError, "User did not set a nickname", nil) + return ctx.Error(http.StatusInternalServerError, "User did not set a nickname") } return profile.Profile(ctx, user)