diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 6e87d5f6..08c00c64 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -168,6 +168,8 @@ const afterStoreSetup = ({ store, i18n }) => { store.dispatch('setInstanceOption', { name: 'chatAvailable', value: features.includes('chat') }) store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') }) + store.dispatch('setInstanceOption', { name: 'restrictedNicknames', value: metadata.restrictedNicknames }) + const suggestions = metadata.suggestions store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled }) store.dispatch('setInstanceOption', { name: 'suggestionsWeb', value: suggestions.web }) diff --git a/src/boot/routes.js b/src/boot/routes.js index 4de0e104..e892839c 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -24,52 +24,28 @@ export default (store) => { redirect: _to => { return (store.state.users.currentUser ? store.state.instance.redirectRootLogin - : store.state.instance.redirectRootNoLogin) || '/~/main/all' + : store.state.instance.redirectRootNoLogin) || '/main/all' } }, - { name: 'public-external-timeline', path: '/~/main/all', component: PublicAndExternalTimeline }, - { name: 'public-timeline', path: '/~/main/public', component: PublicTimeline }, - { name: 'friends', path: '/~/main/friends', component: FriendsTimeline }, - // Beginning of temporary redirects - { path: '/main/:route', - redirect: to => { - const { params } = to - const route = params.route ? params.route : 'all' - - return { path: `/~/main/${route}` } - } - }, - { path: '/tag/:tag', - redirect: to => { - const { params } = to - - return { path: `/~/tag/${params.tag}` } - } - }, - { path: '/notice/:id', - redirect: to => { - const { params } = to - - return { path: `/~/notice/${params.id}` } - } - }, - // End of temporary redirects - { name: 'tag-timeline', path: '/~/tag/:tag', component: TagTimeline }, - { name: 'conversation', path: '/~/notice/:id', component: ConversationPage, meta: { dontScroll: true } }, - { name: 'user-profile', path: '/:name', component: UserProfile }, - { name: 'external-user-profile', path: '/~/users/:id', component: UserProfile }, - { name: 'mentions', path: '/:username/mentions', component: Mentions }, - { name: 'dms', path: '/:username/dms', component: DMs }, - { name: 'settings', path: '/~/settings', component: Settings }, - { name: 'registration', path: '/~/registration', component: Registration }, - { name: 'registration', path: '/~/registration/:token', component: Registration }, - { name: 'friend-requests', path: '/~/friend-requests', component: FollowRequests }, - { name: 'user-settings', path: '/~/user-settings', component: UserSettings }, - { name: 'oauth-callback', path: '/~/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) }, - { name: 'user-search', path: '/~/user-search', component: UserSearch, props: (route) => ({ query: route.query.query }) }, + { name: 'public-external-timeline', path: '/main/all', component: PublicAndExternalTimeline }, + { name: 'public-timeline', path: '/main/public', component: PublicTimeline }, + { name: 'friends', path: '/main/friends', component: FriendsTimeline }, + { 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 }, + { name: 'mentions', path: '/users/:username/mentions', component: Mentions }, + { name: 'dms', path: '/users/:username/dms', component: DMs }, + { name: 'settings', path: '/settings', component: Settings }, + { name: 'registration', path: '/registration', component: Registration }, + { name: 'registration', path: '/registration/:token', component: Registration }, + { name: 'friend-requests', path: '/friend-requests', component: FollowRequests }, + { name: 'user-settings', path: '/user-settings', component: UserSettings }, { name: 'notifications', path: '/:username/notifications', component: Notifications }, { name: 'new-status', path: '/:username/new-status', component: UserPanel }, - { name: 'login', path: '/~/login', component: LoginForm }, - { name: 'chat', path: '/~/chat', component: ChatPanel, props: () => ({ floating: false }) } + { name: 'login', path: '/login', component: LoginForm }, + { name: 'chat', path: '/chat', component: ChatPanel, props: () => ({ floating: false }) }, + { name: 'oauth-callback', path: '/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) }, + { name: 'user-search', path: '/user-search', component: UserSearch, props: (route) => ({ query: route.query.query }) }, + { name: 'user-profile', path: '/(users/)?:name', component: UserProfile } ] } diff --git a/src/components/chat_panel/chat_panel.js b/src/components/chat_panel/chat_panel.js index d7238641..bbc9b49f 100644 --- a/src/components/chat_panel/chat_panel.js +++ b/src/components/chat_panel/chat_panel.js @@ -23,7 +23,7 @@ const chatPanel = { this.collapsed = !this.collapsed }, userProfileLink (user) { - return generateProfileLink(user.id, user.username) + return generateProfileLink(user.id, user.username, this.$store.state.instance.restrictedNicknames) } } } diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index 81426b44..013222a8 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -32,7 +32,7 @@ const LoginForm = { .then((result) => { this.$store.commit('setToken', result.access_token) this.$store.dispatch('loginUser', result.access_token) - this.$router.push('/~/main/friends') + this.$router.push({name: 'friends'}) }) }) } diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 8b48ef1d..f95a329f 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -20,7 +20,7 @@ const Notification = { this.userExpanded = !this.userExpanded }, userProfileLink (user) { - return generateProfileLink(user.id, user.screen_name) + return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames) } }, computed: { diff --git a/src/components/oauth_callback/oauth_callback.js b/src/components/oauth_callback/oauth_callback.js index 18e24159..e3d45ee1 100644 --- a/src/components/oauth_callback/oauth_callback.js +++ b/src/components/oauth_callback/oauth_callback.js @@ -11,7 +11,7 @@ const oac = { }).then((result) => { this.$store.commit('setToken', result.access_token) this.$store.dispatch('loginUser', result.access_token) - this.$router.push('/~/main/friends') + this.$router.push({name: 'friends'}) }) } } diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index dd8e6e5d..ab6cd64d 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -28,7 +28,7 @@ const registration = { }, created () { if ((!this.registrationOpen && !this.token) || this.signedIn) { - this.$router.push('/~/main/all') + this.$router.push({name: 'root'}) } this.setCaptcha() @@ -58,7 +58,7 @@ const registration = { if (!this.$v.$invalid) { try { await this.signUp(this.user) - this.$router.push('/~/main/friends') + this.$router.push({name: 'friends'}) } catch (error) { console.warn('Registration failed: ' + error) } diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue index b4613422..f5ccba67 100644 --- a/src/components/side_drawer/side_drawer.vue +++ b/src/components/side_drawer/side_drawer.vue @@ -8,7 +8,7 @@ @touchmove="touchMove" >