@mmmbuto/nexuscrew 0.8.5 → 0.8.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/README.md +33 -16
- package/frontend/dist/assets/index-CEFh0hI4.js +90 -0
- package/frontend/dist/assets/{index-U_e8auCM.css → index-kX5IUxt4.css} +1 -1
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/version.json +1 -1
- package/lib/cli/fleet-service.js +8 -3
- package/lib/fleet/builtin.js +139 -22
- package/lib/fleet/definitions.js +20 -0
- package/lib/fleet/index.js +42 -1
- package/lib/fleet/managed.js +15 -2
- package/lib/fleet/provider.js +12 -11
- package/lib/fleet/routes.js +11 -2
- package/lib/nodes/peering.js +59 -7
- package/lib/settings/routes.js +22 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-UAVxf6SE.js +0 -90
package/lib/settings/routes.js
CHANGED
|
@@ -289,12 +289,32 @@ function settingsRoutes(deps = {}) {
|
|
|
289
289
|
// persisted hashed, 0600, for ten minutes only. Il `label` nel payload e'
|
|
290
290
|
// l'etichetta umana con cui il peer vedra' questo dispositivo: default sensato
|
|
291
291
|
// (mai 'localhost' crudo), sovrascrivibile dal form.
|
|
292
|
+
// v2: il creatore puo' includere l'Host/alias SSH raggiungibile (+ slug + porta
|
|
293
|
+
// SSH opzionale) cosicché il ricevente incolla/scansiona UN solo link e precompila
|
|
294
|
+
// tutto. NIENTE segreti: solo routing. L'invite one-time resta l'unica credenziale.
|
|
292
295
|
r.post('/peering/invite', mutGate, (req, res) => {
|
|
293
296
|
try {
|
|
294
|
-
const
|
|
297
|
+
const b = req.body || {};
|
|
298
|
+
const label = nodesStore.sanitizeLabel(b.label, defaultDeviceName());
|
|
299
|
+
const extra = {};
|
|
300
|
+
if (typeof b.ssh === 'string' && b.ssh.trim()) {
|
|
301
|
+
const ssh = nodesStore.parseSshTarget(b.ssh.trim());
|
|
302
|
+
if (!ssh) return send(res, 400, { error: 'ssh non valido (atteso user@host o alias)' });
|
|
303
|
+
extra.ssh = ssh.value;
|
|
304
|
+
}
|
|
305
|
+
if (b.sshPort !== undefined && b.sshPort !== null && b.sshPort !== '') {
|
|
306
|
+
if (!nodesStore.isPort(Number(b.sshPort))) return send(res, 400, { error: 'sshPort non valida (1..65535)' });
|
|
307
|
+
extra.sshPort = Number(b.sshPort);
|
|
308
|
+
}
|
|
309
|
+
if (extra.sshPort && !extra.ssh) return send(res, 400, { error: 'sshPort richiede un target SSH' });
|
|
310
|
+
if (typeof b.name === 'string' && b.name.trim()) {
|
|
311
|
+
if (!nodesStore.NODE_NAME_RE.test(b.name.trim())) return send(res, 400, { error: 'name non valido (a-z 0-9 -, max 32)' });
|
|
312
|
+
extra.name = b.name.trim();
|
|
313
|
+
}
|
|
314
|
+
if (extra.ssh && !extra.name) extra.name = nodesStore.toSlug(label);
|
|
295
315
|
const st = nodesStore.loadOrInitStore(nodesPath);
|
|
296
316
|
send(res, 200, peering.createInvite({
|
|
297
|
-
invitesPath, instanceId: st.nodeId, port: cfg.port, label,
|
|
317
|
+
invitesPath, instanceId: st.nodeId, port: cfg.port, label, ...extra,
|
|
298
318
|
}));
|
|
299
319
|
} catch (e) { send(res, 500, { error: String(e.message || e) }); }
|
|
300
320
|
});
|