diff --git a/README.md b/README.md index 3466a70..9742f99 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/components/app.js b/components/app.js index 7d9ece0..dfc4cf7 100644 --- a/components/app.js +++ b/components/app.js @@ -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.