211 lines
7.9 KiB
Go
Raw Normal View History

2017-11-07 15:49:56 +00:00
package pages
import (
"github.com/aerogo/aero"
2017-11-11 14:09:30 +00:00
"github.com/aerogo/layout"
2017-11-07 15:49:56 +00:00
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
2017-11-11 14:09:30 +00:00
"github.com/animenotifier/notify.moe/layout"
2017-11-07 15:49:56 +00:00
"github.com/animenotifier/notify.moe/pages/admin"
"github.com/animenotifier/notify.moe/pages/anime"
"github.com/animenotifier/notify.moe/pages/animelist"
"github.com/animenotifier/notify.moe/pages/animelistitem"
"github.com/animenotifier/notify.moe/pages/apiview"
2017-11-22 10:51:59 +00:00
"github.com/animenotifier/notify.moe/pages/calendar"
2017-11-07 15:49:56 +00:00
"github.com/animenotifier/notify.moe/pages/character"
"github.com/animenotifier/notify.moe/pages/charge"
2017-11-18 10:46:17 +00:00
"github.com/animenotifier/notify.moe/pages/companies"
2017-11-18 10:28:53 +00:00
"github.com/animenotifier/notify.moe/pages/company"
2017-11-07 15:49:56 +00:00
"github.com/animenotifier/notify.moe/pages/compare"
"github.com/animenotifier/notify.moe/pages/database"
"github.com/animenotifier/notify.moe/pages/editanime"
"github.com/animenotifier/notify.moe/pages/editor"
"github.com/animenotifier/notify.moe/pages/embed"
"github.com/animenotifier/notify.moe/pages/explore"
"github.com/animenotifier/notify.moe/pages/forum"
"github.com/animenotifier/notify.moe/pages/genre"
2017-11-30 01:59:19 +00:00
"github.com/animenotifier/notify.moe/pages/genres"
2017-11-07 15:49:56 +00:00
"github.com/animenotifier/notify.moe/pages/group"
"github.com/animenotifier/notify.moe/pages/groups"
"github.com/animenotifier/notify.moe/pages/home"
"github.com/animenotifier/notify.moe/pages/inventory"
"github.com/animenotifier/notify.moe/pages/listimport"
"github.com/animenotifier/notify.moe/pages/listimport/listimportanilist"
"github.com/animenotifier/notify.moe/pages/listimport/listimportkitsu"
"github.com/animenotifier/notify.moe/pages/listimport/listimportmyanimelist"
"github.com/animenotifier/notify.moe/pages/login"
"github.com/animenotifier/notify.moe/pages/me"
"github.com/animenotifier/notify.moe/pages/newthread"
"github.com/animenotifier/notify.moe/pages/notifications"
"github.com/animenotifier/notify.moe/pages/paypal"
2017-11-16 15:38:49 +00:00
"github.com/animenotifier/notify.moe/pages/popular"
2017-11-07 15:49:56 +00:00
"github.com/animenotifier/notify.moe/pages/posts"
"github.com/animenotifier/notify.moe/pages/profile"
"github.com/animenotifier/notify.moe/pages/search"
"github.com/animenotifier/notify.moe/pages/settings"
"github.com/animenotifier/notify.moe/pages/shop"
"github.com/animenotifier/notify.moe/pages/soundtrack"
"github.com/animenotifier/notify.moe/pages/soundtracks"
"github.com/animenotifier/notify.moe/pages/statistics"
2017-11-17 11:08:16 +00:00
"github.com/animenotifier/notify.moe/pages/terms"
2017-11-07 15:49:56 +00:00
"github.com/animenotifier/notify.moe/pages/threads"
"github.com/animenotifier/notify.moe/pages/user"
"github.com/animenotifier/notify.moe/pages/users"
)
// Configure registers the page routes in the application.
func Configure(app *aero.Application) {
2017-11-11 14:14:16 +00:00
l := layout.New(app)
2017-11-11 14:09:30 +00:00
// Set render function for the layout
2017-11-11 14:14:16 +00:00
l.Render = fullpage.Render
2017-11-11 14:09:30 +00:00
2017-11-07 15:49:56 +00:00
// Main menu
2017-11-11 14:14:16 +00:00
l.Page("/", home.Get)
l.Page("/explore", explore.Get)
l.Page("/explore/anime/:year/:status/:type", explore.Filter)
l.Page("/login", login.Get)
l.Page("/api", apiview.Get)
// l.Ajax("/dashboard", dashboard.Get)
// l.Ajax("/best/anime", best.Get)
// l.Ajax("/artworks", artworks.Get)
// l.Ajax("/amvs", amvs.Get)
2017-11-07 15:49:56 +00:00
// Forum
2017-11-13 12:34:08 +00:00
l.Page("/forum", forum.Get)
2017-11-11 14:14:16 +00:00
l.Page("/forum/:tag", forum.Get)
l.Page("/thread/:id", threads.Get)
l.Page("/post/:id", posts.Get)
l.Page("/new/thread", newthread.Get)
2017-11-07 15:49:56 +00:00
// User lists
2017-11-11 14:14:16 +00:00
l.Page("/users", users.Active)
2017-11-30 15:40:52 +00:00
l.Page("/users/noavatar", users.ActiveNoAvatar)
2017-11-11 14:14:16 +00:00
l.Page("/users/osu", users.Osu)
2017-11-30 15:40:52 +00:00
l.Page("/users/overwatch", users.Overwatch)
2017-11-11 14:14:16 +00:00
l.Page("/users/staff", users.Staff)
2017-11-07 15:49:56 +00:00
// Statistics
2017-11-11 14:14:16 +00:00
l.Page("/statistics", statistics.Get)
l.Page("/statistics/anime", statistics.Anime)
2017-11-07 15:49:56 +00:00
// Anime
2017-11-11 14:14:16 +00:00
l.Page("/anime/:id", anime.Get)
l.Page("/anime/:id/episodes", anime.Episodes)
l.Page("/anime/:id/characters", anime.Characters)
l.Page("/anime/:id/tracks", anime.Tracks)
l.Page("/anime/:id/edit", editanime.Get)
2017-11-07 15:49:56 +00:00
// Characters
2017-11-11 14:14:16 +00:00
l.Page("/character/:id", character.Get)
2017-11-07 15:49:56 +00:00
2017-11-22 10:51:59 +00:00
// Calendar
l.Page("/calendar", calendar.Get)
2017-11-18 10:28:53 +00:00
// Companies
l.Page("/company/:id", company.Get)
2017-11-19 00:15:57 +00:00
l.Page("/company/:id/edit", company.Edit)
2017-11-18 10:46:17 +00:00
l.Page("/companies", companies.Get)
2017-11-18 10:28:53 +00:00
2017-11-07 15:49:56 +00:00
// Settings
2017-11-11 14:14:16 +00:00
l.Page("/settings", settings.Get(components.SettingsPersonal))
l.Page("/settings/accounts", settings.Get(components.SettingsAccounts))
l.Page("/settings/notifications", settings.Get(components.SettingsNotifications))
l.Page("/settings/apps", settings.Get(components.SettingsApps))
l.Page("/settings/formatting", settings.Get(components.SettingsFormatting))
l.Page("/settings/pro", settings.Get(components.SettingsPro))
2017-11-07 15:49:56 +00:00
// Soundtracks
2017-11-19 16:02:20 +00:00
l.Page("/soundtracks", soundtracks.Latest)
l.Page("/soundtracks/from/:index", soundtracks.LatestFrom)
l.Page("/soundtracks/best", soundtracks.Best)
l.Page("/soundtracks/best/from/:index", soundtracks.BestFrom)
2017-11-11 14:14:16 +00:00
l.Page("/soundtrack/:id", soundtrack.Get)
l.Page("/soundtrack/:id/edit", soundtrack.Edit)
2017-11-07 15:49:56 +00:00
// Groups
2017-11-11 14:14:16 +00:00
l.Page("/groups", groups.Get)
l.Page("/group/:id", group.Get)
l.Page("/group/:id/edit", group.Edit)
l.Page("/group/:id/forum", group.Forum)
2017-11-07 15:49:56 +00:00
// User profiles
2017-11-11 14:14:16 +00:00
l.Page("/user", user.Get)
l.Page("/user/:nick", profile.Get)
l.Page("/user/:nick/forum/threads", profile.GetThreadsByUser)
l.Page("/user/:nick/forum/posts", profile.GetPostsByUser)
2017-11-11 14:14:16 +00:00
l.Page("/user/:nick/soundtracks", profile.GetSoundTracksByUser)
l.Page("/user/:nick/stats", profile.GetStatsByUser)
l.Page("/user/:nick/followers", profile.GetFollowers)
l.Page("/user/:nick/animelist", animelist.Get)
l.Page("/user/:nick/animelist/watching", animelist.FilterByStatus(arn.AnimeListStatusWatching))
l.Page("/user/:nick/animelist/completed", animelist.FilterByStatus(arn.AnimeListStatusCompleted))
l.Page("/user/:nick/animelist/planned", animelist.FilterByStatus(arn.AnimeListStatusPlanned))
l.Page("/user/:nick/animelist/hold", animelist.FilterByStatus(arn.AnimeListStatusHold))
l.Page("/user/:nick/animelist/dropped", animelist.FilterByStatus(arn.AnimeListStatusDropped))
l.Page("/user/:nick/animelist/anime/:id", animelistitem.Get)
2017-11-07 15:49:56 +00:00
// Anime list
2017-11-11 14:14:16 +00:00
l.Page("/animelist/watching", home.FilterByStatus(arn.AnimeListStatusWatching))
l.Page("/animelist/completed", home.FilterByStatus(arn.AnimeListStatusCompleted))
l.Page("/animelist/planned", home.FilterByStatus(arn.AnimeListStatusPlanned))
l.Page("/animelist/hold", home.FilterByStatus(arn.AnimeListStatusHold))
l.Page("/animelist/dropped", home.FilterByStatus(arn.AnimeListStatusDropped))
2017-11-07 15:49:56 +00:00
// Compare
2017-11-11 14:14:16 +00:00
l.Page("/compare/animelist/:nick-1/:nick-2", compare.AnimeList)
2017-11-07 15:49:56 +00:00
// Search
2017-11-11 15:16:25 +00:00
l.Page("/search/*term", search.Get)
2017-11-07 15:49:56 +00:00
// Shop
2017-11-11 14:14:16 +00:00
l.Page("/shop", shop.Get)
l.Page("/inventory", inventory.Get)
l.Page("/charge", charge.Get)
l.Page("/shop/history", shop.PurchaseHistory)
2017-11-07 15:49:56 +00:00
app.Post("/api/shop/buy/:item/:quantity", shop.BuyItem)
// Admin
2017-11-11 14:14:16 +00:00
l.Page("/admin", admin.Get)
l.Page("/admin/webdev", admin.WebDev)
l.Page("/admin/purchases", admin.PurchaseHistory)
2017-11-07 15:49:56 +00:00
// Editor
2017-11-11 14:14:16 +00:00
l.Page("/editor", editor.Get)
l.Page("/editor/anilist", editor.AniList)
l.Page("/editor/shoboi", editor.Shoboi)
2017-11-07 15:49:56 +00:00
// Mixed
2017-11-11 14:14:16 +00:00
l.Page("/database", database.Get)
2017-11-07 15:49:56 +00:00
app.Get("/api/select/:data-type/where/:field/is/:field-value", database.Select)
// Import
2017-11-11 14:14:16 +00:00
l.Page("/import", listimport.Get)
l.Page("/import/anilist/animelist", listimportanilist.Preview)
l.Page("/import/anilist/animelist/finish", listimportanilist.Finish)
l.Page("/import/myanimelist/animelist", listimportmyanimelist.Preview)
l.Page("/import/myanimelist/animelist/finish", listimportmyanimelist.Finish)
l.Page("/import/kitsu/animelist", listimportkitsu.Preview)
l.Page("/import/kitsu/animelist/finish", listimportkitsu.Finish)
2017-11-07 15:49:56 +00:00
// Browser extension
2017-11-11 14:14:16 +00:00
l.Page("/extension/embed", embed.Get)
2017-11-07 15:49:56 +00:00
// API
app.Get("/api/me", me.Get)
2017-11-16 15:38:49 +00:00
app.Get("/api/popular/anime/titles/:count", popular.AnimeTitles)
2017-11-07 15:49:56 +00:00
app.Get("/api/test/notification", notifications.Test)
2017-11-17 11:08:16 +00:00
// Legal stuff
l.Page("/terms", terms.Get)
2017-11-07 15:49:56 +00:00
// PayPal
2017-11-11 14:14:16 +00:00
l.Page("/paypal/success", paypal.Success)
l.Page("/paypal/cancel", paypal.Cancel)
2017-11-07 15:49:56 +00:00
app.Post("/api/paypal/payment/create", paypal.CreatePayment)
// Genres
2017-11-30 01:59:19 +00:00
l.Page("/genres", genres.Get)
l.Page("/genre/:name", genre.Get)
2017-11-07 15:49:56 +00:00
}