logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

routes.js (6056B)


  1. import PublicTimeline from 'components/public_timeline/public_timeline.vue'
  2. import PublicAndExternalTimeline from 'components/public_and_external_timeline/public_and_external_timeline.vue'
  3. import FriendsTimeline from 'components/friends_timeline/friends_timeline.vue'
  4. import TagTimeline from 'components/tag_timeline/tag_timeline.vue'
  5. import BookmarkTimeline from 'components/bookmark_timeline/bookmark_timeline.vue'
  6. import ConversationPage from 'components/conversation-page/conversation-page.vue'
  7. import Interactions from 'components/interactions/interactions.vue'
  8. import DMs from 'components/dm_timeline/dm_timeline.vue'
  9. import ChatList from 'components/chat_list/chat_list.vue'
  10. import Chat from 'components/chat/chat.vue'
  11. import UserProfile from 'components/user_profile/user_profile.vue'
  12. import Search from 'components/search/search.vue'
  13. import Registration from 'components/registration/registration.vue'
  14. import PasswordReset from 'components/password_reset/password_reset.vue'
  15. import FollowRequests from 'components/follow_requests/follow_requests.vue'
  16. import OAuthCallback from 'components/oauth_callback/oauth_callback.vue'
  17. import Notifications from 'components/notifications/notifications.vue'
  18. import AuthForm from 'components/auth_form/auth_form.js'
  19. import ShoutPanel from 'components/shout_panel/shout_panel.vue'
  20. import WhoToFollow from 'components/who_to_follow/who_to_follow.vue'
  21. import About from 'components/about/about.vue'
  22. import RemoteUserResolver from 'components/remote_user_resolver/remote_user_resolver.vue'
  23. import Lists from 'components/lists/lists.vue'
  24. import ListsTimeline from 'components/lists_timeline/lists_timeline.vue'
  25. import ListsEdit from 'components/lists_edit/lists_edit.vue'
  26. import NavPanel from 'src/components/nav_panel/nav_panel.vue'
  27. import AnnouncementsPage from 'components/announcements_page/announcements_page.vue'
  28. import QuotesTimeline from '../components/quotes_timeline/quotes_timeline.vue'
  29. export default (store) => {
  30. const validateAuthenticatedRoute = (to, from, next) => {
  31. if (store.state.users.currentUser) {
  32. next()
  33. } else {
  34. next(store.state.instance.redirectRootNoLogin || '/main/all')
  35. }
  36. }
  37. let routes = [
  38. {
  39. name: 'root',
  40. path: '/',
  41. redirect: _to => {
  42. return (store.state.users.currentUser
  43. ? store.state.instance.redirectRootLogin
  44. : store.state.instance.redirectRootNoLogin) || '/main/all'
  45. }
  46. },
  47. { name: 'public-external-timeline', path: '/main/all', component: PublicAndExternalTimeline },
  48. { name: 'public-timeline', path: '/main/public', component: PublicTimeline },
  49. { name: 'friends', path: '/main/friends', component: FriendsTimeline, beforeEnter: validateAuthenticatedRoute },
  50. { name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline },
  51. { name: 'bookmarks', path: '/bookmarks', component: BookmarkTimeline },
  52. { name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
  53. { name: 'quotes', path: '/notice/:id/quotes', component: QuotesTimeline },
  54. {
  55. name: 'remote-user-profile-acct',
  56. path: '/remote-users/:_(@)?:username([^/@]+)@:hostname([^/@]+)',
  57. component: RemoteUserResolver,
  58. beforeEnter: validateAuthenticatedRoute
  59. },
  60. {
  61. name: 'remote-user-profile',
  62. path: '/remote-users/:hostname/:username',
  63. component: RemoteUserResolver,
  64. beforeEnter: validateAuthenticatedRoute
  65. },
  66. { name: 'external-user-profile', path: '/users/$:id', component: UserProfile },
  67. { name: 'interactions', path: '/users/:username/interactions', component: Interactions, beforeEnter: validateAuthenticatedRoute },
  68. { name: 'dms', path: '/users/:username/dms', component: DMs, beforeEnter: validateAuthenticatedRoute },
  69. { name: 'registration', path: '/registration', component: Registration },
  70. { name: 'password-reset', path: '/password-reset', component: PasswordReset, props: true },
  71. { name: 'registration-token', path: '/registration/:token', component: Registration },
  72. { name: 'friend-requests', path: '/friend-requests', component: FollowRequests, beforeEnter: validateAuthenticatedRoute },
  73. { name: 'notifications', path: '/:username/notifications', component: Notifications, props: () => ({ disableTeleport: true }), beforeEnter: validateAuthenticatedRoute },
  74. { name: 'login', path: '/login', component: AuthForm },
  75. { name: 'shout-panel', path: '/shout-panel', component: ShoutPanel, props: () => ({ floating: false }) },
  76. { name: 'oauth-callback', path: '/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) },
  77. { name: 'search', path: '/search', component: Search, props: (route) => ({ query: route.query.query }) },
  78. { name: 'who-to-follow', path: '/who-to-follow', component: WhoToFollow, beforeEnter: validateAuthenticatedRoute },
  79. { name: 'about', path: '/about', component: About },
  80. { name: 'announcements', path: '/announcements', component: AnnouncementsPage },
  81. { name: 'user-profile', path: '/users/:name', component: UserProfile },
  82. { name: 'legacy-user-profile', path: '/:name', component: UserProfile },
  83. { name: 'lists', path: '/lists', component: Lists },
  84. { name: 'lists-timeline', path: '/lists/:id', component: ListsTimeline },
  85. { name: 'lists-edit', path: '/lists/:id/edit', component: ListsEdit },
  86. { name: 'lists-new', path: '/lists/new', component: ListsEdit },
  87. { name: 'edit-navigation', path: '/nav-edit', component: NavPanel, props: () => ({ forceExpand: true, forceEditMode: true }), beforeEnter: validateAuthenticatedRoute }
  88. ]
  89. if (store.state.instance.pleromaChatMessagesAvailable) {
  90. routes = routes.concat([
  91. { name: 'chat', path: '/users/:username/chats/:recipient_id', component: Chat, meta: { dontScroll: false }, beforeEnter: validateAuthenticatedRoute },
  92. { name: 'chats', path: '/users/:username/chats', component: ChatList, meta: { dontScroll: false }, beforeEnter: validateAuthenticatedRoute }
  93. ])
  94. }
  95. return routes
  96. }