~emersion/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH gamja] add TLS checkbox to network form

Details
Message ID
<Y8UVCJJZbs2osH9j@gutsman.lotheac.fi>
DKIM signature
missing
Download raw message
Patch: +24 -6
also, remove the default value for the port field; per the
bouncer-networks spec, if it's missing the bouncer should automatically
choose the appropriate port (6667 or 6697, depending on tls)
---
 components/app.js          |  4 ++--
 components/network-form.js | 10 +++++++++-
 lib/irc.js                 | 16 +++++++++++++---
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/components/app.js b/components/app.js
index 48dc72b..53bb946 100644
--- a/components/app.js
+++ b/components/app.js
@@ -1304,6 +1304,7 @@ export default class App extends Component {
		}

		let { host, port } = splitHostPort(url.host);
		let tls = url.tls;

		let serverID;
		if (!url.host) {
@@ -1317,7 +1318,7 @@ export default class App extends Component {
					return false;
				}

				let params = { host };
				let params = { host, tls };
				if (typeof port === "number") {
					params.port = port;
				}
@@ -1831,7 +1832,6 @@ export default class App extends Component {
				params: ["CHANGENETWORK", this.state.dialogData.id, irc.formatTags(attrs)],
			});
		} else {
			attrs = { ...attrs, tls: "1" };
			client.createBouncerNetwork(attrs).then((id) => {
				if (!autojoin) {
					return;
diff --git a/components/network-form.js b/components/network-form.js
index 1610040..d06682b 100644
--- a/components/network-form.js
+++ b/components/network-form.js
@@ -3,7 +3,8 @@ import { html, Component } from "../lib/index.js";
const defaultParams = {
	name: "",
	host: "",
	port: 6697,
	port: null,
	tls: true,
	nickname: "",
	username: "",
	realname: "",
@@ -32,6 +33,9 @@ export default class NetworkForm extends Component {
					this.prevParams[k] = props.params[k];
				}
			});
			if (typeof this.state["tls"] === "string") {
				this.state["tls"] = this.state["tls"] === "1" ? true : false;
			}
		}
	}

@@ -103,6 +107,10 @@ export default class NetworkForm extends Component {
						Port:<br/>
						<input type="number" name="port" value=${this.state.port}/>
					</label>
					<label>
						<input type="checkbox" name="tls" checked=${this.state.tls}/>
						TLS
					</label>
					<br/><br/>

					<label>
diff --git a/lib/irc.js b/lib/irc.js
index 03ceb8d..023bde8 100644
--- a/lib/irc.js
+++ b/lib/irc.js
@@ -120,7 +120,12 @@ export function formatTags(tags) {
			l.push(k);
			continue;
		}
		let v = escapeTag(tags[k]);
		let v;
		if (typeof tags[k] === "boolean") {
			v = tags[k] ? "1" : "0";
		} else {
			v = escapeTag(tags[k]);
		}
		l.push(k + "=" + v);
	}
	return l.join(";");
@@ -786,7 +791,12 @@ export function isMeaningfulRealname(realname, nick) {
 * See: https://datatracker.ietf.org/doc/html/draft-butcher-irc-url-04
 */
export function parseURL(str) {
	if (!str.startsWith("irc://") && !str.startsWith("ircs://")) {
	let tls;
	if (str.startsWith("irc://")) {
		tls = false;
	} else if (str.startsWith("ircs://")) {
		tls = true;
	} else {
		return null;
	}

@@ -836,7 +846,7 @@ export function parseURL(str) {
		enttype = entity.startsWith("#") ? "channel" : "user";
	}

	return { host, enttype, entity };
	return { host, enttype, entity, tls };
}

export class CapRegistry {
-- 
2.38.2

-- 
Lauri Tirkkonen | lotheac @ IRCnet

[gamja/patches/.build.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CPTHZQXDVMSI.122E343TBBCW4@cirno2>
In-Reply-To
<Y8UVCJJZbs2osH9j@gutsman.lotheac.fi> (view parent)
DKIM signature
missing
Download raw message
gamja/patches/.build.yml: SUCCESS in 36s

[add TLS checkbox to network form][0] from [Lauri Tirkkonen][1]

[0]: https://lists.sr.ht/~emersion/public-inbox/patches/38223
[1]: lauri@hacktheplanet.fi

✓ #923168 SUCCESS gamja/patches/.build.yml https://builds.sr.ht/~emersion/job/923168
Details
Message ID
<RiFYfQ7uRSYWmSH4BTLDDQfQnvH35NEjGvNyUe-jQH48mue4GDd2TYs5s827dk8D1Z15CTNdpg2bIjCaisJJp1KCtXZGA0BYqPdEstCfck8=@emersion.fr>
In-Reply-To
<Y8UVCJJZbs2osH9j@gutsman.lotheac.fi> (view parent)
DKIM signature
missing
Download raw message
Hm, thanks for the patch, but I'm not sure this is something I want to
support. I'd prefer to force users who want insecure connections to use
BouncerServ manually. Insecure connections are best avoided.
Details
Message ID
<Y8Ut24Ve6qQ6fD1d@gutsman.lotheac.fi>
In-Reply-To
<RiFYfQ7uRSYWmSH4BTLDDQfQnvH35NEjGvNyUe-jQH48mue4GDd2TYs5s827dk8D1Z15CTNdpg2bIjCaisJJp1KCtXZGA0BYqPdEstCfck8=@emersion.fr> (view parent)
DKIM signature
missing
Download raw message
Thanks for your response.

On Mon, Jan 16 2023 10:52:52 +0000, Simon Ser wrote:
> Hm, thanks for the patch, but I'm not sure this is something I want to
> support. I'd prefer to force users who want insecure connections to use
> BouncerServ manually. Insecure connections are best avoided.

Sure. It's just that there are some IRC networks out there that either
don't support TLS connections at all (QuakeNet, I think), or only a
small minority of servers do (IRCnet); I wanted my users to have an
easier experience with those.

That said, the patch does change behavior for irc:// links - I could be
persuaded into requiring irc+insecure:// for insecure links instead, if
that's more reasonable to you.

-- 
Lauri Tirkkonen | lotheac @ IRCnet
Reply to thread Export thread (mbox)