allow setting clientId for MQTT Outbound

deprecate-old-monitor-groups
Moe 2022-12-14 12:40:07 -08:00
parent 309a73fdf4
commit 1a4704268f
3 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,7 @@
"deleteSubAccount": "Delete Sub-Account",
"deleteSubAccountText": "Do you want to delete this Sub-Account? You cannot recover it.",
"Accuracy Mode": "Accuracy Mode",
"Client ID": "Client ID",
"Refresh": "Refresh",
"Compress": "Compress",
"Tile Size": "Tile Size",

View File

@ -11,6 +11,7 @@ module.exports = function(s,config,lang,getSnapshot){
let mqttEndpoint = options.host
const username = options.username || ''
const password = options.password || ''
const clientId = options.clientId || `shinobi_${Math.random().toString(16).substr(2, 8)}`
const subKey = options.subKey
const pubKey = options.pubKey
const groupKey = options.ke
@ -32,7 +33,7 @@ module.exports = function(s,config,lang,getSnapshot){
clean: true,
username: username,
password: password,
clientId: `shinobi_${Math.random().toString(16).substr(2, 8)}`,
clientId: clientId,
reconnectPeriod: 10000, // 10 seconds
});
client.on('reconnect', (e) => mqttUserLog(`MQTT Reconnected`))
@ -182,6 +183,7 @@ module.exports = function(s,config,lang,getSnapshot){
mqttSubs[mqttSubId].client = createMqttSubscription({
username: row.username,
password: row.password,
clientId: row.clientId,
host: row.host,
pubKey: row.pubKey,
ke: groupKey,

View File

@ -69,6 +69,7 @@ $(document).ready(function(){
<div class="px-1 py-2">
<input placeholder="${lang.Username}" class="form-control form-control-sm mb-2" mqtt-param="username" value="${row.username || ''}">
<input placeholder="${lang.Password}" class="form-control form-control-sm" mqtt-param="password" value="${row.password || ''}">
<input placeholder="${lang['Client ID']}" class="form-control form-control-sm" mqtt-param="clientId" value="${row.clientId || ''}">
</div>
<div class="px-1 py-2">
<select multiple class="form-control form-control-sm" mqtt-param="msgFor">