iobroker.fakeroku 1.8.0 → 1.8.2
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 +21 -22
- package/admin/i18n/de.json +8 -0
- package/admin/i18n/en.json +8 -0
- package/admin/i18n/es.json +8 -0
- package/admin/i18n/fr.json +8 -0
- package/admin/i18n/it.json +8 -0
- package/admin/i18n/nl.json +8 -0
- package/admin/i18n/pl.json +8 -0
- package/admin/i18n/pt.json +8 -0
- package/admin/i18n/ru.json +8 -0
- package/admin/i18n/uk.json +8 -0
- package/admin/i18n/zh-cn.json +8 -0
- package/build/command-handler.js +172 -0
- package/build/command-handler.js.map +7 -0
- package/build/device-management.js +6 -7
- package/build/device-management.js.map +2 -2
- package/build/discovery/ssdp-messages.js +11 -6
- package/build/discovery/ssdp-messages.js.map +2 -2
- package/build/discovery/ssdp-responder.js +50 -48
- package/build/discovery/ssdp-responder.js.map +2 -2
- package/build/ecp/device-info.js +3 -6
- package/build/ecp/device-info.js.map +2 -2
- package/build/ecp/ecp-command.js +0 -3
- package/build/ecp/ecp-command.js.map +2 -2
- package/build/ecp/ecp-http-server.js +20 -27
- package/build/ecp/ecp-http-server.js.map +2 -2
- package/build/lib/constants.js +10 -2
- package/build/lib/constants.js.map +2 -2
- package/build/lib/detect-ip.js +17 -59
- package/build/lib/detect-ip.js.map +3 -3
- package/build/lib/device-config.js +6 -10
- package/build/lib/device-config.js.map +2 -2
- package/build/lib/device-identity.js.map +1 -1
- package/build/lib/{errors.js → err-text.js} +4 -4
- package/build/lib/err-text.js.map +7 -0
- package/build/lib/i18n.js +9 -4
- package/build/lib/i18n.js.map +2 -2
- package/build/lib/known-objects.js +227 -0
- package/build/lib/known-objects.js.map +7 -0
- package/build/lib/lan-guard.js +1 -1
- package/build/lib/lan-guard.js.map +2 -2
- package/build/lib/log-throttle.js +53 -0
- package/build/lib/log-throttle.js.map +7 -0
- package/build/lib/native-key-migration.js +44 -11
- package/build/lib/native-key-migration.js.map +2 -2
- package/build/lib/pure-helpers.js +4 -1
- package/build/lib/pure-helpers.js.map +2 -2
- package/build/main.js +204 -261
- package/build/main.js.map +2 -2
- package/io-package.json +51 -51
- package/package.json +5 -5
- package/build/lib/errors.js.map +0 -7
package/README.md
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
**Support:** [](https://ko-fi.com/krobipd) [](https://paypal.me/krobipd)
|
|
8
8
|
|
|
9
|
+
> [!IMPORTANT]
|
|
10
|
+
> This adapter cannot be installed from github
|
|
11
|
+
|
|
9
12
|
Emulates one or more **[Roku](https://www.roku.com/) devices** on your LAN so that ECP/SSDP remotes and
|
|
10
13
|
controllers — a Logitech Harmony Hub, a Sofabaton X1/X2, Home Assistant's Roku integration,
|
|
11
14
|
openHAB — can trigger events in ioBroker. It is the **input** counterpart to the Logitech
|
|
@@ -20,6 +23,8 @@ so they accept the emulated device instead of giving up on it.
|
|
|
20
23
|
> implement. Use a Harmony hub or a Sofabaton — those speak the classic ECP this
|
|
21
24
|
> adapter serves.
|
|
22
25
|
|
|
26
|
+
[🇺🇸 Documentation](./docs/en/README.md) · [🇩🇪 Dokumentation](./docs/de/README.md)
|
|
27
|
+
|
|
23
28
|
## Features
|
|
24
29
|
|
|
25
30
|
- Emulates one or more Roku devices on the LAN — the Roku control protocol (ECP) over HTTP plus SSDP discovery on port 1900.
|
|
@@ -29,7 +34,7 @@ so they accept the emulated device instead of giving up on it.
|
|
|
29
34
|
|
|
30
35
|
## Sentry / Error reporting
|
|
31
36
|
|
|
32
|
-
**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** Reporting
|
|
37
|
+
**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** Reporting is active by default. It stays off when the ioBroker diagnostics setting is `none` (`diag` in the system configuration), when data reporting is disabled for this instance or its host (`disableDataReporting`), and on CI systems. A report contains the error with its stack trace and technical context such as versions and platform, plus an anonymous installation ID.
|
|
33
38
|
|
|
34
39
|
For details and how to disable it, see the [Sentry plugin documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry). Error reporting requires js-controller 3.0 or newer.
|
|
35
40
|
|
|
@@ -37,13 +42,11 @@ For details and how to disable it, see the [Sentry plugin documentation](https:/
|
|
|
37
42
|
|
|
38
43
|
- Node.js >= 22
|
|
39
44
|
- js-controller >= 7.2.2
|
|
40
|
-
- admin >= 8.0.
|
|
41
|
-
|
|
42
|
-
> The adapter CANNOT be installed via GitHub: The adapter must be installed via the ioBroker repository (stable or latest).
|
|
45
|
+
- admin >= 8.0.14
|
|
43
46
|
|
|
44
47
|
## Ports
|
|
45
48
|
|
|
46
|
-
- **TCP 8060 (listening, one per emulated Roku, configurable)** — the Roku control protocol (ECP): the remote sends its key presses here.
|
|
49
|
+
- **TCP 8060 (listening, one per emulated Roku, configurable)** — the Roku control protocol (ECP): the remote sends its key presses here.
|
|
47
50
|
- **UDP 1900 (multicast, listening and outgoing)** — SSDP discovery, so a Harmony hub or Sofabaton finds the emulated Rokus; fixed by the UPnP standard.
|
|
48
51
|
|
|
49
52
|
## Configuration
|
|
@@ -100,6 +103,19 @@ becomes `true` — or watch `.command` for the last button as text.
|
|
|
100
103
|
Placeholder for the next version (at the beginning of the line):
|
|
101
104
|
### **WORK IN PROGRESS**
|
|
102
105
|
-->
|
|
106
|
+
### 1.8.2 (2026-10-02)
|
|
107
|
+
|
|
108
|
+
- (krobipd) Changed: a new instance starts switched off — check the settings, then switch it on.
|
|
109
|
+
- (krobipd) Fixed: the README and the user documentation name admin 8.0.14, the version the adapter actually requires.
|
|
110
|
+
- (krobipd) Fixed: the device manager answers right after a restart instead of failing until the translations are loaded.
|
|
111
|
+
- (krobipd) Improved: the type of the last command shows a readable label in the language you set instead of a protocol word.
|
|
112
|
+
- (krobipd) Improved: a start writes only datapoints that changed and reads the key states in one request — no needless updates for history adapters.
|
|
113
|
+
- (krobipd) Improved: the README links the detailed user documentation in English and German.
|
|
114
|
+
|
|
115
|
+
### 1.8.1 (2026-09-27)
|
|
116
|
+
|
|
117
|
+
- (krobipd) Improved: the note the Admin shows before an update from 0.x is short now: the apps folder is removed, app launches arrive as launch:<id> in command.
|
|
118
|
+
|
|
103
119
|
### 1.8.0 (2026-09-25)
|
|
104
120
|
|
|
105
121
|
- (krobipd) Fixed: Home Assistant and openHAB can set up the emulated Roku again — it now answers the active-app, media-player and TV-channel queries they send.
|
|
@@ -127,23 +143,6 @@ becomes `true` — or watch `.command` for the last button as text.
|
|
|
127
143
|
- (krobipd) Improved: after the host gets a new IP address, remotes find the emulated Rokus again without restarting the instance.
|
|
128
144
|
- (krobipd) Changed: the network interface setting moved to the standard settings key (bind); the instance restarts once after this update.
|
|
129
145
|
|
|
130
|
-
### 1.6.1 (2026-09-07) — stable
|
|
131
|
-
|
|
132
|
-
- (krobipd) Changed: installing straight from GitHub is no longer offered — the adapter is built before publishing, so it is installed from the ioBroker repository instead.
|
|
133
|
-
|
|
134
|
-
### 1.6.0 (2026-09-07)
|
|
135
|
-
|
|
136
|
-
- (krobipd) Fixed: saving a device in the admin could change its identity on the network, so a paired Harmony or Sofabaton lost it.
|
|
137
|
-
- (krobipd) Fixed: with the device list open twice, editing or deleting a card could hit a different emulated Roku than the one clicked.
|
|
138
|
-
- (krobipd) Fixed: releasing a key was dropped while the adapter shed a flood of commands, so the key could stay pressed for half a minute.
|
|
139
|
-
- (krobipd) Fixed: an ECP port still held after a restart left that device dead until you restarted the instance; it is retried every minute now.
|
|
140
|
-
- (krobipd) Fixed: stopping the instance now takes the emulated Rokus out of the remote's list instead of leaving them there for up to an hour.
|
|
141
|
-
- (krobipd) Fixed: an emulated Roku whose server died is no longer offered for discovery.
|
|
142
|
-
- (krobipd) Fixed: a configured port no server can bind falls back to 8060 instead of leaving the device unstarted.
|
|
143
|
-
- (krobipd) Changed: the device dialog refuses a reserved or colliding name right away instead of reporting it after saving.
|
|
144
|
-
- (krobipd) Changed: the adapter can now run in compact mode, sharing one process with other adapters instead of claiming its own.
|
|
145
|
-
- (krobipd) Changed: more than one instance may run on the same machine again; only the ports have to differ.
|
|
146
|
-
|
|
147
146
|
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
148
147
|
|
|
149
148
|
## History
|
package/admin/i18n/de.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "Der zuletzt empfangene Befehl dieses emulierten Roku als Klartext.",
|
|
33
33
|
"stateLastCommandType": "Art des letzten Befehls",
|
|
34
34
|
"stateLastCommandTypeDesc": "Um welche Art Befehl es sich handelte: Tastendruck, Taste gehalten oder losgelassen, App-Start oder -Installation, Texteingabe oder Suche.",
|
|
35
|
+
"commandType_none": "Noch kein Befehl",
|
|
36
|
+
"commandType_keypress": "Tastendruck",
|
|
37
|
+
"commandType_keydown": "Taste gehalten",
|
|
38
|
+
"commandType_keyup": "Taste losgelassen",
|
|
39
|
+
"commandType_launch": "App-Start",
|
|
40
|
+
"commandType_install": "App-Installation",
|
|
41
|
+
"commandType_input": "Texteingabe",
|
|
42
|
+
"commandType_search": "Suche",
|
|
35
43
|
"channelKeys": "Fernbedienungstasten",
|
|
36
44
|
"channelKeysDesc": "Ein Datenpunkt je Taste, die dieses Gerät anbietet; ein Tastendruck setzt ihn kurz auf wahr."
|
|
37
45
|
}
|
package/admin/i18n/en.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "The most recent command this emulated Roku received, as plain text.",
|
|
33
33
|
"stateLastCommandType": "Last command type",
|
|
34
34
|
"stateLastCommandTypeDesc": "What kind of command it was: a key press, a key held or released, an app launch or install, a text input or a search.",
|
|
35
|
+
"commandType_none": "No command yet",
|
|
36
|
+
"commandType_keypress": "Key press",
|
|
37
|
+
"commandType_keydown": "Key held",
|
|
38
|
+
"commandType_keyup": "Key released",
|
|
39
|
+
"commandType_launch": "App launch",
|
|
40
|
+
"commandType_install": "App install",
|
|
41
|
+
"commandType_input": "Text input",
|
|
42
|
+
"commandType_search": "Search",
|
|
35
43
|
"channelKeys": "Remote keys",
|
|
36
44
|
"channelKeysDesc": "One state per remote key this device offers; a key press pulses it briefly."
|
|
37
45
|
}
|
package/admin/i18n/es.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "El comando más reciente que recibió este Roku emulado, como texto simple.",
|
|
33
33
|
"stateLastCommandType": "Tipo del último comando",
|
|
34
34
|
"stateLastCommandTypeDesc": "Qué tipo de comando fue: pulsar una tecla, mantenerla o soltarla, iniciar o instalar una aplicación, introducir texto o buscar.",
|
|
35
|
+
"commandType_none": "Aún sin comando",
|
|
36
|
+
"commandType_keypress": "Pulsación de tecla",
|
|
37
|
+
"commandType_keydown": "Tecla mantenida",
|
|
38
|
+
"commandType_keyup": "Tecla soltada",
|
|
39
|
+
"commandType_launch": "Inicio de app",
|
|
40
|
+
"commandType_install": "Instalación de app",
|
|
41
|
+
"commandType_input": "Entrada de texto",
|
|
42
|
+
"commandType_search": "Búsqueda",
|
|
35
43
|
"channelKeys": "Teclas del mando",
|
|
36
44
|
"channelKeysDesc": "Un estado por cada tecla que ofrece este dispositivo; una pulsación lo pone brevemente en verdadero."
|
|
37
45
|
}
|
package/admin/i18n/fr.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "La commande la plus récente reçue par ce Roku émulé, en texte brut.",
|
|
33
33
|
"stateLastCommandType": "Type de la dernière commande",
|
|
34
34
|
"stateLastCommandTypeDesc": "De quel type de commande il s'agissait : appui sur une touche, touche maintenue ou relâchée, lancement ou installation d'une application, saisie de texte ou recherche.",
|
|
35
|
+
"commandType_none": "Aucune commande pour l'instant",
|
|
36
|
+
"commandType_keypress": "Appui sur une touche",
|
|
37
|
+
"commandType_keydown": "Touche maintenue",
|
|
38
|
+
"commandType_keyup": "Touche relâchée",
|
|
39
|
+
"commandType_launch": "Lancement d'appli",
|
|
40
|
+
"commandType_install": "Installation d'appli",
|
|
41
|
+
"commandType_input": "Saisie de texte",
|
|
42
|
+
"commandType_search": "Recherche",
|
|
35
43
|
"channelKeys": "Touches de la télécommande",
|
|
36
44
|
"channelKeysDesc": "Un état par touche proposée par cet appareil ; un appui le met brièvement à vrai."
|
|
37
45
|
}
|
package/admin/i18n/it.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "Il comando più recente ricevuto da questo Roku emulato, come testo semplice.",
|
|
33
33
|
"stateLastCommandType": "Tipo dell'ultimo comando",
|
|
34
34
|
"stateLastCommandTypeDesc": "Di che tipo di comando si trattava: pressione di un tasto, tasto tenuto premuto o rilasciato, avvio o installazione di un'app, immissione di testo o ricerca.",
|
|
35
|
+
"commandType_none": "Ancora nessun comando",
|
|
36
|
+
"commandType_keypress": "Pressione tasto",
|
|
37
|
+
"commandType_keydown": "Tasto tenuto premuto",
|
|
38
|
+
"commandType_keyup": "Tasto rilasciato",
|
|
39
|
+
"commandType_launch": "Avvio app",
|
|
40
|
+
"commandType_install": "Installazione app",
|
|
41
|
+
"commandType_input": "Inserimento testo",
|
|
42
|
+
"commandType_search": "Ricerca",
|
|
35
43
|
"channelKeys": "Tasti del telecomando",
|
|
36
44
|
"channelKeysDesc": "Uno stato per ogni tasto offerto da questo dispositivo; una pressione lo porta brevemente a vero."
|
|
37
45
|
}
|
package/admin/i18n/nl.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "De meest recente opdracht die deze geëmuleerde Roku ontving, als platte tekst.",
|
|
33
33
|
"stateLastCommandType": "Type laatste opdracht",
|
|
34
34
|
"stateLastCommandTypeDesc": "Wat voor soort opdracht het was: een toetsdruk, een toets ingedrukt of losgelaten, een app starten of installeren, tekstinvoer of zoeken.",
|
|
35
|
+
"commandType_none": "Nog geen opdracht",
|
|
36
|
+
"commandType_keypress": "Toetsdruk",
|
|
37
|
+
"commandType_keydown": "Toets vastgehouden",
|
|
38
|
+
"commandType_keyup": "Toets losgelaten",
|
|
39
|
+
"commandType_launch": "App starten",
|
|
40
|
+
"commandType_install": "App installeren",
|
|
41
|
+
"commandType_input": "Tekstinvoer",
|
|
42
|
+
"commandType_search": "Zoeken",
|
|
35
43
|
"channelKeys": "Afstandsbedieningstoetsen",
|
|
36
44
|
"channelKeysDesc": "Eén status per toets die dit apparaat biedt; een toetsdruk zet hem kort op waar."
|
|
37
45
|
}
|
package/admin/i18n/pl.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "Najnowsze polecenie odebrane przez ten emulowany Roku, jako zwykły tekst.",
|
|
33
33
|
"stateLastCommandType": "Typ ostatniego polecenia",
|
|
34
34
|
"stateLastCommandTypeDesc": "Jakiego rodzaju było to polecenie: naciśnięcie klawisza, przytrzymanie lub zwolnienie, uruchomienie lub instalacja aplikacji, wpisanie tekstu albo wyszukiwanie.",
|
|
35
|
+
"commandType_none": "Jeszcze brak polecenia",
|
|
36
|
+
"commandType_keypress": "Naciśnięcie klawisza",
|
|
37
|
+
"commandType_keydown": "Klawisz przytrzymany",
|
|
38
|
+
"commandType_keyup": "Klawisz zwolniony",
|
|
39
|
+
"commandType_launch": "Uruchomienie aplikacji",
|
|
40
|
+
"commandType_install": "Instalacja aplikacji",
|
|
41
|
+
"commandType_input": "Wprowadzanie tekstu",
|
|
42
|
+
"commandType_search": "Wyszukiwanie",
|
|
35
43
|
"channelKeys": "Klawisze pilota",
|
|
36
44
|
"channelKeysDesc": "Jeden stan na każdy klawisz oferowany przez to urządzenie; naciśnięcie ustawia go na krótko na wartość true."
|
|
37
45
|
}
|
package/admin/i18n/pt.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "O comando mais recente recebido por este Roku emulado, em texto simples.",
|
|
33
33
|
"stateLastCommandType": "Tipo do último comando",
|
|
34
34
|
"stateLastCommandTypeDesc": "Que tipo de comando foi: pressionar uma tecla, manter ou soltar, iniciar ou instalar uma aplicação, introduzir texto ou pesquisar.",
|
|
35
|
+
"commandType_none": "Ainda sem comando",
|
|
36
|
+
"commandType_keypress": "Toque de tecla",
|
|
37
|
+
"commandType_keydown": "Tecla mantida",
|
|
38
|
+
"commandType_keyup": "Tecla solta",
|
|
39
|
+
"commandType_launch": "Abrir aplicação",
|
|
40
|
+
"commandType_install": "Instalar aplicação",
|
|
41
|
+
"commandType_input": "Entrada de texto",
|
|
42
|
+
"commandType_search": "Pesquisa",
|
|
35
43
|
"channelKeys": "Teclas do comando",
|
|
36
44
|
"channelKeysDesc": "Um estado por cada tecla que este dispositivo oferece; uma pressão coloca-o brevemente a verdadeiro."
|
|
37
45
|
}
|
package/admin/i18n/ru.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "Последняя команда, полученная этим эмулированным Roku, в виде текста.",
|
|
33
33
|
"stateLastCommandType": "Тип последней команды",
|
|
34
34
|
"stateLastCommandTypeDesc": "Какого рода была команда: нажатие кнопки, удержание или отпускание, запуск или установка приложения, ввод текста или поиск.",
|
|
35
|
+
"commandType_none": "Команд ещё не было",
|
|
36
|
+
"commandType_keypress": "Нажатие клавиши",
|
|
37
|
+
"commandType_keydown": "Клавиша удерживается",
|
|
38
|
+
"commandType_keyup": "Клавиша отпущена",
|
|
39
|
+
"commandType_launch": "Запуск приложения",
|
|
40
|
+
"commandType_install": "Установка приложения",
|
|
41
|
+
"commandType_input": "Ввод текста",
|
|
42
|
+
"commandType_search": "Поиск",
|
|
35
43
|
"channelKeys": "Кнопки пульта",
|
|
36
44
|
"channelKeysDesc": "По одному состоянию на каждую кнопку пульта этого устройства; нажатие кратко переводит его в истину."
|
|
37
45
|
}
|
package/admin/i18n/uk.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "Найновіша команда, яку отримав цей емульований Roku, у вигляді тексту.",
|
|
33
33
|
"stateLastCommandType": "Тип останньої команди",
|
|
34
34
|
"stateLastCommandTypeDesc": "Якого роду була команда: натискання кнопки, утримання чи відпускання, запуск або встановлення застосунку, введення тексту чи пошук.",
|
|
35
|
+
"commandType_none": "Команд ще не було",
|
|
36
|
+
"commandType_keypress": "Натискання клавіші",
|
|
37
|
+
"commandType_keydown": "Клавіша утримується",
|
|
38
|
+
"commandType_keyup": "Клавішу відпущено",
|
|
39
|
+
"commandType_launch": "Запуск застосунку",
|
|
40
|
+
"commandType_install": "Встановлення застосунку",
|
|
41
|
+
"commandType_input": "Введення тексту",
|
|
42
|
+
"commandType_search": "Пошук",
|
|
35
43
|
"channelKeys": "Кнопки пульта",
|
|
36
44
|
"channelKeysDesc": "По одному стану на кожну кнопку, яку пропонує цей пристрій; натискання ненадовго переводить його в істину."
|
|
37
45
|
}
|
package/admin/i18n/zh-cn.json
CHANGED
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"stateLastCommandDesc": "该模拟 Roku 最近收到的命令,以纯文本表示。",
|
|
33
33
|
"stateLastCommandType": "最后一条命令的类型",
|
|
34
34
|
"stateLastCommandTypeDesc": "命令的种类:按键、按住或松开按键、启动或安装应用、输入文本或搜索。",
|
|
35
|
+
"commandType_none": "尚无命令",
|
|
36
|
+
"commandType_keypress": "按键",
|
|
37
|
+
"commandType_keydown": "按住按键",
|
|
38
|
+
"commandType_keyup": "松开按键",
|
|
39
|
+
"commandType_launch": "启动应用",
|
|
40
|
+
"commandType_install": "安装应用",
|
|
41
|
+
"commandType_input": "文本输入",
|
|
42
|
+
"commandType_search": "搜索",
|
|
35
43
|
"channelKeys": "遥控器按键",
|
|
36
44
|
"channelKeysDesc": "该设备提供的每个遥控器按键各有一个状态;按下时会短暂置为真。"
|
|
37
45
|
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var command_handler_exports = {};
|
|
20
|
+
__export(command_handler_exports, {
|
|
21
|
+
CommandHandler: () => CommandHandler,
|
|
22
|
+
HOLD_MAX_MS: () => HOLD_MAX_MS,
|
|
23
|
+
KEY_PULSE_MS: () => KEY_PULSE_MS,
|
|
24
|
+
MAX_COMMANDS_PER_SECOND: () => MAX_COMMANDS_PER_SECOND,
|
|
25
|
+
RATE_WARN_INTERVAL_MS: () => RATE_WARN_INTERVAL_MS
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(command_handler_exports);
|
|
28
|
+
var import_state_model = require("./ecp/state-model");
|
|
29
|
+
var import_log_throttle = require("./lib/log-throttle");
|
|
30
|
+
var import_rate_gate = require("./lib/rate-gate");
|
|
31
|
+
const KEY_PULSE_MS = 50;
|
|
32
|
+
const HOLD_MAX_MS = 3e4;
|
|
33
|
+
const MAX_COMMANDS_PER_SECOND = 25;
|
|
34
|
+
const RATE_WARN_INTERVAL_MS = 6e4;
|
|
35
|
+
class CommandHandler {
|
|
36
|
+
/**
|
|
37
|
+
* @param host the adapter's writer, timers and log
|
|
38
|
+
*/
|
|
39
|
+
constructor(host) {
|
|
40
|
+
this.host = host;
|
|
41
|
+
}
|
|
42
|
+
host;
|
|
43
|
+
pulseTimers = /* @__PURE__ */ new Set();
|
|
44
|
+
/** Per held key id, its watchdog timer — so a keydown without a keyup cannot pin it true forever. */
|
|
45
|
+
holdTimers = /* @__PURE__ */ new Map();
|
|
46
|
+
gates = /* @__PURE__ */ new Map();
|
|
47
|
+
rateWarnings = new import_log_throttle.LogThrottle(RATE_WARN_INTERVAL_MS);
|
|
48
|
+
/**
|
|
49
|
+
* Apply a received ECP command to the device's states: record it in `command` / `commandType`, and pulse or hold
|
|
50
|
+
* the standard key if the device carries it. The server logs only what this accepted, so the rate gate covers the
|
|
51
|
+
* log as well as the states database.
|
|
52
|
+
*
|
|
53
|
+
* @param device the emulated Roku the command is for
|
|
54
|
+
* @param cmd the parsed ECP command
|
|
55
|
+
* @returns true if the command was applied, false if the rate gate dropped it
|
|
56
|
+
*/
|
|
57
|
+
apply(device, cmd) {
|
|
58
|
+
var _a;
|
|
59
|
+
const write = (0, import_state_model.commandToStateWrite)(cmd);
|
|
60
|
+
const releaseOf = ((_a = write.holdKey) == null ? void 0 : _a.value) === false ? `${device.id}.keys.${write.holdKey.key}` : null;
|
|
61
|
+
const isRelease = releaseOf !== null && this.holdTimers.has(releaseOf);
|
|
62
|
+
if (!isRelease && !this.admit(device)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
this.host.writeState(`${device.id}.command`, write.command);
|
|
66
|
+
this.host.writeState(`${device.id}.commandType`, write.commandType);
|
|
67
|
+
if (write.pulseKey && device.keys.has(write.pulseKey)) {
|
|
68
|
+
this.pulse(`${device.id}.keys.${write.pulseKey}`);
|
|
69
|
+
} else if (write.holdKey && device.keys.has(write.holdKey.key)) {
|
|
70
|
+
this.hold(`${device.id}.keys.${write.holdKey.key}`, write.holdKey.value);
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
/** Disarm every timer — the adapter is going down. */
|
|
75
|
+
dispose() {
|
|
76
|
+
for (const timer of this.pulseTimers) {
|
|
77
|
+
this.host.clearTimeout(timer);
|
|
78
|
+
}
|
|
79
|
+
this.pulseTimers.clear();
|
|
80
|
+
for (const timer of this.holdTimers.values()) {
|
|
81
|
+
this.host.clearTimeout(timer);
|
|
82
|
+
}
|
|
83
|
+
this.holdTimers.clear();
|
|
84
|
+
this.gates.clear();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A keypress: true now, false {@link KEY_PULSE_MS} later. A keypress on a HELD key ends the hold, or its watchdog
|
|
88
|
+
* would later write a release for a key the pulse already released.
|
|
89
|
+
*
|
|
90
|
+
* @param id the full key state id
|
|
91
|
+
*/
|
|
92
|
+
pulse(id) {
|
|
93
|
+
this.clearHoldTimer(id);
|
|
94
|
+
this.host.writeState(id, true);
|
|
95
|
+
const timer = this.host.setTimeout(() => {
|
|
96
|
+
if (timer) {
|
|
97
|
+
this.pulseTimers.delete(timer);
|
|
98
|
+
}
|
|
99
|
+
if (!this.holdTimers.has(id)) {
|
|
100
|
+
this.host.writeState(id, false);
|
|
101
|
+
}
|
|
102
|
+
}, KEY_PULSE_MS);
|
|
103
|
+
if (timer) {
|
|
104
|
+
this.pulseTimers.add(timer);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A keydown holds the key true until its keyup; a watchdog releases it after {@link HOLD_MAX_MS} when the keyup is
|
|
109
|
+
* lost. A repeated keydown re-arms it.
|
|
110
|
+
*
|
|
111
|
+
* @param id the full key state id
|
|
112
|
+
* @param down true for keydown, false for keyup
|
|
113
|
+
*/
|
|
114
|
+
hold(id, down) {
|
|
115
|
+
this.host.writeState(id, down);
|
|
116
|
+
this.clearHoldTimer(id);
|
|
117
|
+
if (down) {
|
|
118
|
+
const timer = this.host.setTimeout(() => {
|
|
119
|
+
this.holdTimers.delete(id);
|
|
120
|
+
this.host.writeState(id, false);
|
|
121
|
+
}, HOLD_MAX_MS);
|
|
122
|
+
if (timer) {
|
|
123
|
+
this.holdTimers.set(id, timer);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Disarm the hold watchdog of one key, if it has one.
|
|
129
|
+
*
|
|
130
|
+
* @param id the full key state id
|
|
131
|
+
*/
|
|
132
|
+
clearHoldTimer(id) {
|
|
133
|
+
const timer = this.holdTimers.get(id);
|
|
134
|
+
if (timer) {
|
|
135
|
+
this.host.clearTimeout(timer);
|
|
136
|
+
this.holdTimers.delete(id);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The rate gate: {@link MAX_COMMANDS_PER_SECOND} per device, the excess dropped and reported once per
|
|
141
|
+
* {@link RATE_WARN_INTERVAL_MS}. Every accepted command costs three writes plus one when the pulse ends.
|
|
142
|
+
*
|
|
143
|
+
* @param device the emulated Roku
|
|
144
|
+
* @returns true if the command may be applied
|
|
145
|
+
*/
|
|
146
|
+
admit(device) {
|
|
147
|
+
const now = Date.now();
|
|
148
|
+
let gate = this.gates.get(device.id);
|
|
149
|
+
if (!gate) {
|
|
150
|
+
gate = new import_rate_gate.RateGate(MAX_COMMANDS_PER_SECOND, now);
|
|
151
|
+
this.gates.set(device.id, gate);
|
|
152
|
+
}
|
|
153
|
+
if (gate.allow(now)) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
if (this.rateWarnings.due(device.id, now)) {
|
|
157
|
+
this.host.warn(
|
|
158
|
+
`Emulated Roku "${device.name}" receives more than ${MAX_COMMANDS_PER_SECOND} commands per second \u2014 dropping the excess (a misbehaving controller?)`
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
165
|
+
0 && (module.exports = {
|
|
166
|
+
CommandHandler,
|
|
167
|
+
HOLD_MAX_MS,
|
|
168
|
+
KEY_PULSE_MS,
|
|
169
|
+
MAX_COMMANDS_PER_SECOND,
|
|
170
|
+
RATE_WARN_INTERVAL_MS
|
|
171
|
+
});
|
|
172
|
+
//# sourceMappingURL=command-handler.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/command-handler.ts"],
|
|
4
|
+
"sourcesContent": ["import type { CommandEvent } from \"./ecp/ecp-command\";\nimport { commandToStateWrite } from \"./ecp/state-model\";\nimport { LogThrottle } from \"./lib/log-throttle\";\nimport { RateGate } from \"./lib/rate-gate\";\n\n/** How long a keypress pulses its keys.<Key> state true before falling back to false. */\nexport const KEY_PULSE_MS = 50;\n/** Safety cap for a held key: a keydown with no matching keyup resets after this. */\nexport const HOLD_MAX_MS = 30_000;\n/** Commands accepted per second and emulated Roku; the excess is dropped (see lib/rate-gate.ts). */\nexport const MAX_COMMANDS_PER_SECOND = 25;\n/** How often at most the dropped-commands warning repeats per device. */\nexport const RATE_WARN_INTERVAL_MS = 60_000;\n\n/** The emulated Roku a command is for. */\nexport interface CommandTarget {\n /** The id-safe device path segment. */\n readonly id: string;\n /** The configured device name, for the warning the user reads. */\n readonly name: string;\n /** The key names this device's type carries \u2014 only those have a state to write. */\n readonly keys: ReadonlySet<string>;\n}\n\n/** What the handler needs from the adapter: writing, the managed timers and the log. */\nexport interface CommandHost {\n /** Fire-and-forget state write (relative id). */\n writeState(id: string, val: string | boolean): void;\n /**\n * The adapter's managed timeout \u2014 undefined while the adapter shuts down. A property, not a method signature: the\n * repochecker reads a timer method signature as a plain timer call (S5005).\n */\n setTimeout: (callback: () => void, ms: number) => ioBroker.Timeout | undefined;\n /** The adapter's managed clearTimeout. */\n clearTimeout: (timer: ioBroker.Timeout) => void;\n /** A warning the user should see. */\n warn(message: string): void;\n}\n\n/**\n * Turns the ECP commands of every emulated Roku into state writes: `command` / `commandType`, a pulse for a keypress,\n * a hold with a watchdog for keydown/keyup \u2014 behind a rate gate per device, the write-flood protection for the states\n * database. Owns its timers and releases them in {@link dispose}.\n */\nexport class CommandHandler {\n private readonly pulseTimers = new Set<ioBroker.Timeout>();\n /** Per held key id, its watchdog timer \u2014 so a keydown without a keyup cannot pin it true forever. */\n private readonly holdTimers = new Map<string, ioBroker.Timeout>();\n private readonly gates = new Map<string, RateGate>();\n private readonly rateWarnings = new LogThrottle(RATE_WARN_INTERVAL_MS);\n\n /**\n * @param host the adapter's writer, timers and log\n */\n public constructor(private readonly host: CommandHost) {}\n\n /**\n * Apply a received ECP command to the device's states: record it in `command` / `commandType`, and pulse or hold\n * the standard key if the device carries it. The server logs only what this accepted, so the rate gate covers the\n * log as well as the states database.\n *\n * @param device the emulated Roku the command is for\n * @param cmd the parsed ECP command\n * @returns true if the command was applied, false if the rate gate dropped it\n */\n public apply(device: CommandTarget, cmd: CommandEvent): boolean {\n const write = commandToStateWrite(cmd);\n // The release of a key that is actually HELD never passes the rate gate: a dropped keyup would leave the key true\n // until the watchdog, so the flood protection would falsify the tree. Asked by the held state, not by the request,\n // so a flood of keyups for a key nobody holds still meets the gate.\n const releaseOf = write.holdKey?.value === false ? `${device.id}.keys.${write.holdKey.key}` : null;\n const isRelease = releaseOf !== null && this.holdTimers.has(releaseOf);\n if (!isRelease && !this.admit(device)) {\n return false;\n }\n this.host.writeState(`${device.id}.command`, write.command);\n this.host.writeState(`${device.id}.commandType`, write.commandType);\n // A key only this device's type lacks lands in `command` alone \u2014 there is no state to write.\n if (write.pulseKey && device.keys.has(write.pulseKey)) {\n this.pulse(`${device.id}.keys.${write.pulseKey}`);\n } else if (write.holdKey && device.keys.has(write.holdKey.key)) {\n this.hold(`${device.id}.keys.${write.holdKey.key}`, write.holdKey.value);\n }\n return true;\n }\n\n /** Disarm every timer \u2014 the adapter is going down. */\n public dispose(): void {\n for (const timer of this.pulseTimers) {\n this.host.clearTimeout(timer);\n }\n this.pulseTimers.clear();\n for (const timer of this.holdTimers.values()) {\n this.host.clearTimeout(timer);\n }\n this.holdTimers.clear();\n this.gates.clear();\n }\n\n /**\n * A keypress: true now, false {@link KEY_PULSE_MS} later. A keypress on a HELD key ends the hold, or its watchdog\n * would later write a release for a key the pulse already released.\n *\n * @param id the full key state id\n */\n private pulse(id: string): void {\n this.clearHoldTimer(id);\n this.host.writeState(id, true);\n const timer = this.host.setTimeout(() => {\n if (timer) {\n this.pulseTimers.delete(timer);\n }\n // A keydown inside the pulse window owns the key now \u2014 its keyup writes the release.\n if (!this.holdTimers.has(id)) {\n this.host.writeState(id, false);\n }\n }, KEY_PULSE_MS);\n if (timer) {\n this.pulseTimers.add(timer);\n }\n }\n\n /**\n * A keydown holds the key true until its keyup; a watchdog releases it after {@link HOLD_MAX_MS} when the keyup is\n * lost. A repeated keydown re-arms it.\n *\n * @param id the full key state id\n * @param down true for keydown, false for keyup\n */\n private hold(id: string, down: boolean): void {\n this.host.writeState(id, down);\n this.clearHoldTimer(id);\n if (down) {\n const timer = this.host.setTimeout(() => {\n this.holdTimers.delete(id);\n this.host.writeState(id, false);\n }, HOLD_MAX_MS);\n if (timer) {\n this.holdTimers.set(id, timer);\n }\n }\n }\n\n /**\n * Disarm the hold watchdog of one key, if it has one.\n *\n * @param id the full key state id\n */\n private clearHoldTimer(id: string): void {\n const timer = this.holdTimers.get(id);\n if (timer) {\n this.host.clearTimeout(timer);\n this.holdTimers.delete(id);\n }\n }\n\n /**\n * The rate gate: {@link MAX_COMMANDS_PER_SECOND} per device, the excess dropped and reported once per\n * {@link RATE_WARN_INTERVAL_MS}. Every accepted command costs three writes plus one when the pulse ends.\n *\n * @param device the emulated Roku\n * @returns true if the command may be applied\n */\n private admit(device: CommandTarget): boolean {\n const now = Date.now();\n let gate = this.gates.get(device.id);\n if (!gate) {\n gate = new RateGate(MAX_COMMANDS_PER_SECOND, now);\n this.gates.set(device.id, gate);\n }\n if (gate.allow(now)) {\n return true;\n }\n if (this.rateWarnings.due(device.id, now)) {\n this.host.warn(\n `Emulated Roku \"${device.name}\" receives more than ${MAX_COMMANDS_PER_SECOND} commands per second \u2014 dropping the excess (a misbehaving controller?)`,\n );\n }\n return false;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAoC;AACpC,0BAA4B;AAC5B,uBAAyB;AAGlB,MAAM,eAAe;AAErB,MAAM,cAAc;AAEpB,MAAM,0BAA0B;AAEhC,MAAM,wBAAwB;AAgC9B,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA,EAUnB,YAA6B,MAAmB;AAAnB;AAAA,EAAoB;AAAA,EAApB;AAAA,EATnB,cAAc,oBAAI,IAAsB;AAAA;AAAA,EAExC,aAAa,oBAAI,IAA8B;AAAA,EAC/C,QAAQ,oBAAI,IAAsB;AAAA,EAClC,eAAe,IAAI,gCAAY,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgB9D,MAAM,QAAuB,KAA4B;AAjElE;AAkEI,UAAM,YAAQ,wCAAoB,GAAG;AAIrC,UAAM,cAAY,WAAM,YAAN,mBAAe,WAAU,QAAQ,GAAG,OAAO,EAAE,SAAS,MAAM,QAAQ,GAAG,KAAK;AAC9F,UAAM,YAAY,cAAc,QAAQ,KAAK,WAAW,IAAI,SAAS;AACrE,QAAI,CAAC,aAAa,CAAC,KAAK,MAAM,MAAM,GAAG;AACrC,aAAO;AAAA,IACT;AACA,SAAK,KAAK,WAAW,GAAG,OAAO,EAAE,YAAY,MAAM,OAAO;AAC1D,SAAK,KAAK,WAAW,GAAG,OAAO,EAAE,gBAAgB,MAAM,WAAW;AAElE,QAAI,MAAM,YAAY,OAAO,KAAK,IAAI,MAAM,QAAQ,GAAG;AACrD,WAAK,MAAM,GAAG,OAAO,EAAE,SAAS,MAAM,QAAQ,EAAE;AAAA,IAClD,WAAW,MAAM,WAAW,OAAO,KAAK,IAAI,MAAM,QAAQ,GAAG,GAAG;AAC9D,WAAK,KAAK,GAAG,OAAO,EAAE,SAAS,MAAM,QAAQ,GAAG,IAAI,MAAM,QAAQ,KAAK;AAAA,IACzE;AACA,WAAO;AAAA,EACT;AAAA;AAAA,EAGO,UAAgB;AACrB,eAAW,SAAS,KAAK,aAAa;AACpC,WAAK,KAAK,aAAa,KAAK;AAAA,IAC9B;AACA,SAAK,YAAY,MAAM;AACvB,eAAW,SAAS,KAAK,WAAW,OAAO,GAAG;AAC5C,WAAK,KAAK,aAAa,KAAK;AAAA,IAC9B;AACA,SAAK,WAAW,MAAM;AACtB,SAAK,MAAM,MAAM;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,MAAM,IAAkB;AAC9B,SAAK,eAAe,EAAE;AACtB,SAAK,KAAK,WAAW,IAAI,IAAI;AAC7B,UAAM,QAAQ,KAAK,KAAK,WAAW,MAAM;AACvC,UAAI,OAAO;AACT,aAAK,YAAY,OAAO,KAAK;AAAA,MAC/B;AAEA,UAAI,CAAC,KAAK,WAAW,IAAI,EAAE,GAAG;AAC5B,aAAK,KAAK,WAAW,IAAI,KAAK;AAAA,MAChC;AAAA,IACF,GAAG,YAAY;AACf,QAAI,OAAO;AACT,WAAK,YAAY,IAAI,KAAK;AAAA,IAC5B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,KAAK,IAAY,MAAqB;AAC5C,SAAK,KAAK,WAAW,IAAI,IAAI;AAC7B,SAAK,eAAe,EAAE;AACtB,QAAI,MAAM;AACR,YAAM,QAAQ,KAAK,KAAK,WAAW,MAAM;AACvC,aAAK,WAAW,OAAO,EAAE;AACzB,aAAK,KAAK,WAAW,IAAI,KAAK;AAAA,MAChC,GAAG,WAAW;AACd,UAAI,OAAO;AACT,aAAK,WAAW,IAAI,IAAI,KAAK;AAAA,MAC/B;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,eAAe,IAAkB;AACvC,UAAM,QAAQ,KAAK,WAAW,IAAI,EAAE;AACpC,QAAI,OAAO;AACT,WAAK,KAAK,aAAa,KAAK;AAC5B,WAAK,WAAW,OAAO,EAAE;AAAA,IAC3B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,MAAM,QAAgC;AAC5C,UAAM,MAAM,KAAK,IAAI;AACrB,QAAI,OAAO,KAAK,MAAM,IAAI,OAAO,EAAE;AACnC,QAAI,CAAC,MAAM;AACT,aAAO,IAAI,0BAAS,yBAAyB,GAAG;AAChD,WAAK,MAAM,IAAI,OAAO,IAAI,IAAI;AAAA,IAChC;AACA,QAAI,KAAK,MAAM,GAAG,GAAG;AACnB,aAAO;AAAA,IACT;AACA,QAAI,KAAK,aAAa,IAAI,OAAO,IAAI,GAAG,GAAG;AACzC,WAAK,KAAK;AAAA,QACR,kBAAkB,OAAO,IAAI,wBAAwB,uBAAuB;AAAA,MAC9E;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -29,7 +29,7 @@ var import_device_config = require("./lib/device-config");
|
|
|
29
29
|
var import_device_identity = require("./lib/device-identity");
|
|
30
30
|
var import_i18n = require("./lib/i18n");
|
|
31
31
|
var import_pure_helpers = require("./lib/pure-helpers");
|
|
32
|
-
const ID_EXPRESSION =
|
|
32
|
+
const ID_EXPRESSION = `(data.name||'').trim().replace(/${import_pure_helpers.UNSAFE_ID_CHAR.source}/g,'_')`;
|
|
33
33
|
function buildDeviceForm(usedNames, usedPorts, usedIds) {
|
|
34
34
|
const nameList = JSON.stringify(usedNames.map((n) => n.trim().toLowerCase()));
|
|
35
35
|
const portList = JSON.stringify([...usedPorts]);
|
|
@@ -98,7 +98,7 @@ function cleanDevice(raw) {
|
|
|
98
98
|
}
|
|
99
99
|
class FakerokuDeviceManagement extends import_dm_utils.DeviceManagement {
|
|
100
100
|
get objId() {
|
|
101
|
-
return
|
|
101
|
+
return (0, import_constants.instanceObjectId)(this.adapter.namespace);
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Read the device list from the live config object, through the shared normaliser — against
|
|
@@ -185,8 +185,7 @@ class FakerokuDeviceManagement extends import_dm_utils.DeviceManagement {
|
|
|
185
185
|
* the runtime gives when two names map to one object id.
|
|
186
186
|
*
|
|
187
187
|
* The name needs no fallback: a row without a usable one never becomes a DeviceRow
|
|
188
|
-
* (lib/device-config.ts drops it)
|
|
189
|
-
* the mutation run of 1.6.0 found it by having no test that could fail on its removal.
|
|
188
|
+
* (lib/device-config.ts drops it).
|
|
190
189
|
*
|
|
191
190
|
* @param device the stored device
|
|
192
191
|
* @returns the card descriptor
|
|
@@ -226,8 +225,8 @@ class FakerokuDeviceManagement extends import_dm_utils.DeviceManagement {
|
|
|
226
225
|
};
|
|
227
226
|
}
|
|
228
227
|
/**
|
|
229
|
-
* Manual add: pre-select a free port, show the form, and append the device with
|
|
230
|
-
* a
|
|
228
|
+
* Manual add: pre-select a free port, show the form, and append the device with its own
|
|
229
|
+
* random identity and a fixed object id.
|
|
231
230
|
*
|
|
232
231
|
* @param context the action context
|
|
233
232
|
* @returns a directive to reload the manager
|
|
@@ -236,7 +235,7 @@ class FakerokuDeviceManagement extends import_dm_utils.DeviceManagement {
|
|
|
236
235
|
const devices = await this.readDevices();
|
|
237
236
|
const usedNames = devices.map((d) => d.name);
|
|
238
237
|
const usedPorts = devices.map((d) => d.port);
|
|
239
|
-
const usedIds = devices.map(
|
|
238
|
+
const usedIds = devices.map((d) => d.objectId);
|
|
240
239
|
const form = buildDeviceForm(usedNames, usedPorts, usedIds);
|
|
241
240
|
const data = await context.showForm(form.schema, {
|
|
242
241
|
title: (0, import_i18n.t)("dmAdd"),
|