smart-home-engine 1.9.2 → 1.9.3
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.
- package/dist/web/assets/{index-DqPNasAj.js → index-ByoSXq9N.js} +38 -38
- package/dist/web/assets/{index-D_NqSYjh.css → index-D3e4KUzX.css} +1 -1
- package/dist/web/assets/{tsMode-1NAzjOi5.js → tsMode-CjIOSOpY.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/web/broker-api.js +8 -0
- package/src/web/log-ws.js +15 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-
|
|
1
|
+
import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-ByoSXq9N.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
package/dist/web/index.html
CHANGED
|
@@ -172,10 +172,10 @@
|
|
|
172
172
|
}
|
|
173
173
|
})();
|
|
174
174
|
</script>
|
|
175
|
-
<script type="module" crossorigin src="/assets/index-
|
|
175
|
+
<script type="module" crossorigin src="/assets/index-ByoSXq9N.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
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
178
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D3e4KUzX.css">
|
|
179
179
|
</head>
|
|
180
180
|
<body>
|
|
181
181
|
<div id="app"></div>
|
package/package.json
CHANGED
package/src/web/broker-api.js
CHANGED
|
@@ -25,6 +25,7 @@ const mosquittoConf = require('../lib/mosquitto-conf');
|
|
|
25
25
|
const ca = require('../lib/ca');
|
|
26
26
|
const sshDeploy = require('../lib/ssh-deploy');
|
|
27
27
|
const sheConfig = require('../config');
|
|
28
|
+
const { getBrokerLogBuffer } = require('./log-ws');
|
|
28
29
|
|
|
29
30
|
// Default SSH identity file respects the configured data directory
|
|
30
31
|
const DEFAULT_SSH_KEY = path.join(sheConfig['data-dir'], 'ssh', 'broker_id_ed25519');
|
|
@@ -938,6 +939,13 @@ router.post('/ca/trusted/addpath', async (req, res) => {
|
|
|
938
939
|
}
|
|
939
940
|
});
|
|
940
941
|
|
|
942
|
+
// GET /she/broker/logs?limit=<N> — recent broker log entries (ring buffer, max 500)
|
|
943
|
+
router.get('/logs', (req, res) => {
|
|
944
|
+
const limit = Math.min(Number(req.query.limit) || 500, 1000);
|
|
945
|
+
const all = getBrokerLogBuffer();
|
|
946
|
+
res.json(limit >= all.length ? all : all.slice(-limit));
|
|
947
|
+
});
|
|
948
|
+
|
|
941
949
|
module.exports = { router, setLogger, setStore };
|
|
942
950
|
|
|
943
951
|
// ── dynsec: ACL topic inspection ──────────────────────────────────────────────
|
package/src/web/log-ws.js
CHANGED
|
@@ -97,14 +97,28 @@ function getLogBuffer() {
|
|
|
97
97
|
/**
|
|
98
98
|
* Broadcast a structured broker (mosquitto) log entry to all connected
|
|
99
99
|
* WebSocket clients as { type: 'brokerLog', level, msg, ts }.
|
|
100
|
+
* Also stores the entry in a server-side ring buffer exposed via getBrokerLogBuffer().
|
|
100
101
|
* @param {string} level Single-letter mosquitto level: D|I|N|W|E
|
|
101
102
|
* @param {string} msg
|
|
102
103
|
* @param {number} ts Unix ms timestamp
|
|
103
104
|
*/
|
|
105
|
+
const _brokerLogBuffer = [];
|
|
106
|
+
const BROKER_LOG_BUFFER_MAX = 500;
|
|
107
|
+
|
|
104
108
|
function broadcastBrokerLog(level, msg, ts) {
|
|
109
|
+
_brokerLogBuffer.push({ level, msg, ts });
|
|
110
|
+
if (_brokerLogBuffer.length > BROKER_LOG_BUFFER_MAX) _brokerLogBuffer.shift();
|
|
105
111
|
broadcast({ type: 'brokerLog', level, msg, ts });
|
|
106
112
|
}
|
|
107
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Return a snapshot of recent broker log entries (oldest first).
|
|
116
|
+
* @returns {{ level: string, msg: string, ts: number }[]}
|
|
117
|
+
*/
|
|
118
|
+
function getBrokerLogBuffer() {
|
|
119
|
+
return _brokerLogBuffer.slice();
|
|
120
|
+
}
|
|
121
|
+
|
|
108
122
|
/**
|
|
109
123
|
* Close the WebSocket server.
|
|
110
124
|
* @returns {Promise<void>}
|
|
@@ -120,4 +134,4 @@ function closeWss() {
|
|
|
120
134
|
});
|
|
121
135
|
}
|
|
122
136
|
|
|
123
|
-
module.exports = { attachWss, broadcast, broadcastBrokerLog, broadcastLog, closeWss, getLogBuffer, setWelcomeProvider };
|
|
137
|
+
module.exports = { attachWss, broadcast, broadcastBrokerLog, broadcastLog, closeWss, getBrokerLogBuffer, getLogBuffer, setWelcomeProvider };
|