diff --git a/client/components/NetworkForm.vue b/client/components/NetworkForm.vue
index d14f307e..50757d58 100644
--- a/client/components/NetworkForm.vue
+++ b/client/components/NetworkForm.vue
@@ -98,6 +98,78 @@
+
+
Proxy Settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Network settings
diff --git a/client/css/style.css b/client/css/style.css
index 4891253b..760d2dd6 100644
--- a/client/css/style.css
+++ b/client/css/style.css
@@ -1840,19 +1840,23 @@ part/quit messages where we don't load previews (adds a blank line otherwise) */
margin-top: 6px;
}
-#connect .tls input {
+#connect .tls input,
+#connect input[name="proxyEnabled"] {
margin: 3px 10px 0 0;
}
-#connect\:host {
+#connect\:host,
+#connect\:proxyHost {
width: 70%;
}
-#connect\:port {
+#connect\:port,
+#connect\:proxyPort {
width: 25%;
}
-#connect\:portseparator {
+#connect\:portseparator,
+#connect\:proxyPortSeparator {
width: 5%;
text-align: center;
display: inline-block;
diff --git a/package.json b/package.json
index cd6dc8c8..adfda760 100644
--- a/package.json
+++ b/package.json
@@ -50,7 +50,7 @@
"file-type": "16.2.0",
"filenamify": "4.2.0",
"got": "11.8.1",
- "irc-framework": "4.9.0",
+ "irc-framework": "github:mstrodl/irc-framework#feature/fix-socks",
"is-utf8": "0.2.1",
"ldapjs": "2.2.3",
"linkify-it": "3.0.2",
diff --git a/src/client.js b/src/client.js
index be37533b..fe905c81 100644
--- a/src/client.js
+++ b/src/client.js
@@ -257,6 +257,12 @@ Client.prototype.connect = function (args, isStartup = false) {
commands: args.commands || [],
channels: channels,
ignoreList: args.ignoreList ? args.ignoreList : [],
+
+ proxyEnabled: !!args.proxyEnabled,
+ proxyHost: String(args.proxyHost || ""),
+ proxyPort: parseInt(args.proxyPort, 10),
+ proxyUsername: String(args.proxyUsername || ""),
+ proxyPassword: String(args.proxyPassword || ""),
});
// Set network lobby channel id
diff --git a/src/models/network.js b/src/models/network.js
index 621f7e1d..13879fb2 100644
--- a/src/models/network.js
+++ b/src/models/network.js
@@ -46,6 +46,13 @@ function Network(attr) {
PREFIX: ["!", "@", "%", "+"],
NETWORK: "",
},
+
+ proxyHost: "",
+ proxyPort: 1080,
+ proxyUsername: "",
+ proxyPassword: "",
+ proxyEnabled: false,
+
chanCache: [],
ignoreList: [],
keepNick: null,
@@ -90,6 +97,12 @@ Network.prototype.validate = function (client) {
this.saslAccount = cleanString(this.saslAccount);
this.saslPassword = cleanString(this.saslPassword);
+ this.proxyHost = cleanString(this.proxyHost);
+ this.proxyPort = this.proxyPort || 1080;
+ this.proxyUsername = cleanString(this.proxyUsername);
+ this.proxyPassword = cleanString(this.proxyPassword);
+ this.proxyEnabled = !!this.proxyEnabled;
+
if (!this.port) {
this.port = this.tls ? 6697 : 6667;
}
@@ -208,6 +221,17 @@ Network.prototype.setIrcFrameworkOptions = function (client) {
this.irc.options.webirc = this.createWebIrc(client);
this.irc.options.client_certificate = null;
+ if (this.proxyEnabled) {
+ this.irc.options.socks = {
+ host: this.proxyHost,
+ port: this.proxyPort,
+ user: this.proxyUsername,
+ pass: this.proxyPassword,
+ };
+ } else {
+ delete this.irc.options.socks;
+ }
+
if (!this.sasl) {
delete this.irc.options.sasl_mechanism;
delete this.irc.options.account;
@@ -274,6 +298,12 @@ Network.prototype.edit = function (client, args) {
this.saslAccount = String(args.saslAccount || "");
this.saslPassword = String(args.saslPassword || "");
+ this.proxyHost = String(args.proxyHost || "");
+ this.proxyPort = parseInt(args.proxyPort, 10);
+ this.proxyUsername = String(args.proxyUsername || "");
+ this.proxyPassword = String(args.proxyPassword || "");
+ this.proxyEnabled = !!args.proxyEnabled;
+
// Split commands into an array
this.commands = String(args.commands || "")
.replace(/\r\n|\r|\n/g, "\n")
@@ -455,6 +485,12 @@ Network.prototype.exportForEdit = function () {
"saslAccount",
"saslPassword",
"commands",
+
+ "proxyEnabled",
+ "proxyHost",
+ "proxyPort",
+ "proxyUsername",
+ "proxyPassword",
];
if (!Helper.config.lockNetwork) {
@@ -491,6 +527,11 @@ Network.prototype.export = function () {
"saslPassword",
"commands",
"ignoreList",
+
+ "proxyHost",
+ "proxyPort",
+ "proxyUsername",
+ "proxyEnabled",
]);
network.channels = this.channels