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'
|
2022-07-22 14:36:45 +00:00
|
|
|
import BubbleTimeline from 'components/bubble_timeline/bubble_timeline.vue'
|
2020-07-03 19:45:49 +00:00
|
|
|
import BookmarkTimeline from 'components/bookmark_timeline/bookmark_timeline.vue'
|
2018-12-06 01:05:35 +00:00
|
|
|
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 Registration from 'components/registration/registration.vue'
|
2019-09-05 11:23:28 +00:00
|
|
|
import PasswordReset from 'components/password_reset/password_reset.vue'
|
2018-12-06 01:05:35 +00:00
|
|
|
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'
|
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'
|
2019-11-08 22:27:25 +00:00
|
|
|
import RemoteUserResolver from 'components/remote_user_resolver/remote_user_resolver.vue'
|
2022-06-15 16:13:33 +00:00
|
|
|
import Lists from 'components/lists/lists.vue'
|
2022-06-15 14:12:05 +00:00
|
|
|
import ListTimeline from 'components/list_timeline/list_timeline.vue'
|
2022-06-16 02:41:43 +00:00
|
|
|
import ListEdit from 'components/list_edit/list_edit.vue'
|
2022-07-18 13:08:50 +00:00
|
|
|
import AnnouncementsPage from 'components/announcements_page/announcements_page.vue'
|
2022-11-22 14:44:44 +00:00
|
|
|
import RegistrationRequestSent from 'components/registration_request_sent/registration_request_sent.vue'
|
|
|
|
import AwaitingEmailConfirmation from 'components/awaiting_email_confirmation/awaiting_email_confirmation.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')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 13:10:53 +00:00
|
|
|
let routes = [
|
2018-12-03 18:36:59 +00:00
|
|
|
{ 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 },
|
2022-07-22 14:36:45 +00:00
|
|
|
{ name: 'bubble-timeline', path: '/main/bubble', component: BubbleTimeline },
|
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 },
|
2020-07-03 19:45:49 +00:00
|
|
|
{ name: 'bookmarks', path: '/bookmarks', component: BookmarkTimeline },
|
2018-12-25 17:43:52 +00:00
|
|
|
{ name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
|
2019-11-08 22:27:25 +00:00
|
|
|
{ name: 'remote-user-profile-acct',
|
2022-03-22 17:20:12 +00:00
|
|
|
path: '/remote-users/:_(@)?:username([^/@]+)@:hostname([^/@]+)',
|
2019-11-08 22:27:25 +00:00
|
|
|
component: RemoteUserResolver,
|
|
|
|
beforeEnter: validateAuthenticatedRoute
|
|
|
|
},
|
|
|
|
{ name: 'remote-user-profile',
|
|
|
|
path: '/remote-users/:hostname/:username',
|
|
|
|
component: RemoteUserResolver,
|
|
|
|
beforeEnter: validateAuthenticatedRoute
|
|
|
|
},
|
2022-08-11 17:25:43 +00:00
|
|
|
{ name: 'external-user-profile', path: '/users/:id', component: UserProfile, meta: { dontScroll: true } },
|
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: 'registration', path: '/registration', component: Registration },
|
2022-11-22 14:44:44 +00:00
|
|
|
{ name: 'registration-request-sent', path: '/registration-request-sent', component: RegistrationRequestSent },
|
|
|
|
{ name: 'awaiting-email-confirmation', path: '/awaiting-email-confirmation', component: AwaitingEmailConfirmation },
|
2019-10-16 10:00:26 +00:00
|
|
|
{ name: 'password-reset', path: '/password-reset', component: PasswordReset, props: true },
|
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 },
|
2022-06-07 13:52:03 +00:00
|
|
|
{ name: 'notifications', path: '/:username/notifications', component: Notifications, props: () => ({ disableTeleport: true }), beforeEnter: validateAuthenticatedRoute },
|
2019-06-12 20:16:55 +00:00
|
|
|
{ name: 'login', path: '/login', component: AuthForm },
|
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 },
|
2022-06-15 16:13:33 +00:00
|
|
|
{ name: 'lists', path: '/lists', component: Lists },
|
2022-06-16 02:41:43 +00:00
|
|
|
{ name: 'list-timeline', path: '/lists/:id', component: ListTimeline },
|
2022-07-18 13:08:50 +00:00
|
|
|
{ name: 'list-edit', path: '/lists/:id/edit', component: ListEdit },
|
|
|
|
{ name: 'announcements', path: '/announcements', component: AnnouncementsPage },
|
2022-08-11 17:25:43 +00:00
|
|
|
{ name: 'user-profile', path: '/:_(users)?/:name', component: UserProfile, meta: { dontScroll: true } }
|
2018-12-03 18:36:59 +00:00
|
|
|
]
|
2020-05-07 13:10:53 +00:00
|
|
|
|
|
|
|
return routes
|
2018-12-03 18:36:59 +00:00
|
|
|
}
|