2020-07-02 05:03:16 -04:00
|
|
|
# [gamja]
|
2020-04-25 06:40:15 -04:00
|
|
|
|
2021-06-11 04:19:46 -04:00
|
|
|
A simple IRC web client.
|
2020-04-25 06:40:15 -04:00
|
|
|
|
2020-07-24 03:51:02 -04:00
|
|
|
![screenshot](https://l.sr.ht/7Npm.png)
|
|
|
|
|
2020-06-24 08:55:49 -04:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
Requires an IRC WebSocket server.
|
|
|
|
|
2020-07-01 08:46:49 -04:00
|
|
|
First install dependencies:
|
|
|
|
|
|
|
|
npm install --production
|
|
|
|
|
2021-11-04 07:21:21 -04:00
|
|
|
Then configure an HTTP server to serve the gamja files. Below are some
|
|
|
|
server-specific instructions.
|
|
|
|
|
2020-07-01 08:46:49 -04:00
|
|
|
### [soju]
|
|
|
|
|
|
|
|
Add a WebSocket listener to soju, e.g. `listen wss://127.0.0.1:8080`.
|
|
|
|
|
|
|
|
Configure your reverse proxy to serve gamja files and proxy `/socket` to soju.
|
|
|
|
|
|
|
|
### [webircgateway]
|
|
|
|
|
|
|
|
Setup webircgateway to serve gamja files:
|
|
|
|
|
|
|
|
```ini
|
|
|
|
[fileserving]
|
|
|
|
enabled = true
|
|
|
|
webroot = /path/to/gamja
|
|
|
|
```
|
|
|
|
|
|
|
|
Then connect to webircgateway and append `?server=/webirc/websocket/` to the
|
|
|
|
URL.
|
|
|
|
|
2021-05-27 11:47:31 -04:00
|
|
|
### nginx
|
|
|
|
|
|
|
|
If you use nginx as a reverse HTTP proxy, make sure to bump the default read
|
|
|
|
timeout to a value higher than the IRC server PING interval. Example:
|
|
|
|
|
|
|
|
```
|
2021-11-27 06:26:25 -05:00
|
|
|
location / {
|
|
|
|
root /path/to/gamja;
|
|
|
|
}
|
|
|
|
|
2021-05-27 11:47:31 -04:00
|
|
|
location /socket {
|
|
|
|
proxy_pass http://127.0.0.1:8080;
|
|
|
|
proxy_read_timeout 600s;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "Upgrade";
|
|
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-10-12 14:18:29 -04:00
|
|
|
If you are unable to configure the proxy timeout accordingly, or if your IRC
|
|
|
|
server doesn't send PINGs, you can set the `server.ping` option in
|
|
|
|
`config.json` (see below).
|
2021-05-27 12:17:41 -04:00
|
|
|
|
2020-07-01 08:46:49 -04:00
|
|
|
### Development server
|
|
|
|
|
2021-12-01 04:34:41 -05:00
|
|
|
If you don't have an IRC WebSocket server at hand, gamja's development server
|
|
|
|
can be used. For instance, to run gamja on Libera Chat:
|
2021-11-04 07:21:21 -04:00
|
|
|
|
|
|
|
npm install --include=dev
|
2021-12-01 04:34:41 -05:00
|
|
|
npm start -- irc.libera.chat
|
2020-07-01 08:46:49 -04:00
|
|
|
|
2021-12-01 04:44:03 -05:00
|
|
|
See `npm start -- -h` for a list of options.
|
|
|
|
|
2021-10-18 18:50:02 -04:00
|
|
|
### Production build
|
|
|
|
|
2021-11-04 07:21:21 -04:00
|
|
|
Optionally, [Parcel] can be used to build a minified version of gamja.
|
2021-10-18 18:50:02 -04:00
|
|
|
|
2021-11-04 07:21:21 -04:00
|
|
|
npm install --include=dev
|
|
|
|
npm run build
|
2021-10-18 18:50:02 -04:00
|
|
|
|
2021-03-08 13:02:31 -05:00
|
|
|
## Query parameters
|
|
|
|
|
|
|
|
gamja settings can be overridden using URL query parameters:
|
|
|
|
|
|
|
|
- `server`: path or URL to the WebSocket server
|
2021-05-27 06:32:22 -04:00
|
|
|
- `nick`: nickname
|
|
|
|
- `channels`: comma-separated list of channels to join (`#` needs to be escaped)
|
2021-11-08 06:33:02 -05:00
|
|
|
- `open`: [IRC URL] to open
|
2021-12-01 05:40:59 -05:00
|
|
|
- `debug`: if set to 1, debug mode is enabled
|
2021-05-27 06:32:22 -04:00
|
|
|
|
|
|
|
Alternatively, the channels can be set with the URL fragment (ie, by just
|
|
|
|
appending the channel name to the gamja URL).
|
2021-03-08 13:02:31 -05:00
|
|
|
|
2021-05-25 06:33:22 -04:00
|
|
|
## Configuration file
|
|
|
|
|
|
|
|
gamja default settings can be set using a `config.json` file at the root:
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
2021-05-31 08:48:51 -04:00
|
|
|
// IRC server settings.
|
2021-05-25 06:33:22 -04:00
|
|
|
"server": {
|
2021-06-10 12:28:44 -04:00
|
|
|
// WebSocket URL or path to connect to (string).
|
2021-05-25 06:33:22 -04:00
|
|
|
"url": "wss://irc.example.org",
|
2021-05-31 08:48:51 -04:00
|
|
|
// Channel(s) to auto-join (string or array of strings).
|
|
|
|
"autojoin": "#gamja",
|
2021-06-10 11:40:59 -04:00
|
|
|
// Controls how the password UI is presented to the user. Set to
|
|
|
|
// "mandatory" to require a password, "optional" to accept one but not
|
2022-09-12 05:38:43 -04:00
|
|
|
// require it, "disabled" to never ask for a password, "external" to
|
|
|
|
// use SASL EXTERNAL, "oauth2" to use SASL OAUTHBEARER. Defaults to
|
|
|
|
// "optional".
|
2021-06-10 11:40:59 -04:00
|
|
|
"auth": "optional",
|
2022-09-12 07:04:59 -04:00
|
|
|
// Default nickname (string). If it contains a "*" character, it will
|
|
|
|
// be replaced with a random string.
|
2021-10-09 04:17:52 -04:00
|
|
|
"nick": "asdf",
|
2021-10-09 04:14:27 -04:00
|
|
|
// Don't display the login UI, immediately connect to the server
|
|
|
|
// (boolean).
|
|
|
|
"autoconnect": true,
|
2021-05-31 08:48:51 -04:00
|
|
|
// 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.
|
|
|
|
"ping": 60
|
2022-09-12 05:38:43 -04:00
|
|
|
},
|
|
|
|
// OAuth 2.0 settings.
|
|
|
|
"oauth2": {
|
|
|
|
// OAuth 2.0 server URL (string). The server must support OAuth 2.0
|
|
|
|
// Authorization Server Metadata (RFC 8414) or OpenID Connect
|
|
|
|
// Discovery.
|
|
|
|
"url": "https://auth.example.org",
|
|
|
|
// OAuth 2.0 client ID (string).
|
|
|
|
"client_id": "asdf",
|
|
|
|
// OAuth 2.0 client secret (string).
|
|
|
|
"client_secret": "ghjk",
|
|
|
|
// OAuth 2.0 scope (string).
|
|
|
|
"scope": "profile"
|
2021-05-25 06:33:22 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-07-22 13:49:28 -04:00
|
|
|
## Contributing
|
|
|
|
|
2021-03-08 13:04:38 -05:00
|
|
|
Send patches on the [mailing list], report bugs on the [issue tracker]. Discuss
|
2021-11-17 04:17:41 -05:00
|
|
|
in [#soju on Libera Chat].
|
2020-07-22 13:49:28 -04:00
|
|
|
|
2020-04-25 06:40:15 -04:00
|
|
|
## License
|
|
|
|
|
|
|
|
AGPLv3, see LICENSE.
|
|
|
|
|
2020-06-24 08:56:22 -04:00
|
|
|
Copyright (C) 2020 The gamja Contributors
|
2020-07-01 08:46:49 -04:00
|
|
|
|
2020-07-02 05:03:16 -04:00
|
|
|
[gamja]: https://sr.ht/~emersion/gamja/
|
2020-07-01 08:46:49 -04:00
|
|
|
[soju]: https://soju.im
|
|
|
|
[webircgateway]: https://github.com/kiwiirc/webircgateway
|
2020-07-22 13:49:28 -04:00
|
|
|
[mailing list]: https://lists.sr.ht/~emersion/public-inbox
|
|
|
|
[issue tracker]: https://todo.sr.ht/~emersion/gamja
|
2021-10-18 18:50:02 -04:00
|
|
|
[Parcel]: https://parceljs.org
|
2021-11-08 06:33:02 -05:00
|
|
|
[IRC URL]: https://datatracker.ietf.org/doc/html/draft-butcher-irc-url-04
|
2021-11-17 04:17:41 -05:00
|
|
|
[#soju on Libera Chat]: ircs://irc.libera.chat/#soju
|