Use "~" as a route namespace symbol

This commit is contained in:
Maxim Filippov 2018-12-10 01:21:52 +03:00
parent 3d968e31da
commit ae8f0f36d8
9 changed files with 1321 additions and 663 deletions

View File

@ -20,23 +20,23 @@ export default (store) => {
redirect: _to => { redirect: _to => {
return (store.state.users.currentUser return (store.state.users.currentUser
? store.state.instance.redirectRootLogin ? store.state.instance.redirectRootLogin
: store.state.instance.redirectRootNoLogin) || '/p/main/all' : store.state.instance.redirectRootNoLogin) || '/~/main/all'
} }
}, },
{ name: 'public-external-timeline', path: '/p/main/all', component: PublicAndExternalTimeline }, { name: 'public-external-timeline', path: '/~/main/all', component: PublicAndExternalTimeline },
{ name: 'public-timeline', path: '/p/main/public', component: PublicTimeline }, { name: 'public-timeline', path: '/~/main/public', component: PublicTimeline },
{ name: 'friends', path: '/p/main/friends', component: FriendsTimeline }, { name: 'friends', path: '/~/main/friends', component: FriendsTimeline },
{ name: 'tag-timeline', path: '/p/tag/:tag', component: TagTimeline }, { name: 'tag-timeline', path: '/~/tag/:tag', component: TagTimeline },
{ name: 'conversation', path: '/p/notice/:id', component: ConversationPage, meta: { dontScroll: true } }, { name: 'conversation', path: '/~/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
{ name: 'user-profile', path: '/:name', component: UserProfile }, { name: 'user-profile', path: '/:name', component: UserProfile },
{ name: 'mentions', path: '/:username/mentions', component: Mentions }, { name: 'mentions', path: '/:username/mentions', component: Mentions },
{ name: 'dms', path: '/:username/dms', component: DMs }, { name: 'dms', path: '/:username/dms', component: DMs },
{ name: 'settings', path: '/p/settings', component: Settings }, { name: 'settings', path: '/~/settings', component: Settings },
{ name: 'registration', path: '/p/registration', component: Registration }, { name: 'registration', path: '/~/registration', component: Registration },
{ name: 'registration', path: '/p/registration/:token', component: Registration }, { name: 'registration', path: '/~/registration/:token', component: Registration },
{ name: 'friend-requests', path: '/p/friend-requests', component: FollowRequests }, { name: 'friend-requests', path: '/~/friend-requests', component: FollowRequests },
{ name: 'user-settings', path: '/p/user-settings', component: UserSettings }, { name: 'user-settings', path: '/~/user-settings', component: UserSettings },
{ name: 'oauth-callback', path: '/p/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) }, { name: 'oauth-callback', path: '/~/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) },
{ name: 'user-search', path: '/p/user-search', component: UserSearch, props: (route) => ({ query: route.query.query }) } { name: 'user-search', path: '/~/user-search', component: UserSearch, props: (route) => ({ query: route.query.query }) }
] ]
} }

View File

@ -32,7 +32,7 @@ const LoginForm = {
.then((result) => { .then((result) => {
this.$store.commit('setToken', result.access_token) this.$store.commit('setToken', result.access_token)
this.$store.dispatch('loginUser', result.access_token) this.$store.dispatch('loginUser', result.access_token)
this.$router.push('/p/main/friends') this.$router.push('/~/main/friends')
}) })
}) })
} }

View File

@ -11,7 +11,7 @@ const oac = {
}).then((result) => { }).then((result) => {
this.$store.commit('setToken', result.access_token) this.$store.commit('setToken', result.access_token)
this.$store.dispatch('loginUser', result.access_token) this.$store.dispatch('loginUser', result.access_token)
this.$router.push('/p/main/friends') this.$router.push('/~/main/friends')
}) })
} }
} }

View File

@ -27,7 +27,7 @@ const registration = {
}, },
created () { created () {
if ((!this.registrationOpen && !this.token) || this.signedIn) { if ((!this.registrationOpen && !this.token) || this.signedIn) {
this.$router.push('/p/main/all') this.$router.push('/~/main/all')
} }
}, },
computed: { computed: {
@ -51,7 +51,7 @@ const registration = {
if (!this.$v.$invalid) { if (!this.$v.$invalid) {
try { try {
await this.signUp(this.user) await this.signUp(this.user)
this.$router.push('/p/main/friends') this.$router.push('/~/main/friends')
} catch (error) { } catch (error) {
console.warn('Registration failed: ' + error) console.warn('Registration failed: ' + error)
} }

View File

@ -218,7 +218,7 @@ const UserSettings = {
.then((res) => { .then((res) => {
if (res.status === 'success') { if (res.status === 'success') {
this.$store.dispatch('logout') this.$store.dispatch('logout')
this.$router.push('/p/main/all') this.$router.push('/~/main/all')
} else { } else {
this.deleteAccountError = res.error this.deleteAccountError = res.error
} }

View File

@ -12,8 +12,8 @@ const defaultState = {
logo: '/static/logo.png', logo: '/static/logo.png',
logoMask: true, logoMask: true,
logoMargin: '.2em', logoMargin: '.2em',
redirectRootNoLogin: '/p/main/all', redirectRootNoLogin: '/~/main/all',
redirectRootLogin: '/p/main/friends', redirectRootLogin: '/~/main/friends',
showInstanceSpecificPanel: false, showInstanceSpecificPanel: false,
scopeOptionsEnabled: true, scopeOptionsEnabled: true,
formattingOptionsEnabled: false, formattingOptionsEnabled: false,

View File

@ -4,8 +4,8 @@
"logo": "/static/logo.png", "logo": "/static/logo.png",
"logoMask": true, "logoMask": true,
"logoMargin": ".1em", "logoMargin": ".1em",
"redirectRootNoLogin": "/p/main/all", "redirectRootNoLogin": "/~/main/all",
"redirectRootLogin": "/p/main/friends", "redirectRootLogin": "/~/main/friends",
"chatDisabled": false, "chatDisabled": false,
"showInstanceSpecificPanel": false, "showInstanceSpecificPanel": false,
"scopeOptionsEnabled": false, "scopeOptionsEnabled": false,

View File

@ -12,7 +12,7 @@ describe('routes', () => {
}) })
it('root path', () => { it('root path', () => {
router.push('/p/main/all') router.push('/~/main/all')
const matchedComponents = router.getMatchedComponents() const matchedComponents = router.getMatchedComponents()

1938
yarn.lock

File diff suppressed because it is too large Load Diff