2018-12-06 02:05:35 +01:00
|
|
|
import PublicTimeline from 'components/public_timeline/public_timeline.vue'
|
|
|
|
import PublicAndExternalTimeline from 'components/public_and_external_timeline/public_and_external_timeline.vue'
|
|
|
|
import FriendsTimeline from 'components/friends_timeline/friends_timeline.vue'
|
|
|
|
import TagTimeline from 'components/tag_timeline/tag_timeline.vue'
|
2020-07-03 21:45:49 +02:00
|
|
|
import BookmarkTimeline from 'components/bookmark_timeline/bookmark_timeline.vue'
|
2018-12-06 02:05:35 +01:00
|
|
|
import ConversationPage from 'components/conversation-page/conversation-page.vue'
|
2019-05-14 21:38:16 +02:00
|
|
|
import Interactions from 'components/interactions/interactions.vue'
|
2018-12-06 02:05:35 +01:00
|
|
|
import DMs from 'components/dm_timeline/dm_timeline.vue'
|
2020-05-07 15:10:53 +02:00
|
|
|
import ChatList from 'components/chat_list/chat_list.vue'
|
|
|
|
import Chat from 'components/chat/chat.vue'
|
2018-12-06 02:05:35 +01:00
|
|
|
import UserProfile from 'components/user_profile/user_profile.vue'
|
2019-07-15 18:42:27 +02:00
|
|
|
import Search from 'components/search/search.vue'
|
2018-12-06 02:05:35 +01:00
|
|
|
import Registration from 'components/registration/registration.vue'
|
2019-09-05 13:23:28 +02:00
|
|
|
import PasswordReset from 'components/password_reset/password_reset.vue'
|
2018-12-06 02:05:35 +01:00
|
|
|
import FollowRequests from 'components/follow_requests/follow_requests.vue'
|
|
|
|
import OAuthCallback from 'components/oauth_callback/oauth_callback.vue'
|
2018-12-28 20:39:54 +01:00
|
|
|
import Notifications from 'components/notifications/notifications.vue'
|
2019-06-12 22:16:55 +02:00
|
|
|
import AuthForm from 'components/auth_form/auth_form.js'
|
2020-08-04 01:44:35 +02:00
|
|
|
import ShoutPanel from 'components/shout_panel/shout_panel.vue'
|
2019-01-16 03:33:08 +01:00
|
|
|
import WhoToFollow from 'components/who_to_follow/who_to_follow.vue'
|
2019-01-07 18:26:47 +01:00
|
|
|
import About from 'components/about/about.vue'
|
2019-11-08 23:27:25 +01:00
|
|
|
import RemoteUserResolver from 'components/remote_user_resolver/remote_user_resolver.vue'
|
2022-08-06 16:26:43 +02:00
|
|
|
import Lists from 'components/lists/lists.vue'
|
|
|
|
import ListsTimeline from 'components/lists_timeline/lists_timeline.vue'
|
|
|
|
import ListsEdit from 'components/lists_edit/lists_edit.vue'
|
2022-08-12 00:00:41 +02:00
|
|
|
import NavPanel from 'src/components/nav_panel/nav_panel.vue'
|
2022-03-17 17:59:10 +01:00
|
|
|
import AnnouncementsPage from 'components/announcements_page/announcements_page.vue'
|
2018-12-03 19:36:59 +01:00
|
|
|
|
|
|
|
export default (store) => {
|
2019-07-24 02:54:15 +02:00
|
|
|
const validateAuthenticatedRoute = (to, from, next) => {
|
|
|
|
if (store.state.users.currentUser) {
|
|
|
|
next()
|
|
|
|
} else {
|
|
|
|
next(store.state.instance.redirectRootNoLogin || '/main/all')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 15:10:53 +02:00
|
|
|
let routes = [
|
2022-07-31 11:35:48 +02:00
|
|
|
{
|
|
|
|
name: 'root',
|
2018-12-03 19:36:59 +01:00
|
|
|
path: '/',
|
|
|
|
redirect: _to => {
|
|
|
|
return (store.state.users.currentUser
|
2019-07-05 09:02:14 +02:00
|
|
|
? store.state.instance.redirectRootLogin
|
|
|
|
: store.state.instance.redirectRootNoLogin) || '/main/all'
|
2018-12-03 19:36:59 +01:00
|
|
|
}
|
|
|
|
},
|
2018-12-25 18:43:52 +01:00
|
|
|
{ name: 'public-external-timeline', path: '/main/all', component: PublicAndExternalTimeline },
|
|
|
|
{ name: 'public-timeline', path: '/main/public', component: PublicTimeline },
|
2019-07-24 02:54:15 +02:00
|
|
|
{ name: 'friends', path: '/main/friends', component: FriendsTimeline, beforeEnter: validateAuthenticatedRoute },
|
2018-12-25 18:43:52 +01:00
|
|
|
{ name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline },
|
2020-07-03 21:45:49 +02:00
|
|
|
{ name: 'bookmarks', path: '/bookmarks', component: BookmarkTimeline },
|
2018-12-25 18:43:52 +01:00
|
|
|
{ name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
|
2022-07-31 11:35:48 +02:00
|
|
|
{
|
|
|
|
name: 'remote-user-profile-acct',
|
2022-03-22 18:20:12 +01:00
|
|
|
path: '/remote-users/:_(@)?:username([^/@]+)@:hostname([^/@]+)',
|
2019-11-08 23:27:25 +01:00
|
|
|
component: RemoteUserResolver,
|
|
|
|
beforeEnter: validateAuthenticatedRoute
|
|
|
|
},
|
2022-07-31 11:35:48 +02:00
|
|
|
{
|
|
|
|
name: 'remote-user-profile',
|
2019-11-08 23:27:25 +01:00
|
|
|
path: '/remote-users/:hostname/:username',
|
|
|
|
component: RemoteUserResolver,
|
|
|
|
beforeEnter: validateAuthenticatedRoute
|
|
|
|
},
|
2022-08-10 03:49:40 +02:00
|
|
|
{ name: 'external-user-profile', path: '/users/$:id', component: UserProfile },
|
2019-07-24 02:54:15 +02:00
|
|
|
{ name: 'interactions', path: '/users/:username/interactions', component: Interactions, beforeEnter: validateAuthenticatedRoute },
|
|
|
|
{ name: 'dms', path: '/users/:username/dms', component: DMs, beforeEnter: validateAuthenticatedRoute },
|
2018-12-25 18:43:52 +01:00
|
|
|
{ name: 'registration', path: '/registration', component: Registration },
|
2019-10-16 12:00:26 +02:00
|
|
|
{ name: 'password-reset', path: '/password-reset', component: PasswordReset, props: true },
|
2019-01-27 10:13:32 +01:00
|
|
|
{ name: 'registration-token', path: '/registration/:token', component: Registration },
|
2019-07-24 02:54:15 +02:00
|
|
|
{ name: 'friend-requests', path: '/friend-requests', component: FollowRequests, beforeEnter: validateAuthenticatedRoute },
|
2022-06-07 15:52:03 +02:00
|
|
|
{ name: 'notifications', path: '/:username/notifications', component: Notifications, props: () => ({ disableTeleport: true }), beforeEnter: validateAuthenticatedRoute },
|
2019-06-12 22:16:55 +02:00
|
|
|
{ name: 'login', path: '/login', component: AuthForm },
|
2020-08-04 01:44:35 +02:00
|
|
|
{ name: 'shout-panel', path: '/shout-panel', component: ShoutPanel, props: () => ({ floating: false }) },
|
2018-12-25 18:43:52 +01:00
|
|
|
{ name: 'oauth-callback', path: '/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) },
|
2019-07-15 18:42:27 +02:00
|
|
|
{ name: 'search', path: '/search', component: Search, props: (route) => ({ query: route.query.query }) },
|
2019-07-24 03:52:24 +02:00
|
|
|
{ name: 'who-to-follow', path: '/who-to-follow', component: WhoToFollow, beforeEnter: validateAuthenticatedRoute },
|
2019-01-07 18:26:47 +01:00
|
|
|
{ name: 'about', path: '/about', component: About },
|
2022-03-17 17:59:10 +01:00
|
|
|
{ name: 'announcements', path: '/announcements', component: AnnouncementsPage },
|
2022-08-10 03:49:40 +02:00
|
|
|
{ name: 'user-profile', path: '/users/:name', component: UserProfile },
|
|
|
|
{ name: 'legacy-user-profile', path: '/:name', component: UserProfile },
|
2022-08-06 16:26:43 +02:00
|
|
|
{ name: 'lists', path: '/lists', component: Lists },
|
2022-08-06 20:39:08 +02:00
|
|
|
{ name: 'lists-timeline', path: '/lists/:id', component: ListsTimeline },
|
2022-08-12 00:00:41 +02:00
|
|
|
{ name: 'lists-edit', path: '/lists/:id/edit', component: ListsEdit },
|
2022-08-17 20:25:02 +02:00
|
|
|
{ name: 'lists-new', path: '/lists/new', component: ListsEdit },
|
2022-08-15 20:56:07 +02:00
|
|
|
{ name: 'edit-navigation', path: '/nav-edit', component: NavPanel, props: () => ({ forceExpand: true, forceEditMode: true }), beforeEnter: validateAuthenticatedRoute }
|
2018-12-03 19:36:59 +01:00
|
|
|
]
|
2020-05-07 15:10:53 +02:00
|
|
|
|
|
|
|
if (store.state.instance.pleromaChatMessagesAvailable) {
|
|
|
|
routes = routes.concat([
|
|
|
|
{ name: 'chat', path: '/users/:username/chats/:recipient_id', component: Chat, meta: { dontScroll: false }, beforeEnter: validateAuthenticatedRoute },
|
|
|
|
{ name: 'chats', path: '/users/:username/chats', component: ChatList, meta: { dontScroll: false }, beforeEnter: validateAuthenticatedRoute }
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
return routes
|
2018-12-03 19:36:59 +01:00
|
|
|
}
|