smart-home-engine 1.1.18 → 1.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-BH6XhdRK.js";/*!-----------------------------------------------------------------------------
1
+ import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-sjamTHx3.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -172,7 +172,7 @@
172
172
  }
173
173
  })();
174
174
  </script>
175
- <script type="module" crossorigin src="/assets/index-BH6XhdRK.js"></script>
175
+ <script type="module" crossorigin src="/assets/index-sjamTHx3.js"></script>
176
176
  <link rel="modulepreload" crossorigin href="/assets/monaco-langs-BW2J83t5.js">
177
177
  <link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
178
178
  <link rel="stylesheet" crossorigin href="/assets/index-b3gdLMp3.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-home-engine",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "Node.js based script runner for use in MQTT based Smart Home environments",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -801,6 +801,15 @@ router.post('/wizard/bootstrap', async (req, res) => {
801
801
 
802
802
  if (isRemote) {
803
803
  // mosquitto_ctrl must run on the broker host — invoke it via SSH.
804
+ // Delete any existing file first: mosquitto_ctrl init refuses to overwrite
805
+ // an existing file, which would leave the old credentials in place while
806
+ // config.json now holds new ones, causing "not authorised" on reconnect.
807
+ try {
808
+ await sshDeploy.runCommand(bc.ssh, `sudo rm -f "${dynSecPath}"`);
809
+ _log?.debug(`broker: removed existing ${dynSecPath} on remote (if any)`);
810
+ } catch (e) {
811
+ _log?.warn(`broker: could not remove existing ${dynSecPath} on remote: ${e.message}`);
812
+ }
804
813
  const ctrlCmd = `mosquitto_ctrl dynsec init "${dynSecPath}" "${username}" "${password}"`;
805
814
  _log?.debug(`broker: SSH mosquitto_ctrl on ${bc.ssh.host}: mosquitto_ctrl dynsec init "${dynSecPath}" "${username}" ***`);
806
815
  try {
@@ -876,6 +885,13 @@ router.post('/wizard/bootstrap', async (req, res) => {
876
885
  } else {
877
886
  // Local mode: run mosquitto_ctrl on this host.
878
887
  fs.mkdirSync(configDir, { recursive: true });
888
+ // Delete any existing file first so mosquitto_ctrl always writes fresh credentials.
889
+ try {
890
+ fs.rmSync(dynSecPath, { force: true });
891
+ _log?.debug(`broker: removed existing ${dynSecPath} on local host (if any)`);
892
+ } catch (e) {
893
+ _log?.warn(`broker: could not remove existing ${dynSecPath}: ${e.message}`);
894
+ }
879
895
  _log?.debug(`broker: local mosquitto_ctrl dynsec init ${dynSecPath} ${username} ***`);
880
896
  try {
881
897
  const r = await execFileAsync('mosquitto_ctrl', ['dynsec', 'init', dynSecPath, username, password], { timeout: 10000 });