forked from AkkomaGang/akkoma-fe
Add option for disabling chat.
This commit is contained in:
parent
6c4e3a509a
commit
612fb18367
3 changed files with 18 additions and 5 deletions
|
@ -82,6 +82,9 @@ window.fetch('/static/config.json')
|
||||||
store.dispatch('setOption', { name: 'background', value: background })
|
store.dispatch('setOption', { name: 'background', value: background })
|
||||||
store.dispatch('setOption', { name: 'logo', value: logo })
|
store.dispatch('setOption', { name: 'logo', value: logo })
|
||||||
store.dispatch('setOption', { name: 'registrationOpen', value: registrationOpen })
|
store.dispatch('setOption', { name: 'registrationOpen', value: registrationOpen })
|
||||||
|
if (data['chatDisabled']) {
|
||||||
|
store.dispatch('disableChat')
|
||||||
|
}
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{ name: 'root', path: '/', redirect: data['defaultPath'] || '/main/all' },
|
{ name: 'root', path: '/', redirect: data['defaultPath'] || '/main/all' },
|
||||||
|
|
|
@ -6,7 +6,8 @@ const api = {
|
||||||
state: {
|
state: {
|
||||||
backendInteractor: backendInteractorService(),
|
backendInteractor: backendInteractorService(),
|
||||||
fetchers: {},
|
fetchers: {},
|
||||||
socket: null
|
socket: null,
|
||||||
|
chatDisabled: false
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setBackendInteractor (state, backendInteractor) {
|
setBackendInteractor (state, backendInteractor) {
|
||||||
|
@ -20,6 +21,9 @@ const api = {
|
||||||
},
|
},
|
||||||
setSocket (state, socket) {
|
setSocket (state, socket) {
|
||||||
state.socket = socket
|
state.socket = socket
|
||||||
|
},
|
||||||
|
setChatDisabled (state, value) {
|
||||||
|
state.chatDisabled = value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -45,9 +49,14 @@ const api = {
|
||||||
},
|
},
|
||||||
initializeSocket (store, token) {
|
initializeSocket (store, token) {
|
||||||
// Set up websocket connection
|
// Set up websocket connection
|
||||||
let socket = new Socket('/socket', {params: {token: token}})
|
if (!store.state.chatDisabled) {
|
||||||
socket.connect()
|
let socket = new Socket('/socket', {params: {token: token}})
|
||||||
store.dispatch('initializeChat', socket)
|
socket.connect()
|
||||||
|
store.dispatch('initializeChat', socket)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
disableChat (store) {
|
||||||
|
store.commit('setChatDisabled', true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
"background": "/static/bg.jpg",
|
"background": "/static/bg.jpg",
|
||||||
"logo": "/static/logo.png",
|
"logo": "/static/logo.png",
|
||||||
"registrationOpen": false,
|
"registrationOpen": false,
|
||||||
"defaultPath": "/main/all"
|
"defaultPath": "/main/all",
|
||||||
|
"chatDisabled": false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue