2018-12-06 01:05:35 +00: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'
|
|
|
|
import ConversationPage from 'components/conversation-page/conversation-page.vue'
|
2019-05-14 19:38:16 +00:00
|
|
|
import Interactions from 'components/interactions/interactions.vue'
|
2018-12-06 01:05:35 +00:00
|
|
|
import DMs from 'components/dm_timeline/dm_timeline.vue'
|
|
|
|
import UserProfile from 'components/user_profile/user_profile.vue'
|
2019-07-15 16:42:27 +00:00
|
|
|
import Search from 'components/search/search.vue'
|
2018-12-06 01:05:35 +00:00
|
|
|
import Settings from 'components/settings/settings.vue'
|
|
|
|
import Registration from 'components/registration/registration.vue'
|
|
|
|
import UserSettings from 'components/user_settings/user_settings.vue'
|
|
|
|
import FollowRequests from 'components/follow_requests/follow_requests.vue'
|
|
|
|
import OAuthCallback from 'components/oauth_callback/oauth_callback.vue'
|
2018-12-28 19:39:54 +00:00
|
|
|
import Notifications from 'components/notifications/notifications.vue'
|
2019-06-12 20:16:55 +00:00
|
|
|
import AuthForm from 'components/auth_form/auth_form.js'
|
2018-12-28 19:39:54 +00:00
|
|
|
import ChatPanel from 'components/chat_panel/chat_panel.vue'
|
2019-01-16 02:33:08 +00:00
|
|
|
import WhoToFollow from 'components/who_to_follow/who_to_follow.vue'
|
2019-01-07 17:26:47 +00:00
|
|
|
import About from 'components/about/about.vue'
|
2018-12-03 18:36:59 +00:00
|
|
|
|
|
|
|
export default (store) => {
|
2019-07-24 00:54:15 +00:00
|
|
|
const validateAuthenticatedRoute = (to, from, next) => {
|
|
|
|
if (store.state.users.currentUser) {
|
|
|
|
next()
|
|
|
|
} else {
|
|
|
|
next(store.state.instance.redirectRootNoLogin || '/main/all')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-03 18:36:59 +00:00
|
|
|
return [
|
|
|
|
{ name: 'root',
|
|
|
|
path: '/',
|
|
|
|
redirect: _to => {
|
|
|
|
return (store.state.users.currentUser
|
2019-07-05 07:02:14 +00:00
|
|
|
? store.state.instance.redirectRootLogin
|
|
|
|
: store.state.instance.redirectRootNoLogin) || '/main/all'
|
2018-12-03 18:36:59 +00:00
|
|
|
}
|
|
|
|
},
|
2018-12-25 17:43:52 +00:00
|
|
|
{ name: 'public-external-timeline', path: '/main/all', component: PublicAndExternalTimeline },
|
|
|
|
{ name: 'public-timeline', path: '/main/public', component: PublicTimeline },
|
2019-07-24 00:54:15 +00:00
|
|
|
{ name: 'friends', path: '/main/friends', component: FriendsTimeline, beforeEnter: validateAuthenticatedRoute },
|
2018-12-25 17:43:52 +00:00
|
|
|
{ name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline },
|
|
|
|
{ name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
|
|
|
|
{ name: 'external-user-profile', path: '/users/:id', component: UserProfile },
|
2019-07-24 00:54:15 +00:00
|
|
|
{ name: 'interactions', path: '/users/:username/interactions', component: Interactions, beforeEnter: validateAuthenticatedRoute },
|
|
|
|
{ name: 'dms', path: '/users/:username/dms', component: DMs, beforeEnter: validateAuthenticatedRoute },
|
2018-12-25 17:43:52 +00:00
|
|
|
{ name: 'settings', path: '/settings', component: Settings },
|
|
|
|
{ name: 'registration', path: '/registration', component: Registration },
|
2019-01-27 09:13:32 +00:00
|
|
|
{ name: 'registration-token', path: '/registration/:token', component: Registration },
|
2019-07-24 00:54:15 +00:00
|
|
|
{ name: 'friend-requests', path: '/friend-requests', component: FollowRequests, beforeEnter: validateAuthenticatedRoute },
|
|
|
|
{ name: 'user-settings', path: '/user-settings', component: UserSettings, beforeEnter: validateAuthenticatedRoute },
|
2019-07-24 01:52:24 +00:00
|
|
|
{ name: 'notifications', path: '/:username/notifications', component: Notifications, beforeEnter: validateAuthenticatedRoute },
|
2019-06-12 20:16:55 +00:00
|
|
|
{ name: 'login', path: '/login', component: AuthForm },
|
2018-12-29 14:25:45 +00:00
|
|
|
{ name: 'chat', path: '/chat', component: ChatPanel, props: () => ({ floating: false }) },
|
2018-12-25 17:43:52 +00:00
|
|
|
{ name: 'oauth-callback', path: '/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) },
|
2019-07-15 16:42:27 +00:00
|
|
|
{ name: 'search', path: '/search', component: Search, props: (route) => ({ query: route.query.query }) },
|
2019-07-24 01:52:24 +00:00
|
|
|
{ name: 'who-to-follow', path: '/who-to-follow', component: WhoToFollow, beforeEnter: validateAuthenticatedRoute },
|
2019-01-07 17:26:47 +00:00
|
|
|
{ name: 'about', path: '/about', component: About },
|
2018-12-25 17:43:52 +00:00
|
|
|
{ name: 'user-profile', path: '/(users/)?:name', component: UserProfile }
|
2018-12-03 18:36:59 +00:00
|
|
|
]
|
|
|
|
}
|