mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-14 19:25:26 -05:00
Add config option to generate random nickname
Closes: https://todo.sr.ht/~emersion/gamja/136
This commit is contained in:
parent
34d3bd6df9
commit
54e1fc93d9
2 changed files with 10 additions and 1 deletions
|
@ -106,7 +106,8 @@ gamja default settings can be set using a `config.json` file at the root:
|
|||
// require it, "disabled" to never ask for a password, or "external" to
|
||||
// use SASL EXTERNAL. Defaults to "optional".
|
||||
"auth": "optional",
|
||||
// Default nickname (string).
|
||||
// Default nickname (string). If it contains a "*" character, it will
|
||||
// be replaced with a random string.
|
||||
"nick": "asdf",
|
||||
// Don't display the login UI, immediately connect to the server
|
||||
// (boolean).
|
||||
|
|
|
@ -323,6 +323,14 @@ export default class App extends Component {
|
|||
|
||||
this.config = config;
|
||||
|
||||
if (!connectParams.nick && connectParams.autoconnect) {
|
||||
connectParams.nick = "user-*";
|
||||
}
|
||||
if (connectParams.nick && connectParams.nick.includes("*")) {
|
||||
let placeholder = Math.random().toString(36).substr(2, 7);
|
||||
connectParams.nick = connectParams.nick.replace("*", placeholder);
|
||||
}
|
||||
|
||||
if (autojoin.length > 0) {
|
||||
if (connectParams.autoconnect) {
|
||||
// Ask the user whether they want to join that new channel.
|
||||
|
|
Loading…
Reference in a new issue