forked from AkkomaGang/akkoma-fe
Merge branch 'feature/configurable-default-path' into 'develop'
Feature/configurable default path See merge request pleroma/pleroma-fe!173
This commit is contained in:
commit
222b0aa982
2 changed files with 38 additions and 36 deletions
47
src/main.js
47
src/main.js
|
@ -63,8 +63,24 @@ const store = new Vuex.Store({
|
||||||
strict: process.env.NODE_ENV !== 'production'
|
strict: process.env.NODE_ENV !== 'production'
|
||||||
})
|
})
|
||||||
|
|
||||||
const routes = [
|
const i18n = new VueI18n({
|
||||||
{ name: 'root', path: '/', redirect: '/main/all' },
|
locale: currentLocale,
|
||||||
|
fallbackLocale: 'en',
|
||||||
|
messages
|
||||||
|
})
|
||||||
|
|
||||||
|
window.fetch('/static/config.json')
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => {
|
||||||
|
const {name, theme, background, logo, registrationOpen} = data
|
||||||
|
store.dispatch('setOption', { name: 'name', value: name })
|
||||||
|
store.dispatch('setOption', { name: 'theme', value: theme })
|
||||||
|
store.dispatch('setOption', { name: 'background', value: background })
|
||||||
|
store.dispatch('setOption', { name: 'logo', value: logo })
|
||||||
|
store.dispatch('setOption', { name: 'registrationOpen', value: registrationOpen })
|
||||||
|
|
||||||
|
const routes = [
|
||||||
|
{ name: 'root', path: '/', redirect: data['defaultPath'] || '/main/all' },
|
||||||
{ path: '/main/all', component: PublicAndExternalTimeline },
|
{ path: '/main/all', component: PublicAndExternalTimeline },
|
||||||
{ path: '/main/public', component: PublicTimeline },
|
{ path: '/main/public', component: PublicTimeline },
|
||||||
{ path: '/main/friends', component: FriendsTimeline },
|
{ path: '/main/friends', component: FriendsTimeline },
|
||||||
|
@ -75,9 +91,9 @@ const routes = [
|
||||||
{ name: 'settings', path: '/settings', component: Settings },
|
{ name: 'settings', path: '/settings', component: Settings },
|
||||||
{ name: 'registration', path: '/registration', component: Registration },
|
{ name: 'registration', path: '/registration', component: Registration },
|
||||||
{ name: 'user-settings', path: '/user-settings', component: UserSettings }
|
{ name: 'user-settings', path: '/user-settings', component: UserSettings }
|
||||||
]
|
]
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
routes,
|
routes,
|
||||||
scrollBehavior: (to, from, savedPosition) => {
|
scrollBehavior: (to, from, savedPosition) => {
|
||||||
|
@ -86,31 +102,16 @@ const router = new VueRouter({
|
||||||
}
|
}
|
||||||
return savedPosition || { x: 0, y: 0 }
|
return savedPosition || { x: 0, y: 0 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const i18n = new VueI18n({
|
/* eslint-disable no-new */
|
||||||
locale: currentLocale,
|
new Vue({
|
||||||
fallbackLocale: 'en',
|
|
||||||
messages
|
|
||||||
})
|
|
||||||
|
|
||||||
/* eslint-disable no-new */
|
|
||||||
new Vue({
|
|
||||||
router,
|
router,
|
||||||
store,
|
store,
|
||||||
i18n,
|
i18n,
|
||||||
el: '#app',
|
el: '#app',
|
||||||
render: h => h(App)
|
render: h => h(App)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.fetch('/static/config.json')
|
|
||||||
.then((res) => res.json())
|
|
||||||
.then(({name, theme, background, logo, registrationOpen}) => {
|
|
||||||
store.dispatch('setOption', { name: 'name', value: name })
|
|
||||||
store.dispatch('setOption', { name: 'theme', value: theme })
|
|
||||||
store.dispatch('setOption', { name: 'background', value: background })
|
|
||||||
store.dispatch('setOption', { name: 'logo', value: logo })
|
|
||||||
store.dispatch('setOption', { name: 'registrationOpen', value: registrationOpen })
|
|
||||||
})
|
})
|
||||||
|
|
||||||
window.fetch('/static/terms-of-service.html')
|
window.fetch('/static/terms-of-service.html')
|
||||||
|
|
|
@ -3,5 +3,6 @@
|
||||||
"theme": "pleroma-dark",
|
"theme": "pleroma-dark",
|
||||||
"background": "/static/bg.jpg",
|
"background": "/static/bg.jpg",
|
||||||
"logo": "/static/logo.png",
|
"logo": "/static/logo.png",
|
||||||
"registrationOpen": false
|
"registrationOpen": false,
|
||||||
|
"defaultPath": "/main/all"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue