forked from CringeStudios/gamja
Add config option to generate random nickname
Closes: https://todo.sr.ht/~emersion/gamja/136
This commit is contained in:
parent
34d3bd6df9
commit
54e1fc93d9
@ -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
|
// require it, "disabled" to never ask for a password, or "external" to
|
||||||
// use SASL EXTERNAL. Defaults to "optional".
|
// use SASL EXTERNAL. Defaults to "optional".
|
||||||
"auth": "optional",
|
"auth": "optional",
|
||||||
// Default nickname (string).
|
// Default nickname (string). If it contains a "*" character, it will
|
||||||
|
// be replaced with a random string.
|
||||||
"nick": "asdf",
|
"nick": "asdf",
|
||||||
// Don't display the login UI, immediately connect to the server
|
// Don't display the login UI, immediately connect to the server
|
||||||
// (boolean).
|
// (boolean).
|
||||||
|
@ -323,6 +323,14 @@ export default class App extends Component {
|
|||||||
|
|
||||||
this.config = config;
|
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 (autojoin.length > 0) {
|
||||||
if (connectParams.autoconnect) {
|
if (connectParams.autoconnect) {
|
||||||
// Ask the user whether they want to join that new channel.
|
// Ask the user whether they want to join that new channel.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user