Add generate slave token button

Add a generate slave token button to the web interface and modify the
generateSlaveToken message and corresponding ctl command to have the
slave id be optional.  The random id is the desired behavior when adding
a slave with the installer, as it'll ask for the token for the new slave
and deduce the id from the token.
This commit is contained in:
Hornwitser committed 2021-06-15 14:46:44 +02:00
1 parent cc562a451e
commit fc08438164
5 files changed
+81 -7

No files matched your search

+5 -1
View File
@@ -130,7 +130,11 @@ class ControlConnection extends BaseConnection {
}
async generateSlaveTokenRequestHandler(message) {
return { token: this.generateSlaveToken(message.data.slave_id) };
let slaveId = message.data.slave_id;
if (slaveId === null) {
slaveId = Math.random() * 2**31 | 0;
}
return { token: this.generateSlaveToken(slaveId) };
}
async createSlaveConfigRequestHandler(message) {