node-red-contrib-modbus-modpackqt 3.3.4 → 3.3.6

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/CHANGELOG.md CHANGED
@@ -4,6 +4,28 @@ All notable changes to **node-red-contrib-modbus-modpackqt** are documented
4
4
  here. This project follows [Semantic Versioning](https://semver.org/) — pin a
5
5
  major version (`^2.0.0`) in production.
6
6
 
7
+ ## [3.3.6] — 2026-05-10
8
+
9
+ ### Added
10
+
11
+ - **Account Key + My Connections picker on the runtime config node.**
12
+ Paste your ModPackQT tunnel key into the config dialog — the
13
+ **My Connections** dropdown loads your saved devices from
14
+ modpackqt.com and auto-fills Host, Port, and Unit ID. Manual entry
15
+ still works as a fallback.
16
+ - Config node credentials are now registered so the admin proxy
17
+ (`/modpackqt/connections`) can look up the key without exposing it
18
+ to the browser.
19
+
20
+ ## [3.3.5] — 2026-05-10
21
+
22
+ ### Changed
23
+
24
+ - **Port and Unit ID fields removed from slave server dialog.** They are now
25
+ hidden — the only way to set them is by picking from the **My Slaves**
26
+ profile picker. This enforces the cloud-driven config workflow and removes
27
+ manual entry that could conflict with the saved profile.
28
+
7
29
  ## [3.3.4] — 2026-05-10
8
30
 
9
31
  ### Changed
@@ -18,7 +18,7 @@
18
18
  const http = require('http');
19
19
  const { URL } = require('url');
20
20
 
21
- const PALETTE_VERSION = '3.3.4';
21
+ const PALETTE_VERSION = '3.3.6';
22
22
  const DEFAULT_PORT = parseInt(process.env.MODPACKQT_PROBE_PORT, 10) || 8502;
23
23
  const BIND_HOST = process.env.MODPACKQT_PROBE_HOST || '127.0.0.1';
24
24
  const PORT_RETRY = 5;
@@ -1,6 +1,9 @@
1
1
  <script type="text/javascript">
2
2
  RED.nodes.registerType('modpackqt-config', {
3
3
  category: 'config',
4
+ credentials: {
5
+ apiKey: { type: 'password' }
6
+ },
4
7
  defaults: {
5
8
  name: { value: 'ModPackQT Device' },
6
9
  targetHost: { value: 'localhost' },
@@ -39,6 +42,49 @@
39
42
  toggleRtu();
40
43
  toggleSlave();
41
44
 
45
+ // ── My Connections picker
46
+ const nodeId = this.id;
47
+ const $sel = $('#node-config-input-modpackqt-conn-picker');
48
+ const loadConnections = function () {
49
+ $sel.empty().append('<option value="">— Loading… —</option>');
50
+ if (!nodeId) {
51
+ $sel.empty().append('<option value="">— Save this config first, then reopen —</option>');
52
+ return;
53
+ }
54
+ $.getJSON('modpackqt/connections?probe=' + encodeURIComponent(nodeId))
55
+ .done(function (rows) {
56
+ $sel.empty().append('<option value="">— Manual entry —</option>');
57
+ (rows || []).forEach(function (c) {
58
+ const label = (c.name || '(unnamed)') + (c.connectionType === 'rtu'
59
+ ? ' — RTU'
60
+ : ' — ' + (c.host || '?') + ':' + (c.port || 502) + ' #' + (c.unitId || 1));
61
+ $('<option>').val(c.id).text(label).data('conn', c).appendTo($sel);
62
+ });
63
+ })
64
+ .fail(function (xhr) {
65
+ const msg = (xhr.responseJSON && xhr.responseJSON.error) || ('HTTP ' + xhr.status);
66
+ $sel.empty().append($('<option>').val('').text('— ' + msg + ' —'));
67
+ });
68
+ };
69
+ $('#modpackqt-conn-picker-refresh').on('click', function (e) {
70
+ e.preventDefault();
71
+ loadConnections();
72
+ });
73
+ $sel.on('change', function () {
74
+ const c = $(this).find('option:selected').data('conn');
75
+ if (!c) return;
76
+ if (!$('#node-config-input-name').val() || $('#node-config-input-name').val() === 'ModPackQT Device') {
77
+ $('#node-config-input-name').val(c.name || '');
78
+ }
79
+ if (c.host) $('#node-config-input-targetHost').val(c.host);
80
+ if (c.port) $('#node-config-input-targetPort').val(c.port);
81
+ if (c.unitId) $('#node-config-input-unitId').val(c.unitId);
82
+ if (c.connectionType === 'rtu') {
83
+ $('#node-config-input-masterMode').val('rtu').trigger('change');
84
+ }
85
+ });
86
+ loadConnections();
87
+
42
88
  // ── Embedded slave server section (collapsed by default)
43
89
  const $slaveSection = $('.modpackqt-slave-section');
44
90
  const $slaveToggle = $('.modpackqt-slave-section-toggle');
@@ -63,6 +109,24 @@
63
109
  <input type="text" id="node-config-input-name" placeholder="e.g. Inverter A">
64
110
  </div>
65
111
 
112
+ <div class="form-row">
113
+ <label for="node-config-input-apiKey"><i class="fa fa-key"></i> Account Key</label>
114
+ <input type="password" id="node-config-input-apiKey" placeholder="Paste your ModPackQT tunnel key">
115
+ </div>
116
+ <div class="form-tips" style="font-size:11px;color:#6b7280;margin:-8px 0 4px 105px">
117
+ Generate at <a href="https://modpackqt.com/settings" target="_blank" rel="noopener">modpackqt.com → Settings → Cloud Gateways</a>.
118
+ Loads your saved connections in the picker below.
119
+ </div>
120
+
121
+ <div class="form-row">
122
+ <label for="node-config-input-modpackqt-conn-picker"><i class="fa fa-cloud-download"></i> My Connections</label>
123
+ <select id="node-config-input-modpackqt-conn-picker" style="width:65%"></select>
124
+ <button type="button" id="modpackqt-conn-picker-refresh" class="red-ui-button" title="Reload" style="margin-left:4px"><i class="fa fa-refresh"></i></button>
125
+ </div>
126
+ <div class="form-tips" style="font-size:11px;color:#6b7280;margin:-8px 0 12px 105px">
127
+ Picks a saved connection from modpackqt.com — auto-fills Host, Port, and Unit ID below.
128
+ </div>
129
+
66
130
  <h4 style="margin-top:18px">Device</h4>
67
131
  <div class="form-row modpackqt-tcp-only">
68
132
  <label for="node-config-input-targetHost"><i class="fa fa-plug"></i> Host</label>
@@ -335,5 +335,7 @@ module.exports = function (RED) {
335
335
  });
336
336
  }
337
337
 
338
- RED.nodes.registerType('modpackqt-config', ModPackQTConfigNode);
338
+ RED.nodes.registerType('modpackqt-config', ModPackQTConfigNode, {
339
+ credentials: { apiKey: { type: 'password' } }
340
+ });
339
341
  };
@@ -104,20 +104,13 @@
104
104
  <button type="button" id="modpackqt-slave-server-picker-refresh" class="red-ui-button" title="Reload" style="margin-left:4px"><i class="fa fa-refresh"></i></button>
105
105
  </div>
106
106
  <div class="form-tips" style="font-size:11px;color:#6b7280;margin:-8px 0 12px 105px">
107
- Picks a saved slave from modpackqt.com auto-fills port and unit.
107
+ Required — pick a saved slave to set the port and unit ID.
108
108
  Register layout and limits are managed from the web console.
109
109
  </div>
110
110
 
111
- <div class="form-row">
112
- <label for="node-input-bindPort"><i class="fa fa-hashtag"></i> Port</label>
113
- <input type="number" id="node-input-bindPort" min="1024" max="65535" placeholder="1502">
114
- </div>
115
- <div class="form-row">
116
- <label for="node-input-unitId"><i class="fa fa-id-card"></i> Unit ID</label>
117
- <input type="number" id="node-input-unitId" min="1" max="247" placeholder="1">
118
- </div>
119
-
120
111
  <input type="hidden" id="node-input-bindHost">
112
+ <input type="hidden" id="node-input-bindPort">
113
+ <input type="hidden" id="node-input-unitId">
121
114
 
122
115
  <div class="form-row" style="margin-top:18px;padding-top:14px;border-top:1px solid #e5e7eb;text-align:center;">
123
116
  <a id="modpackqt-slave-server-link" href="https://modpackqt.com" target="_blank" rel="noopener noreferrer"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-modbus-modpackqt",
3
- "version": "3.3.4",
3
+ "version": "3.3.6",
4
4
  "description": "Modbus commissioning, testing & analysis tools for Node-RED. Embedded Modbus TCP/RTU master + slave server, FC1/FC2/FC3/FC4 reads, FC5/FC6/FC15/FC16 writes, built-in slave register store, and a passive traffic monitor for debugging. 100% free, MIT, no usage limits. By ModPackQT — open the matching web console at modpackqt.com for register decoding, simulation and AI assistance.",
5
5
  "keywords": [
6
6
  "node-red",