tciv-client 0.0.3 → 0.0.4
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 +37 -0
- package/dist/cli.js +9 -0
- package/dist/client.d.ts +10 -1
- package/dist/client.js +23 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ This library is intended for **system integrators and IT administrators** managi
|
|
|
28
28
|
- [Call Button (DAK)](#call-button-dak-configuration)
|
|
29
29
|
- [Provisioning](#full-device-provisioning)
|
|
30
30
|
- [Video](#video)
|
|
31
|
+
- [Factory Reset](#factory-reset)
|
|
31
32
|
- [Reboot](#device-reboot)
|
|
32
33
|
- [API](#api)
|
|
33
34
|
- [Connectivity](#connectivity)
|
|
@@ -42,6 +43,7 @@ This library is intended for **system integrators and IT administrators** managi
|
|
|
42
43
|
- [Provisioning](#full-device-provisioning-1)
|
|
43
44
|
- [Audio Settings](#audio-settings)
|
|
44
45
|
- [Reboot](#reboot)
|
|
46
|
+
- [Factory Reset](#factory-reset-1)
|
|
45
47
|
- [Device Discovery](#scannetwork)
|
|
46
48
|
- [Supported Hardware](#supported-hardware)
|
|
47
49
|
- [HTTP API Reference](#http-api-reference)
|
|
@@ -225,6 +227,19 @@ tciv provision -h 192.168.1.143 \
|
|
|
225
227
|
tciv reboot -h 192.168.1.143
|
|
226
228
|
```
|
|
227
229
|
|
|
230
|
+
### Factory Reset
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Full reset (IP → 169.254.1.100)
|
|
234
|
+
tciv factory-reset -h 192.168.1.143
|
|
235
|
+
|
|
236
|
+
# Reset but keep current IP settings (recommended)
|
|
237
|
+
tciv factory-reset -h 192.168.1.143 --keep-ip
|
|
238
|
+
|
|
239
|
+
# Reset with DHCP enabled
|
|
240
|
+
tciv factory-reset -h 192.168.1.143 --dhcp
|
|
241
|
+
```
|
|
242
|
+
|
|
228
243
|
### CLI Options
|
|
229
244
|
|
|
230
245
|
| Flag | Short | Description | Default |
|
|
@@ -244,6 +259,8 @@ tciv reboot -h 192.168.1.143
|
|
|
244
259
|
| `--no-reboot` | | Skip reboot after DAK set | |
|
|
245
260
|
| `--sip-user` | | SIP auth username (provision) | |
|
|
246
261
|
| `--sip-pass` | | SIP auth password (provision) | |
|
|
262
|
+
| `--keep-ip` | | Factory reset: keep IP settings | |
|
|
263
|
+
| `--dhcp` | | Factory reset: enable DHCP | |
|
|
247
264
|
|
|
248
265
|
---
|
|
249
266
|
|
|
@@ -398,6 +415,25 @@ fs.writeFileSync('audio-backup.json', JSON.stringify(raw, null, 2));
|
|
|
398
415
|
await z.reboot(); // ~30 seconds offline
|
|
399
416
|
```
|
|
400
417
|
|
|
418
|
+
#### Factory Reset
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
// Full reset (static IP 169.254.1.100)
|
|
422
|
+
await z.factoryReset('full');
|
|
423
|
+
|
|
424
|
+
// Reset but keep current IP (recommended)
|
|
425
|
+
await z.factoryReset('keep-ip');
|
|
426
|
+
|
|
427
|
+
// Reset with DHCP
|
|
428
|
+
await z.factoryReset('dhcp');
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
| Mode | Behavior |
|
|
432
|
+
|------|----------|
|
|
433
|
+
| `full` | All defaults, IP → 169.254.1.100 |
|
|
434
|
+
| `dhcp` | All defaults, DHCP enabled |
|
|
435
|
+
| `keep-ip` | All defaults, current IP preserved |
|
|
436
|
+
|
|
401
437
|
---
|
|
402
438
|
|
|
403
439
|
### `scanNetwork()`
|
|
@@ -440,6 +476,7 @@ All endpoints require valid administrator credentials via HTTP Basic Auth.
|
|
|
440
476
|
| `/goform/zForm_config_backup` | POST | Config restore (upload) |
|
|
441
477
|
| `/ipst_config.tar.gz` | GET | Config backup download |
|
|
442
478
|
| `/goform/zForm_system_prefs` | POST | Reboot device |
|
|
479
|
+
| `/goform/zForm_send_cmd` | POST | Factory reset (full/DHCP/keep-ip) |
|
|
443
480
|
| `/mjpg/video.mjpg` | GET | Live MJPG stream |
|
|
444
481
|
|
|
445
482
|
## License
|
package/dist/cli.js
CHANGED
|
@@ -222,6 +222,15 @@ async function main() {
|
|
|
222
222
|
console.log('✅ Reboot command sent. Device will be offline for ~30 seconds.');
|
|
223
223
|
break;
|
|
224
224
|
}
|
|
225
|
+
case 'factory-reset': {
|
|
226
|
+
const client = getClient();
|
|
227
|
+
const mode = hasFlag('keep-ip') ? 'keep-ip' : hasFlag('dhcp') ? 'dhcp' : 'full';
|
|
228
|
+
const labels = { 'full': 'full (IP → 169.254.1.100)', 'dhcp': 'full + DHCP', 'keep-ip': 'keep IP settings' };
|
|
229
|
+
console.log(`⚠️ Factory reset (${labels[mode]}) — all settings will be lost!`);
|
|
230
|
+
await client.factoryReset(mode);
|
|
231
|
+
console.log('✅ Factory reset sent. Device will reboot with default settings.');
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
225
234
|
case 'video': {
|
|
226
235
|
const client = getClient();
|
|
227
236
|
console.log(`📷 Video URLs for ${flag('host', 'h')}:\n`);
|
package/dist/client.d.ts
CHANGED
|
@@ -126,8 +126,17 @@ export declare class TcivClient {
|
|
|
126
126
|
private _replaceFileInTar;
|
|
127
127
|
/** Recalculate tar header checksum (sum of all header bytes with checksum field as spaces) */
|
|
128
128
|
private _updateTarChecksum;
|
|
129
|
-
/** Reboot the
|
|
129
|
+
/** Reboot the device (required after config changes) */
|
|
130
130
|
reboot(): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Factory reset — restores all settings to defaults. Device will reboot.
|
|
133
|
+
*
|
|
134
|
+
* @param mode - Reset mode:
|
|
135
|
+
* - 'full' → Static IP 169.254.1.100 (default)
|
|
136
|
+
* - 'dhcp' → Factory defaults + DHCP enabled
|
|
137
|
+
* - 'keep-ip' → Factory defaults but keep current IP settings
|
|
138
|
+
*/
|
|
139
|
+
factoryReset(mode?: 'full' | 'dhcp' | 'keep-ip'): Promise<void>;
|
|
131
140
|
private _fetch;
|
|
132
141
|
private _html;
|
|
133
142
|
private _post;
|
package/dist/client.js
CHANGED
|
@@ -642,7 +642,7 @@ export class TcivClient {
|
|
|
642
642
|
Buffer.from(checksumStr).copy(header, 148);
|
|
643
643
|
}
|
|
644
644
|
// ── Reboot ─────────────────────────────────────────────────────────────
|
|
645
|
-
/** Reboot the
|
|
645
|
+
/** Reboot the device (required after config changes) */
|
|
646
646
|
async reboot() {
|
|
647
647
|
try {
|
|
648
648
|
await this._post('/goform/zForm_system_prefs', { reboot: 'Reboot' });
|
|
@@ -651,6 +651,28 @@ export class TcivClient {
|
|
|
651
651
|
// May disconnect before response — that's expected
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* Factory reset — restores all settings to defaults. Device will reboot.
|
|
656
|
+
*
|
|
657
|
+
* @param mode - Reset mode:
|
|
658
|
+
* - 'full' → Static IP 169.254.1.100 (default)
|
|
659
|
+
* - 'dhcp' → Factory defaults + DHCP enabled
|
|
660
|
+
* - 'keep-ip' → Factory defaults but keep current IP settings
|
|
661
|
+
*/
|
|
662
|
+
async factoryReset(mode = 'full') {
|
|
663
|
+
const params = {
|
|
664
|
+
'full': 'factory_reset',
|
|
665
|
+
'dhcp': 'factory_reset_dhcp',
|
|
666
|
+
'keep-ip': 'factory_reset_keep_ip_settings',
|
|
667
|
+
};
|
|
668
|
+
const name = params[mode];
|
|
669
|
+
try {
|
|
670
|
+
await this._post('/goform/zForm_send_cmd', { [name]: '1' });
|
|
671
|
+
}
|
|
672
|
+
catch {
|
|
673
|
+
// Device disconnects during reset — expected
|
|
674
|
+
}
|
|
675
|
+
}
|
|
654
676
|
// ── Internal helpers ────────────────────────────────────────────────────
|
|
655
677
|
async _fetch(path, method = 'GET', timeout, body, contentType) {
|
|
656
678
|
const controller = new AbortController();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tciv-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "HTTP client for TCIV-series intercom systems (TCIV-2+, TCIV-3). Control relays, SIP configuration, DAK provisioning, webcall, audio settings, and camera feeds.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|