~emersion/public-inbox

gamja: Add "webircgateway" config for QoL tweaks v1 SUPERSEDED

Drew DeVault: 1
 Add "webircgateway" config for QoL tweaks

 3 files changed, 21 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/23239/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gamja] Add "webircgateway" config for QoL tweaks Export this patch

Right now all this does is marks the password field on the login form as
optional.
---
 README.md                  |  3 +++
 components/app.js          | 10 +++++++++-
 components/connect-form.js | 10 +++++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 7100e46..b9bd2cf 100644
--- a/README.md
+++ b/README.md
@@ -85,6 +85,9 @@ gamja default settings can be set using a `config.json` file at the root:
		"url": "wss://irc.example.org",
		// Channel(s) to auto-join (string or array of strings).
		"autojoin": "#gamja",
		// Set to true if you're using webircgateway. Optional; this just
		// enables some quality-of-life features.
		"webircgateway": false,
		// Interval in seconds to send PING commands (number). Set to 0 to
		// disable. Enabling PINGs can have an impact on client power usage and
		// should only be enabled if necessary.
diff --git a/components/app.js b/components/app.js
index 920cb90..c8b1966 100644
--- a/components/app.js
+++ b/components/app.js
@@ -100,6 +100,7 @@ export default class App extends Component {
			autoconnect: false,
			autojoin: [],
		},
		webircgateway: false,
		servers: new Map(),
		buffers: new Map(),
		bouncerNetworks: new Map(),
@@ -200,7 +201,13 @@ export default class App extends Component {
		}

		this.setState((state) => {
			return { connectParams: { ...state.connectParams, ...connectParams } };
			return {
				connectParams: {
					...state.connectParams,
					...connectParams,
				},
				webircgateway: config.server.webircgateway === true,
			};
		});

		if (connectParams.autoconnect) {
@@ -1193,6 +1200,7 @@ export default class App extends Component {
					<${ConnectForm}
						error=${this.state.error}
						params=${this.state.connectParams}
						webircgateway=${this.state.webircgateway}
						connecting=${connecting}
						onSubmit=${this.handleConnectSubmit}
						key=${this.state.connectParams}
diff --git a/components/connect-form.js b/components/connect-form.js
index 4deb947..17edf12 100644
--- a/components/connect-form.js
+++ b/components/connect-form.js
@@ -10,6 +10,7 @@ export default class ConnectForm extends Component {
		username: "",
		realname: "",
		autojoin: "",
		webircgateway: false,
	};

	constructor(props) {
@@ -27,6 +28,7 @@ export default class ConnectForm extends Component {
				username: props.params.username || "",
				realname: props.params.realname || "",
				autojoin: (props.params.autojoin || []).join(","),
				webircgateway: props.webircgateway,
			};
		}
	}
@@ -110,7 +112,13 @@ export default class ConnectForm extends Component {

				<label>
					Password:<br/>
					<input type="password" name="password" value=${this.state.password} disabled=${disabled}/>
					<input
						type="password"
						name="password"
						value=${this.state.password}
						disabled=${disabled}
						placeholder=${this.state.webircgateway ? "(optional)" : ""}
					/>
				</label>
				<br/><br/>

-- 
2.32.0
webircgateway usage doesn't mean that password auth is optional. Some
networks have mandatory auth, some networks don't have auth at all.

Maybe we should just add a "auth" field which can be set to
"mandatory", "optional" or "disabled"?