@signageos/front-applet 4.11.0 → 4.15.0

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/bundle.js +1 -1
  3. package/dist/bundle.js.map +1 -1
  4. package/docs/js-api/js-api-introduction.md +11 -12
  5. package/docs/js-api/js-applet-basics.md +4 -0
  6. package/docs/js-api/js-browser.md +12 -6
  7. package/docs/js-api/js-file-system.md +88 -6
  8. package/docs/management-api/11-js-management-network.md +36 -1
  9. package/docs/management-api/13-js-management-wifi.md +4 -0
  10. package/docs/management-api/6-js-management-time.md +17 -1
  11. package/es6/FrontApplet/Browser/Browser.js +4 -2
  12. package/es6/FrontApplet/Browser/Browser.js.map +1 -1
  13. package/es6/FrontApplet/Browser/IOpenLinkOptions.d.ts +8 -0
  14. package/es6/FrontApplet/Browser/IOpenLinkOptions.js +4 -0
  15. package/es6/FrontApplet/Browser/IOpenLinkOptions.js.map +1 -1
  16. package/es6/FrontApplet/Exchange/Exchange.d.ts +1 -1
  17. package/es6/FrontApplet/FileSystem/FileSystem.d.ts +1 -0
  18. package/es6/FrontApplet/FileSystem/FileSystem.js +10 -0
  19. package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
  20. package/es6/FrontApplet/Management/INetworkInfo.d.ts +1 -0
  21. package/es6/FrontApplet/Management/INetworkInfo.js.map +1 -1
  22. package/es6/FrontApplet/Management/Network.d.ts +1 -0
  23. package/es6/FrontApplet/Management/Network.js +9 -0
  24. package/es6/FrontApplet/Management/Network.js.map +1 -1
  25. package/es6/FrontApplet/Management/Time.d.ts +18 -0
  26. package/es6/FrontApplet/Management/Time.js +16 -4
  27. package/es6/FrontApplet/Management/Time.js.map +1 -1
  28. package/es6/FrontApplet/Management/Wifi.d.ts +13 -1
  29. package/es6/FrontApplet/Management/Wifi.js +12 -1
  30. package/es6/FrontApplet/Management/Wifi.js.map +1 -1
  31. package/package.json +2 -3
  32. package/docs/js-api/js-timing.md +0 -54
@@ -16,17 +16,12 @@ You can use the same functions across all devices with the same result. Applet J
16
16
 
17
17
  Applet JS API supports content-playback features and device management features.
18
18
 
19
- ### About signageOS APIs
20
-
21
- In signageOS there are 2 main groups of APIs:
22
- - `Client-side` - JS API available for both **signageOS Open** and signageOS Platform plans
23
- - `Server-side` - REST API available in **signageOS Platform plan only**
24
-
25
19
  ::: alert alert--tip
26
20
  All APIs are standardized and available across all [supported devices](/category/supported-devices-guides).
27
21
  :::
28
22
 
29
- ## Content-playback APIs
23
+ ## Content-playback JS APIs
24
+
30
25
  Content-playback API is an API for managing content on screen.
31
26
 
32
27
  ::: table-responsive
@@ -38,22 +33,26 @@ Content-playback API is an API for managing content on screen.
38
33
  | [Browser](/api/js/content/js-browser) | Opening managed web-browser on Android devices inc. whitelisting, blacklisting and other features |
39
34
  | [Command](/api/js/content/js-command) | Sending business or technical logs through signageOS in secured offline-ready way |
40
35
  | [File system](/api/js/content/js-file-system) | Full-featured file system API including ZIP and folder management |
36
+ | [Fonts](/api/js/content/js-loading-fonts) | Make it easy to load additional fonts into SoC devices |
41
37
  | [Hardware](/api/js/content/js-hardware) | Hardware-specific APIs like LED lights on Philips 10BDL |
42
- | [Serial](/api/js/content/js-hardware-serial) | Control external devices via serial |
43
38
  | [Inputs](/api/js/content/js-input) | Controller inputs like IR remote unified under one API |
44
- | [Fonts](/api/js/content/js-loading-fonts) | Make it easy to load additional fonts into SoC devices |
39
+ | [Monitors](/api/js/content/js-monitors) | Information about monitors |
40
+ | [Sensors](/api/js/content/js-sensors) | Using sensors and IoT devices in your application |
41
+ | [Serial](/api/js/content/js-hardware-serial) | Control external devices via serial |
45
42
  | [Synchronized playback](/api/js/content/js-sync-playback) | API for creating synced playback and videowalls |
46
- | [Timings](/api/js/content/js-timing) | Managing Timing/Applet switching from JS |
47
43
  | [Video Inputs aka PiP](/api/js/content/js-video-inputs-internal-ports) | Show HDMI/DP/VGA as a part of your content via PiP feature |
48
44
  | [Video Playback](/api/js/content/js-video) | Playing accelerated gapless videos via native video player |
