diff options
| author | slice <ryaneft@gmail.com> | 2019-03-10 01:54:26 -0800 |
|---|---|---|
| committer | slice <ryaneft@gmail.com> | 2019-03-10 01:54:26 -0800 |
| commit | a67881b096dc4e49db804b7267c3bf49ff78bca6 (patch) | |
| tree | bc921d4c97efd1aebdc7ce0d4e112ba8386d20b5 /src/modules/api.js | |
| parent | 09736691ea79e66c9e41d6f723384769088eb2d0 (diff) | |
Check for websocket token before connecting to chat
Closes #403. Previously, a socket to the chat channel would be opened if
chat is enabled, regardless if the user is logged in or not. This patch
only allows a connection to be opened if a wsToken (websocket token) is
present, which prevents websocket errors from unauthenticated users.
Diffstat (limited to 'src/modules/api.js')
| -rw-r--r-- | src/modules/api.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/api.js b/src/modules/api.js index 31cb55c6..dc5278f8 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -50,7 +50,7 @@ const api = { }, initializeSocket (store) { // Set up websocket connection - if (!store.state.chatDisabled) { + if (!store.state.chatDisabled && store.state.wsToken) { const token = store.state.wsToken const socket = new Socket('/socket', {params: {token}}) socket.connect() |
