Merge pull request #2075 from thelounge/xpaw/rejectUnauthorized
Allow setting `rejectUnauthorized` per network
This commit is contained in:
commit
cbf82a1bc7
@ -40,7 +40,13 @@
|
||||
<div class="col-sm-9 col-sm-offset-3">
|
||||
<label class="tls">
|
||||
<input type="checkbox" name="tls" {{#if defaults.tls}}checked{{/if}} {{#if lockNetwork}}disabled{{/if}}>
|
||||
Enable TLS/SSL
|
||||
Use secure connection (TLS)
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-9 col-sm-offset-3">
|
||||
<label class="tls">
|
||||
<input type="checkbox" name="allowUnauthorized" {{#unless defaults.rejectUnauthorized}}checked{{/unless}} {{#if lockNetwork}}disabled{{/if}}>
|
||||
Allow untrusted certificates
|
||||
</label>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
@ -233,6 +233,17 @@ module.exports = {
|
||||
//
|
||||
tls: true,
|
||||
|
||||
//
|
||||
// Enable certificate verification
|
||||
//
|
||||
// If true, the server certificate is verified against
|
||||
// the list of supplied CAs by your node.js installation.
|
||||
//
|
||||
// @type boolean
|
||||
// @default true
|
||||
//
|
||||
rejectUnauthorized: true,
|
||||
|
||||
//
|
||||
// Nick
|
||||
//
|
||||
|
@ -178,6 +178,7 @@ Client.prototype.connect = function(args) {
|
||||
host: args.host || "",
|
||||
port: parseInt(args.port, 10) || (args.tls ? 6697 : 6667),
|
||||
tls: !!args.tls,
|
||||
rejectUnauthorized: !args.allowUnauthorized,
|
||||
password: args.password,
|
||||
username: args.username || nick.replace(/[^a-zA-Z0-9]/g, ""),
|
||||
realname: args.realname || "The Lounge User",
|
||||
@ -206,6 +207,7 @@ Client.prototype.connect = function(args) {
|
||||
network.host = Helper.config.defaults.host;
|
||||
network.port = Helper.config.defaults.port;
|
||||
network.tls = Helper.config.defaults.tls;
|
||||
network.rejectUnauthorized = Helper.config.defaults.rejectUnauthorized;
|
||||
}
|
||||
|
||||
if (network.host.length === 0) {
|
||||
@ -248,7 +250,7 @@ Client.prototype.connect = function(args) {
|
||||
password: network.password,
|
||||
tls: network.tls,
|
||||
outgoing_addr: Helper.config.bind,
|
||||
rejectUnauthorized: false,
|
||||
rejectUnauthorized: network.rejectUnauthorized,
|
||||
enable_chghost: true,
|
||||
enable_echomessage: true,
|
||||
auto_reconnect: true,
|
||||
|
@ -24,6 +24,7 @@ function Network(attr) {
|
||||
host: "",
|
||||
port: 6667,
|
||||
tls: false,
|
||||
rejectUnauthorized: false,
|
||||
password: "",
|
||||
awayMessage: "",
|
||||
commands: [],
|
||||
@ -130,6 +131,7 @@ Network.prototype.export = function() {
|
||||
"host",
|
||||
"port",
|
||||
"tls",
|
||||
"rejectUnauthorized",
|
||||
"password",
|
||||
"username",
|
||||
"realname",
|
||||
|
@ -29,6 +29,7 @@ describe("Network", function() {
|
||||
host: "",
|
||||
port: 6667,
|
||||
tls: false,
|
||||
rejectUnauthorized: false,
|
||||
password: "",
|
||||
username: "",
|
||||
realname: "",
|
||||
@ -124,6 +125,7 @@ describe("Network", function() {
|
||||
"serverOptions",
|
||||
"status",
|
||||
"tls",
|
||||
"rejectUnauthorized",
|
||||
"username"
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user