49
45
  | [Video Streams](/api/js/content/js-video-stream) | Playing video streams (RTSP, HLS, UDP) via native video player |
50
- | [Sensors](/api/js/content/js-sensors) | Using sensors and IoT devices in your application |
51
- | [Monitors](/api/js/content/js-monitors) | Information about monitors |
52
46
  :::
53
47
 
54
48
  ## Device management APIs
49
+
55
50
  Device management API is for managing, updating firmware, and other settings on the device.
56
51
 
52
+ ::: alert alert--tip
53
+ For **Device Management** we strongly recommend using REST APIs. [See the REST API documentation here](https://api.docs.signageos.io).
54
+ :::
55
+
57
56
  ::: table-responsive
58
57
  | Domain | Description |
59
58
  | ------ | ----------- |
@@ -16,12 +16,16 @@ description: "[Content JS API] This thread contains basic methods of every Apple
16
16
  This thread contains basic methods of every Applet used to load necessary configuration or device identifications and how to create Applet.
17
17
 
18
18
  ## All methods and properties
19
+
19
20
  ::: table-responsive
20
21
  | Methods/Property | Description | Supported since |
21
22
  | ----------------- | ----------- | :---------------: |
22
23
  | `onReady()` | This method will wait until sOS object library and all dependencies are ready to be used. | 1.0.0 |
23
24
  | `restore()` | Clear all previously played videos, streams, clear display view. | 1.0.0 |
24
25
  | `appletVersion` | Returns current Applet version | JS API `4.5.0`, Front-display `7.8.0`|
26
+ | `config` object | Returns object with key-values set via Timing or as a bundled config| JS API `1.5.0`, Front-display `6.8.0`|
27
+ | `config` object | Returns object with key-values set via Timing or as a bundled config| `1.0.0`|
28
+ | `capabilities` | Enum of device-specific capabilities and features | `1.0.0`|
25
29
  :::
26
30
 
27
31
  ## Starting Applet
@@ -21,7 +21,6 @@ Default URL can be opened and even the whitelisting/blacklisting of certain doma
21
21
  ::: table-responsive
22
22
  | Methods | Description | Supported since |
23
23
  | ----------------- | ----------- | ----- | :---------------: |
24
- | `openLink()` | **Deprecated:** Use `open()` instead. | 1.0.19 |
25
24
  | `open()` | Open page in integrated browser | 4.0.0 |
26
25
  | `close()` | Open page in integrated browser | 4.4.0 |
27
26
  :::
@@ -33,9 +32,9 @@ Default URL can be opened and even the whitelisting/blacklisting of certain doma
33
32
  - Android devices with Android 5+ (Philips, Benq, Sharp, generic Android device)
34
33
 
35
34
  **With some limitation you can use this API also on**
36
- - Samsung Tizen (SSSP 4 and above); where the website is just in fullscreen without any addressbar or theme options
37
- - LG webOS (webOS 3.0 and above); where the website is just in fullscreen without any addressbar or theme options
38
- - Raspberry Pi and NEC Compute Module; where the website is just in fullscreen without any addressbar or theme options
35
+ - Samsung Tizen (SSSP 4 and above); where the website is just in fullscreen without an address bar or theme options (headless mode)
36
+ - LG webOS (webOS 3.0 and above); where the website is just in fullscreen without an address bar or theme options (headless mode)
37
+ - Raspberry Pi and NEC Compute Module; where the website is just in fullscreen without an address bar or theme options (headless mode)
39
38
  :::
40
39
 
41
40
  ### Javascript
@@ -56,6 +55,9 @@ Method `open()` also supports properties for browser. You can set height, width
56
55
  | `coordinates` | Object | Size of browser screen (only Raspberry Pi) |
57
56
  | `idleTimeout` | Number | Timeout in milliseconds for loading page |
58
57
  | `theme` | Object | Setting custom theme for Android |
58
+ | `headlessMode` | Boolean | Headless mode hides the entire address bar (default) |
59
+ | `canUserClose` | Boolean | Whether the user can manually close the browser. Default:<br>**Headless:** `false`<br>**With UI:** `true` |
60
+ | `clearData` | Boolean | Clear cache after the browser closes. Default:<br>**Headless:** `false`<br>**With UI:** `true` |
59
61
  :::
60
62
 
61
63
 
@@ -64,13 +66,14 @@ sos.browser.open('https://www.signageos.io', {
64
66
  aclDomains: ['google.com', 'yahoo.com'],
65
67
  aclMode: 'blacklist', // or 'whitelist'
66
68
  readOnlyAddressBar: true,
67
- coordinates: { // Supported only on Raspberry Pi
69
+ coordinates: { // Supported only on Raspberry Pi and Android
68
70
  x: 0,
69
71
  y: 0,
70
72
  height: 500,
71
73
  width: 500,
72
74
  },
73
75
  // theme: { ... } // supported only on Android
76
+ headlessMode: false, // supported only on Android
74
77
  ```
75
78
 
76
79
  <div class="row d-flex align-content-stretch force-padding-20">
@@ -141,7 +144,10 @@ interface IOpenLinkOptions {
141
144
  width: number;
142
145
  height: number;
143
146
  };
144
- theme?: ITheme; // supported since 5.0.0
147
+ theme?: ITheme;
148
+ headlessMode?: boolean;
149
+ clearData?: boolean;
150
+ canUserClose?: boolean;
145
151
  }
146
152
 
147
153
  open(uri: string, options?: IOpenLinkOptions): void;
@@ -69,10 +69,12 @@ File System directory structure is **PERSISTENT** and is **NOT** automatically d
69
69
  | `isDirectory()` | Returns true if existing path is directory | 2.1.0 |
70
70
  | `copyFile()` | Copy file or directory to a new location | 3.3.0 |
71
71
  | `writeFile()` | Write string to a file | 3.2.0 |
72
+ | `appendFile()` | Write string to a file | 4.13.0 |
72
73
  | `readFile()` | Read a text file | 3.3.0 |
73
74
  :::
74
75
 
75
76
  ## listStorageUnits()
77
+
76
78
  Return list of storage units /internal, external/ from the device. Capacity values are in bytes.
77
79
 
78
80
  ::: alert alert--info
@@ -85,6 +87,7 @@ This is a mandatory method that is required for all the other File System APIs.
85
87
 
86
88
 
87
89
  ### Javascript Example
90
+
88
91
  ```javascript
89
92
  // Storage units are equivalent to disk volumes (C:, D: etc on Windows; /mnt/disc1, /mnt/disc2 on Unix)
90
93
  const storageUnits = await sos.fileSystem.listStorageUnits();
@@ -94,6 +97,7 @@ const internalStorageUnit = storageUnits.find((storageUnit) => !storageUnit.remo
94
97
 
95
98
  console.log(storageUnits);
96
99
  ```
100
+
97
101
  ### Returns
98
102
 
99
103
  ```json
@@ -115,14 +119,15 @@ console.log(storageUnits);
115
119
  ]
116
120
  ```
117
121
 
118
-
119
122
  ## listFiles()
123
+
120
124
  List files and folders located in the internal/external storage.
121
125
  * SUCCESS: Return list of files of existing directory
122
126
  * FAIL: When listing not existing directory
123
127
  * FAIL: When listing existing file (not a directory)
124
128
 
125
129
  ### Javascript Example
130
+
126
131
  ```javascript
127
132
  // Storage units are equivalent to disk volumes (C:, D: etc on Windows; /mnt/disc1, /mnt/disc2 on Unix)
128
133
  const storageUnits = await sos.fileSystem.listStorageUnits();
@@ -203,16 +208,19 @@ console.log(testDirDirectoryFilePaths);
203
208
  ```
204
209
 
205
210
  ## getFile()
211
+
206
212
  Return a file from an internal storage
207
213
  * OK: Returns local uri of existing file
208
214
  * OK: Returns NULL of not existing file
209
215
 
210
216
  ### Parameters
217
+
211
218
  | Param | Type | Required | Description |
212
219
  | -------------- | ------ | :-------: | ----- |
213
220
  | `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
214
221
 
215
222
  ### Javascript Example
223
+
216
224
  ```javascript
217
225
  // always pass storageUnit to tell the JS API where to look
218
226
  // get properties of file (at least localUri) or null when not exist
@@ -243,6 +251,7 @@ Return statement is a dynamic object! It has to be always generated and retrieve
243
251
  ```
244
252
 
245
253
  ## exists()
254
+
246
255
  * OK: Returns true of existing directory or file
247
256
  * OK: Returns false of not existing directory nor file
248
257
 
@@ -253,6 +262,7 @@ Return statement is a dynamic object! It has to be always generated and retrieve
253
262
  | `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
254
263
 
255
264
  ### Javascript Example
265
+
256
266
  ```javascript
257
267
  // always pass storageUnit to tell the JS API where to look
258
268
  // check if there is such a file
@@ -262,9 +272,11 @@ console.log(fileExists);
262
272
  ```
263
273
 
264
274
  ### Returns
275
+
265
276
  Boolean value
266
277
 
267
278
  ## downloadFile()
279
+
268
280
  Download file to path within existing directory or **overrides existing file** in a path when successfully downloaded
269
281
 
270
282
  * OK: Download file to path within existing directory
@@ -285,6 +297,7 @@ Download file to path within existing directory or **overrides existing file** i
285
297
  :::
286
298
 
287
299
  ### Javascript Example
300
+
288
301
  ```javascript
289
302
  // You can download file to specific existing directory
290
303
  await sos.fileSystem.downloadFile(
@@ -294,7 +307,39 @@ await sos.fileSystem.downloadFile(
294
307
  );
295
308
  ```
296
309
 
310
+ #### Encoding
311
+
312
+ All downloads respect a standard of `Encoding` with optional compression of files. See [Mozilla standard Accept Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) and [Content Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding).
313
+
314
+ Download file method is always sending optional following headers:
315
+ ```
316
+ Accept-Encoding: gzip
317
+ Accept-Encoding: compress
318
+ Accept-Encoding: deflate
319
+ Accept-Encoding: br
320
+ Accept-Encoding: identity
321
+ Accept-Encoding: *
322
+ ```
323
+
324
+ If the server understands the `Encoding` standard, it compresses files using `gzip` algorithm before the files are sent to the client. If so, the response will contain the following headers:
325
+ ```
326
+ Content-Encoding: gzip
327
+ Content-Encoding: compress
328
+ Content-Encoding: deflate
329
+ Content-Encoding: br
330
+ ```
331
+ So the data communication is compressed under the hood. The client will automatically decompress data before it's saved to a specified location path. So from JS API point of view, there is no requirement to decompress data by itself.
332
+
333
+ The standard is supported on all following platforms:
334
+
335
+ - WebOS 3+
336
+ - Tizen 2.4+
337
+ - Brightsign
338
+ - Raspberry Pi
339
+ - Windows
340
+
297
341
  ## deleteFile()
342
+
298
343
  Delete a file or directory from the path.
299
344
 
300
345
  * OK: (not recursive) Deletes an existing file or existing empty directory
@@ -310,6 +355,7 @@ Delete a file or directory from the path.
310
355
  | `recursive`| boolean | <div class="yellow">No</div> | `TRUE` for recursive delete of all content from a directory |
311
356
 
312
357
  ### Javascript Example
358
+
313
359
  ```javascript
314
360
  // Delete directory and all files inside
315
361
  //// First check, if there is such a directory
@@ -327,7 +373,9 @@ if (await sos.fileSystem.exists({ storageUnit: internalStorageUnit, filePath: 't
327
373
  ```
328
374
 
329
375
  ## moveFile()
376
+
330
377
  Move file OR directory to destination path or Move directory to destination path.
378
+
331
379
  * OK: Move file to destination path
332
380
  * OK: Move directory to destination path
333
381
  * FAIL: When destination path exists (is file or directory)
@@ -341,6 +389,7 @@ Move file OR directory to destination path or Move directory to destination path
341
389
  | `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
342
390
 
343
391
  ### Javascript Example
392
+
344
393
  ```javascript
345
394
  // Move file to a different directory
346
395
  //// First check, if there is such a file and directory
@@ -356,6 +405,7 @@ if (await sos.fileSystem.exists({ storageUnit: internalStorageUnit, filePath: 't
356
405
  ```
357
406
 
358
407
  ## getFileChecksum()
408
+
359
409
  Returns checksum of existing file in a path.
360
410
  * OK: Returns checksum of existing file in path
361
411
  * FAIL: When file path doesn't exist
@@ -373,17 +423,20 @@ Does not work on Samsung Tizen display - [read more here](knowledge-base/md5-tiz
373
423
  | `hashFunction` | string | <div class="red">Yes</div> | Available function is `md5` |
374
424
 
375
425
  ### Javascript Example
426
+
376
427
  ```javascript
377
428
  const md5Checksum = await sos.fileSystem.getFileChecksum({ storageUnit: internalStorageUnit, filePath: 'test-dir/log.1.txt.backup' }, 'md5');
378
429
  console.log(md5Checksum);
379
430
  ```
380
431
 
381
432
  ### Returns
433
+
382
434
  ```json
383
435
  "b3c6930b9306b8e35a978d342cf5a01e" // string
384
436
  ```
385
437
 
386
438
  ## extractFile()
439
+
387
440
  Extract ZIPed all files (recursively) to destination path and override existing files or merge existing directories.
388
441
 
389
442
  * OK: Extract ZIPed all files (recursively) to destination path
@@ -405,6 +458,7 @@ The directory/folder you are extracting your ZIP file into has to be created BEF
405
458
  | `archiveMethod` | string | <div class="red">Yes</div> | Available method is `zip` |
406
459
 
407
460
  ### Javascript Example
461
+
408
462
  ```javascript
409
463
  // Create directory 'test-dir' in a root directory
410
464
  await sos.fileSystem.createDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
@@ -418,6 +472,7 @@ await sos.fileSystem.extractFile(
418
472
  ```
419
473
 
420
474
  ## createDirectory()
475
+
421
476
  Creates a directory in a path.
422
477
 
423
478
  * OK: Creates directory in path
@@ -436,6 +491,7 @@ Creates a directory in a path.
436
491
  | `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
437
492
 
438
493
  ### Javascript Example
494
+
439
495
  ```javascript
440
496
  // Create directory 'test-dir' in a root directory
441
497
  await sos.fileSystem.createDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
@@ -458,6 +514,7 @@ await Promise.all(myDirs.map(async (dirname) => {
458
514
  ```
459
515
 
460
516
  ## isDirectory()
517
+
461
518
  Returns true if existing path is directory.
462
519
 
463
520
  * OK: Returns true if existing path is directory
@@ -471,11 +528,13 @@ Returns true if existing path is directory.
471
528
  | `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
472
529
 
473
530
  ### Javascript Example
531
+
474
532
  ```javascript
475
533
  await sos.fileSystem.isDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
476
534
  ```
477
535
 
478
536
  ## copyFile()
537
+
479
538
  Copy file OR directory to a new location.
480
539
 
481
540
  ### Parameters
@@ -486,6 +545,7 @@ Copy file OR directory to a new location.
486
545
  | `destinationFilePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
487
546
 
488
547
  ### Javascript Example
548
+
489
549
  ```javascript
490
550
  await sos.fileSystem.copyFile(
491
551
  { storageUnit: internalStorageUnit, filePath: 'test-dir/log.1.txt' },
@@ -494,16 +554,13 @@ await sos.fileSystem.copyFile(
494
554
  ```
495
555
 
496
556
  ## writeFile()
557
+
497
558
  Write into file directly:
559
+
498
560
  - string support only
499
561
  - override only
500
562
  - no append
501
563
 
502
- ::: alert alert--warning
503
- **LG webOS limitation**:
504
- It's possible to handle only files up to **~10KB** on webOS devices. At the moment we are working on the solution regarding the file/s 'manipulation' on LG devices.
505
- :::
506
-
507
564
  ### Parameters
508
565
 
509
566
  | Param | Type | Required | Description |
@@ -513,6 +570,7 @@ It's possible to handle only files up to **~10KB** on webOS devices. At the mome
513
570
 
514
571
 
515
572
  ### Javascript Example
573
+
516
574
  ```javascript
517
575
  await sos.fileSystem.writeFile(
518
576
  { storageUnit: internalStorageUnit, filePath: 'test-dir/log.txt' },
@@ -520,6 +578,30 @@ await sos.fileSystem.writeFile(
520
578
  );
521
579
  ```
522
580
 
581
+ ## appendFile()
582
+
583
+ Append content into file directly:
584
+
585
+ - string support only
586
+ - append only
587
+
588
+ ### Parameters
589
+
590
+ | Param | Type | Required | Description |
591
+ | ------ | -------- | :------: | ---- |
592
+ | `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
593
+ | `content` | String | <div class="red">Yes</div> | Parsed content as string |
594
+
595
+
596
+ ### Javascript Example
597
+
598
+ ```javascript
599
+ await sos.fileSystem.appendFile(
600
+ { storageUnit: internalStorageUnit, filePath: 'test-dir/log.txt' },
601
+ 'My awesome log line\n',
602
+ );
603
+ ```
604
+
523
605
  ## readFile()
524
606
  Read a text file.
525
607
 
@@ -23,6 +23,7 @@ Network management API allows you to manually set network interfaces or set back
23
23
  | `listInterfaces()` | Information about network interfaces | 4.9 |
24
24
  | `setManual()` | Allows you to set network settings manually | 4.0 |
25
25
  | `setDHCP()` | Allows you to set network settings automatically from DHCP | 4.0 |
26
+ | `disableInterface()` | Disables a network interface | 4.13 |
26
27
  :::
27
28
 
28
29
  ## getActiveInfo()
@@ -96,7 +97,8 @@ const interfaces = await sos.management.network.listInterfaces();
96
97
  {
97
98
  "type": "wifi",
98
99
  "name": "wlan0",
99
- "macAddress": "b8:27:eb:25:8f:63"
100
+ "macAddress": "b8:27:eb:25:8f:63",
101
+ "disabled": true,
100
102
  }
101
103
  ]
102
104
  ```
@@ -119,6 +121,11 @@ const interfaces = await sos.management.network.listInterfaces();
119
121
 
120
122
  ## setManual()
121
123
  Manually configures a network interface.
124
+ If the interface is disabled, it will be enabled.
125
+
126
+ ::: alert alert--warning
127
+ Wi-Fi interface can be configured with this method but it has to be first enabled via the [Wi-Fi API](/api/js/management/11-js-management-network).
128
+ :::
122
129
 
123
130
  ### Object properties
124
131
 
@@ -162,6 +169,11 @@ await sos.management.network.setManual({
162
169
 
163
170
  ## setDHCP()
164
171
  Configures a network interface to use DHCP to get an IP address asigned from the network.
172
+ If the interface is disabled, it will be enabled.
173
+
174
+ ::: alert alert--warning
175
+ Wi-Fi interface can be configured with this method but it has to be first enabled via the [Wi-Fi API](/api/js/management/11-js-management-network).
176
+ :::
165
177
 
166
178
  ### Object properties
167
179
 
@@ -183,3 +195,26 @@ await sos.management.network.setDHCP('eth0');
183
195
  // old way (deprecated)
184
196
  await sos.management.network.setDHCP('ethernet');
185
197
  ```
198
+
199
+ ## disableInterface()
200
+ Disables a network interface
201
+
202
+ ::: table-responsive
203
+ | Param | Type | Required | Description |
204
+ | --------------- | ------ | :------------------------: | ---------------------------------------------------- |
205
+ | `interfaceName` | String | <div class="red">Yes</div> | Name of the network interface, that will be disabled |
206
+ :::
207
+
208
+ ### Javascript example
209
+ ```javascript
210
+ await sos.management.wifi.disableInterface("eth0");
211
+ ```
212
+
213
+ ::: alert alert--info
214
+ A disabled network interface can be re-enabled simply by calling either `setDHCP()` or `setManual()`.
215
+ :::
216
+
217
+ ::: alert alert--warning
218
+ Don't use this method to disable Wi-Fi.
219
+ Use [Wi-Fi API](/api/js/management/11-js-management-network) to enable/disable Wi-Fi.
220
+ :::
@@ -191,6 +191,7 @@ It is only allowed to call this method in the **CLIENT** state.
191
191
  | ------------------- | ------ | :---------: | ---------------------------------- |
192
192
  | `ssid` | String | <div class="red">Yes</div> | Name of the network you want to connect to. |
193
193
  | `password` | String | <div class="yellow">No</div> | Network's password. |
194
+ | `options` | Object | <div class="yellow">No</div> | Additional options. |
194
195
  :::
195
196
 
196
197
  ### Javascript example
@@ -200,6 +201,9 @@ await sos.management.wifi.connect('network1');
200
201
 
201
202
  // or network with password
202
203
  await sos.management.wifi.connect('network2', 'password123');
204
+
205
+ // connect to a hidden network
206
+ await sos.management.wifi.connect('network3', 'password123', { hidden: true });
203
207
  ```
204
208
 
205
209
  ## disconnect()
@@ -117,17 +117,33 @@ Calling `setManual()` will disable NTP server settings.
117
117
  ::: table-responsive
118
118
  | Param |Type | Required | Description |
119
119
  | -------------- | ---------- | :---------: | ------------------- |
120
- | `currentDate` | Date | <div class="red">Yes</div> | Datetime to set |
120
+ | `currentDate` | Date \| object | <div class="red">Yes</div> | Datetime to set |
121
121
  | `timezone` | String | <div class="red">Yes</div> | Timezone to set. Accepted values are timezone names from [timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). |
122
122
  :::
123
123
 
124
124
  ### Javascript example
125
125
  ```javascript
126
+ const datetimeObj = {
127
+ year: 2021,
128
+ month: 12,
129
+ day: 15,
130
+ hour: 9,
131
+ minute: 30,
132
+ seconds: 0,
133
+ };
134
+ const timezone = "Europe/Amsterdam";
135
+ await sos.management.time.setManual(datetimeObj, timezone);
136
+
137
+ // Using Date is deprecated. Use the example above.
126
138
  const currentDate = new Date();
127
139
  const timezone = "Europe/Amsterdam";
128
140
  await sos.management.time.setManual(currentDate, timezone);
129
141
  ```
130
142
 
143
+ ::: alert alert--warning
144
+ Calling this method with currentDate as Date is deprecated.
145
+ You should call it with datetime object instead. See example code.
146
+ :::
131
147
 
132
148
  ::: alert alert--warning
133
149
  Setting time and timezone has side effects:
@@ -19,10 +19,12 @@ class Browser {
19
19
  this.events = new events_2.EventEmitter();
20
20
  }
21
21
  open(uri, options = {}) {
22
+ var _a;
22
23
  return __awaiter(this, void 0, void 0, function* () {
23
24
  Validate_1.default({ uri }).required().uri();
24
25
  Validate_1.default({ options }).required().object(IOpenLinkOptions_1.VIOpenLinkOptions);
25
- yield this.exchange.postMessage(Object.assign(Object.assign({ uri }, options), { type: 'open' }));
26
+ const headlessMode = (_a = options.headlessMode) !== null && _a !== void 0 ? _a : true;
27
+ yield this.exchange.postMessage(Object.assign(Object.assign({ uri }, options), { headlessMode, type: 'open' }));
26
28
  });
27
29
  }
28
30
  close() {
@@ -65,7 +67,7 @@ class Browser {
65
67
  console.warn('sos.browser.openLink() is deprecated and will be removed in the future versions. Use sos.browser.open() instead.');
66
68
  Validate_1.default({ uri }).required().uri();
67
69
  Validate_1.default({ options }).required().object();
68
- yield this.exchange.postMessage(Object.assign(Object.assign({ uri }, options), { type: 'open_link' }));
70
+ yield this.exchange.postMessage(Object.assign(Object.assign({ uri }, options), { headlessMode: false, type: 'open_link' }));
69
71
  });
70
72
  }
71
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Browser.js","sourceRoot":"","sources":["../../../src/FrontApplet/Browser/Browser.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,yDAAmF;AAEnF,mDAA4C;AAC5C,qCAA8D;AAC9D,mCAAsC;AAItC,MAAqB,OAAO;IAI3B,YACkB,QAAwB;QAAxB,aAAQ,GAAR,QAAQ,CAAgB;QAHzB,WAAM,GAAiB,IAAI,qBAAY,EAAE,CAAC;IAK3D,CAAC;IAEY,IAAI,CAAC,GAAW,EAAE,UAA4B,EAAE;;YAC5D,kBAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC;YACnC,kBAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,oCAAiB,CAAC,CAAC;YAE3D,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,+BAC9B,GAAG,IACA,OAAO,KACV,IAAI,EAAE,MAAM,IACX,CAAC;QACJ,CAAC;KAAA;IAEY,KAAK;;YACjB,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;gBAC/B,IAAI,EAAE,OAAO;aACb,CAAC,CAAC;QACJ,CAAC;KAAA;IAED;;;;;;;OAOG;IACI,OAAO,CAAC,QAAqC;QACnD,kBAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;QAE7C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACnD,OAAO,GAAG,EAAE;YAC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SACR;IACF,CAAC;IAED,iDAAiD;IACpC,QAAQ,CACpB,GAAW,EACX,UAAsC,EAAE;;YAExC,OAAO,CAAC,IAAI,CAAC,kHAAkH,CAAC,CAAC;YAEjI,kBAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC;YACnC,kBAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAE1C,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,+BAC9B,GAAG,IACA,OAAO,KACV,YAAY,EAAE,KAAK,EACnB,IAAI,EAAE,WAAW,IAChB,CAAC;QACJ,CAAC;KAAA;CACD;AA3ED,0BA2EC"}
@@ -93,6 +93,7 @@ interface IOpenLinkOptions {
93
93
  aclDomains?: string[];
94
94
  aclMode?: 'blacklist' | 'whitelist';
95
95
  readOnlyAddressBar?: boolean;
96
+ idleTimeout?: number;
96
97
  coordinates?: {
97
98
  x: number;
98
99
  y: number;
@@ -100,6 +101,9 @@ interface IOpenLinkOptions {
100
101
  height: number;
101
102
  };
102
103
  theme?: ITheme;
104
+ headlessMode?: boolean;
105
+ clearData?: boolean;
106
+ canUserClose?: boolean;
103
107
  }
104
108
  export default IOpenLinkOptions;
105
109
  export declare const VIOpenLinkOptions: {
@@ -110,6 +114,7 @@ export declare const VIOpenLinkOptions: {
110
114
  '?string': string[];
111
115
  };
112
116
  readOnlyAddressBar: string;
117
+ idleTimeout: string;
113
118
  coordinates: {
114
119
  '?object': {
115
120
  x: string;
@@ -171,4 +176,7 @@ export declare const VIOpenLinkOptions: {
171
176
  };
172
177
  };
173
178
  };
179
+ headlessMode: string;
180
+ clearData: string;
181
+ canUserClose: string;
174
182
  };
@@ -43,6 +43,7 @@ exports.VIOpenLinkOptions = {
43
43
  aclDomains: { '?array': 'string' },
44
44
  aclMode: { '?string': ['blacklist', 'whitelist'] },
45
45
  readOnlyAddressBar: '?boolean',
46
+ idleTimeout: '?number',
46
47
  coordinates: { '?object': {
47
48
  x: 'number',
48
49
  y: 'number',
@@ -51,5 +52,8 @@ exports.VIOpenLinkOptions = {
51
52
  }
52
53
  },
53
54
  theme: { '?object': exports.VITheme },
55
+ headlessMode: '?boolean',
56
+ clearData: '?boolean',
57
+ canUserClose: '?boolean',
54
58
  };
55
59
  //# sourceMappingURL=IOpenLinkOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IOpenLinkOptions.js","sourceRoot":"","sources":["../../../src/FrontApplet/Browser/IOpenLinkOptions.ts"],"names":[],"mappings":";;AAmCa,QAAA,OAAO,GAAG;IACtB,IAAI,EAAE,EAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAC;IACpC,KAAK,EAAE,EAAC,SAAS,EAAE;YACjB,UAAU,EAAE,SAAS;SACrB;KACD;IACD,MAAM,EAAE,EAAC,SAAS,EAAE;YAClB,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE,SAAS;SAClB;KACD;IACD,OAAO,EAAE,EAAC,SAAS,EAAE;YACnB,WAAW,EAAE,EAAC,SAAS,EAAE;oBACvB,MAAM,EAAE,EAAC,SAAS,EAAE;4BAClB,UAAU,EAAE,SAAS;4BACrB,IAAI,EAAE,SAAS;yBACf;qBACD;iBACD;aACD;YACD,WAAW,EAAE,EAAC,SAAS,EAAE;oBACvB,MAAM,EAAE,EAAC,SAAS,EAAE;4BAClB,UAAU,EAAE,SAAS;4BACrB,IAAI,EAAE,SAAS;4BACf,IAAI,EAAE,SAAS;yBACf;qBACD;oBACD,IAAI,EAAE,EAAC,SAAS,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAC;oBAC7D,IAAI,EAAE,SAAS;iBACf;aACD;YACD,QAAQ,EAAE,EAAC,SAAS,EAAE;oBACpB,KAAK,EAAE,SAAS;iBAChB;aACD;SACD;KACD;CACD,CAAC;AA0BW,QAAA,iBAAiB,GAAG;IAChC,UAAU,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC;IAChC,OAAO,EAAE,EAAC,SAAS,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAC;IAChD,kBAAkB,EAAE,UAAU;IAC9B,WAAW,EAAE,EAAC,SAAS,EAAE;YACvB,CAAC,EAAE,QAAQ;YACX,CAAC,EAAE,QAAQ;YACX,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,QAAQ;SAChB;KACD;IACD,KAAK,EAAE,EAAC,SAAS,EAAE,eAAO,EAAC;CAC3B,CAAC"}
1
+ {"version":3,"file":"IOpenLinkOptions.js","sourceRoot":"","sources":["../../../src/FrontApplet/Browser/IOpenLinkOptions.ts"],"names":[],"mappings":";;AAmCa,QAAA,OAAO,GAAG;IACtB,IAAI,EAAE,EAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAC;IACpC,KAAK,EAAE,EAAC,SAAS,EAAE;YACjB,UAAU,EAAE,SAAS;SACrB;KACD;IACD,MAAM,EAAE,EAAC,SAAS,EAAE;YAClB,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE,SAAS;SAClB;KACD;IACD,OAAO,EAAE,EAAC,SAAS,EAAE;YACnB,WAAW,EAAE,EAAC,SAAS,EAAE;oBACvB,MAAM,EAAE,EAAC,SAAS,EAAE;4BAClB,UAAU,EAAE,SAAS;4BACrB,IAAI,EAAE,SAAS;yBACf;qBACD;iBACD;aACD;YACD,WAAW,EAAE,EAAC,SAAS,EAAE;oBACvB,MAAM,EAAE,EAAC,SAAS,EAAE;4BAClB,UAAU,EAAE,SAAS;4BACrB,IAAI,EAAE,SAAS;4BACf,IAAI,EAAE,SAAS;yBACf;qBACD;oBACD,IAAI,EAAE,EAAC,SAAS,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAC;oBAC7D,IAAI,EAAE,SAAS;iBACf;aACD;YACD,QAAQ,EAAE,EAAC,SAAS,EAAE;oBACpB,KAAK,EAAE,SAAS;iBAChB;aACD;SACD;KACD;CACD,CAAC;AA8BW,QAAA,iBAAiB,GAAG;IAChC,UAAU,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC;IAChC,OAAO,EAAE,EAAC,SAAS,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAC;IAChD,kBAAkB,EAAE,UAAU;IAC9B,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,EAAC,SAAS,EAAE;YACvB,CAAC,EAAE,QAAQ;YACX,CAAC,EAAE,QAAQ;YACX,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,QAAQ;SAChB;KACD;IACD,KAAK,EAAE,EAAC,SAAS,EAAE,eAAO,EAAC;IAC3B,YAAY,EAAE,UAAU;IACxB,SAAS,EAAE,UAAU;IACrB,YAAY,EAAE,UAAU;CACxB,CAAC"}
@@ -1,4 +1,4 @@
1
- import IPostMessage from "FrontApplet/IPostMessage";
1
+ import IPostMessage from "../../FrontApplet/IPostMessage";
2
2
  export default interface Exchange<TResponse> {
3
3
  postMessage: IPostMessage<TResponse>;
4
4
  messageNameToType(name: string): string;
@@ -15,6 +15,7 @@ export default class FileSystem {
15
15
  exists(filePath: IFilePath): Promise<boolean>;
16
16
  getFile(filePath: IFilePath): Promise<IFile | null>;
17
17
  writeFile(filePath: IFilePath, contents: string): Promise<void>;
18
+ appendFile(filePath: IFilePath, contents: string): Promise<void>;
18
19
  readFile(filePath: IFilePath): Promise<string>;
19
20
  copyFile(sourceFilePath: IFilePath, destinationFilePath: IFilePath, options?: ICopyFileOptions): Promise<void>;
20
21
  moveFile(sourceFilePath: IFilePath, destinationFilePath: IFilePath, options?: IMoveFileOptions): Promise<void>;