smart-home-engine 1.1.1 → 1.1.2

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-DttCbWJj.js";/*!-----------------------------------------------------------------------------
1
+ import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-DvaCcW0R.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-DttCbWJj.js"></script>
175
+ <script type="module" crossorigin src="/assets/index-DvaCcW0R.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-DKIgEFlE.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-home-engine",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
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": {
@@ -50,7 +50,8 @@ function scpArgs(sshConfig) {
50
50
  }
51
51
 
52
52
  function sshTarget(sshConfig) {
53
- return `${sshConfig.user || 'she'}@${sshConfig.host}`;
53
+ const user = sshConfig.user || os.userInfo().username;
54
+ return `${user}@${sshConfig.host}`;
54
55
  }
55
56
 
56
57
  /**
@@ -190,8 +190,7 @@ router.post('/config/restore', (req, res) => {
190
190
  router.post('/reload', async (req, res) => {
191
191
  try {
192
192
  const bc = getBrokerConfig(req);
193
- if (bc.mode === 'remote' && bc.ssh && bc.ssh.host) {
194
- const cmd = bc.reloadCmd || 'sudo systemctl reload mosquitto';
193
+ if (bc.ssh && bc.ssh.host) {
195
194
  const result = await sshDeploy.runCommand(bc.ssh, cmd);
196
195
  return res.json({ ok: true, ...result });
197
196
  }
@@ -210,8 +209,7 @@ router.post('/reload', async (req, res) => {
210
209
  router.post('/restart', async (req, res) => {
211
210
  try {
212
211
  const bc = getBrokerConfig(req);
213
- if (bc.mode === 'remote' && bc.ssh && bc.ssh.host) {
214
- const cmd = bc.restartCmd || 'sudo systemctl restart mosquitto';
212
+ if (bc.ssh && bc.ssh.host) {
215
213
  const result = await sshDeploy.runCommand(bc.ssh, cmd);
216
214
  return res.json({ ok: true, ...result });
217
215
  }
@@ -723,7 +721,7 @@ router.post('/wizard/bootstrap', async (req, res) => {
723
721
  const username = req.body.adminUsername || 'she-admin';
724
722
  const password = req.body.adminPassword || crypto.randomBytes(18).toString('base64url');
725
723
  const configDir = (req.body.configDir || bc.configDir || '/etc/mosquitto').replace(/\\/g, '/');
726
- const isRemote = bc.mode === 'remote' && bc.ssh && bc.ssh.host;
724
+ const isRemote = !!(bc.ssh && bc.ssh.host);
727
725
 
728
726
  const dynSecPath = `${configDir}/dynamic-security.json`;
729
727
  const confFilePath = `${configDir}/mosquitto.conf`;