Add initial support for choosing to still connect when the server uses a self-signed cert and verify_vertificates is turned on

This commit is contained in:
Ken-Håvard Lieng 2017-07-04 11:28:56 +02:00
parent 3f70567d56
commit c005fc7cae
7 changed files with 81 additions and 22 deletions

View file

@ -1,6 +1,7 @@
import { socketAction } from 'state/actions';
import { setConnected } from 'state/app';
import { broadcast, inform, print, addMessage, addMessages } from 'state/messages';
import { reconnect } from 'state/servers';
import { select } from 'state/tab';
import { normalizeChannel } from 'util';
@ -98,6 +99,15 @@ export default function handleSocket({ socket, store: { dispatch, getState } })
dispatch(addMessage(message, tab.server, tab.name));
},
connection_update({ server, errorType }) {
if (errorType === 'verify' &&
confirm('The server is using a self-signed certificate, continue anyway?')) {
dispatch(reconnect(server, {
skipVerify: true
}));
}
},
_connected(connected) {
dispatch(setConnected(connected));
}

View file

@ -28,6 +28,7 @@ export const TOGGLE_SEARCH = 'TOGGLE_SEARCH';
export const AWAY = 'AWAY';
export const CONNECT = 'CONNECT';
export const DISCONNECT = 'DISCONNECT';
export const RECONNECT = 'RECONNECT';
export const SET_NICK = 'SET_NICK';
export const SET_SERVER_NAME = 'SET_SERVER_NAME';
export const WHOIS = 'WHOIS';

View file

@ -150,6 +150,21 @@ export function disconnect(server) {
};
}
export function reconnect(server, settings) {
return {
type: actions.RECONNECT,
server,
settings,
socket: {
type: 'reconnect',
data: {
...settings,
server
}
}
};
}
export function whois(user, server) {
return {
type: actions.WHOIS,