smart-home-engine 1.1.16 → 1.1.17

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-Dz9x2Vob.js";/*!-----------------------------------------------------------------------------
1
+ import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-itohNXf2.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-Dz9x2Vob.js"></script>
175
+ <script type="module" crossorigin src="/assets/index-itohNXf2.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.16",
3
+ "version": "1.1.17",
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": {
@@ -26,7 +26,10 @@ const { promisify } = require('util');
26
26
  const execFileAsync = promisify(execFile);
27
27
 
28
28
  // Keys that she manages — all others are treated as passthrough
29
- const MANAGED_SINGLE_KEYS = new Set(['allow_anonymous', 'persistence', 'persistence_location', 'log_dest', 'log_type', 'plugin', 'plugin_opt_dynsec_config_file']);
29
+ // NOTE: 'plugin_opt_dynsec_config_file' is kept here only for migration —
30
+ // when read from an old conf it is normalised to 'plugin_opt_config_file' on
31
+ // the same line that recognises it (see parseText below).
32
+ const MANAGED_SINGLE_KEYS = new Set(['allow_anonymous', 'persistence', 'persistence_location', 'log_dest', 'log_type', 'plugin', 'plugin_opt_config_file', 'plugin_opt_dynsec_config_file']);
30
33
 
31
34
  /**
32
35
  * Parse mosquitto.conf text into a structured object.
@@ -70,10 +73,12 @@ function parseText(raw) {
70
73
  } else if (currentListener && isListenerSubkey(key)) {
71
74
  applyListenerKey(currentListener, key, value);
72
75
  } else if (MANAGED_SINGLE_KEYS.has(key)) {
73
- if (managed[key] !== undefined) {
74
- managed[key] = [].concat(managed[key]).concat(value);
76
+ // Normalise the old (incorrect) key name written by earlier she versions
77
+ const managedKey = key === 'plugin_opt_dynsec_config_file' ? 'plugin_opt_config_file' : key;
78
+ if (managed[managedKey] !== undefined) {
79
+ managed[managedKey] = [].concat(managed[managedKey]).concat(value);
75
80
  } else {
76
- managed[key] = value;
81
+ managed[managedKey] = value;
77
82
  }
78
83
  currentListener = null;
79
84
  } else {
@@ -155,7 +160,7 @@ function serialise(conf) {
155
160
  // Managed single-key entries first
156
161
  const { managed = {}, listeners = [], passthrough = [] } = conf;
157
162
 
158
- const keyOrder = ['allow_anonymous', 'persistence', 'persistence_location', 'log_dest', 'log_type', 'plugin', 'plugin_opt_dynsec_config_file'];
163
+ const keyOrder = ['allow_anonymous', 'persistence', 'persistence_location', 'log_dest', 'log_type', 'plugin', 'plugin_opt_config_file'];
159
164
  for (const key of keyOrder) {
160
165
  if (managed[key] === undefined) continue;
161
166
  const val = managed[key];
@@ -855,7 +855,7 @@ router.post('/wizard/bootstrap', async (req, res) => {
855
855
  const parsed = mosquittoConf.parseText(remoteConfRaw);
856
856
  if (!parsed.managed.plugin || !String(parsed.managed.plugin).includes('mosquitto_dynamic_security')) {
857
857
  parsed.managed.plugin = soPath;
858
- parsed.managed.plugin_opt_dynsec_config_file = dynSecPath;
858
+ parsed.managed.plugin_opt_config_file = dynSecPath;
859
859
  const content = mosquittoConf.serialise(parsed);
860
860
  _log?.debug(`broker: uploading updated conf to ${bc.ssh.host}:${confFilePath}`);
861
861
  await sshDeploy.uploadContent(bc.ssh, content, confFilePath);
@@ -908,7 +908,7 @@ router.post('/wizard/bootstrap', async (req, res) => {
908
908
  const parsed = mosquittoConf.parse(confFilePath);
909
909
  if (!parsed.managed.plugin || !String(parsed.managed.plugin).includes('mosquitto_dynamic_security')) {
910
910
  parsed.managed.plugin = soPath;
911
- parsed.managed.plugin_opt_dynsec_config_file = dynSecPath;
911
+ parsed.managed.plugin_opt_config_file = dynSecPath;
912
912
  const content = mosquittoConf.serialise(parsed);
913
913
  _log?.debug(`broker: writing updated local conf to ${confFilePath}`);
914
914
  mosquittoConf.write(confFilePath, content);
@@ -946,12 +946,16 @@ router.post('/wizard/deactivate', async (req, res) => {
946
946
  const raw = await sshDeploy.readRemoteFile(bc.ssh, fp);
947
947
  const parsed = mosquittoConf.parseText(raw);
948
948
  delete parsed.managed.plugin;
949
+ delete parsed.managed.plugin_opt_config_file;
950
+ // Also remove old key name in case conf was written by an earlier she version
949
951
  delete parsed.managed.plugin_opt_dynsec_config_file;
950
952
  const content = mosquittoConf.serialise(parsed);
951
953
  await sshDeploy.uploadContent(bc.ssh, content, fp);
952
954
  } else {
953
955
  const parsed = mosquittoConf.parse(fp);
954
956
  delete parsed.managed.plugin;
957
+ delete parsed.managed.plugin_opt_config_file;
958
+ // Also remove old key name in case conf was written by an earlier she version
955
959
  delete parsed.managed.plugin_opt_dynsec_config_file;
956
960
  const content = mosquittoConf.serialise(parsed);
957
961
  mosquittoConf.write(fp, content);