iobroker.telegram 1.10.1 → 1.12.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.
- package/README.md +16 -0
- package/admin/blockly.js +17 -4
- package/admin/index_m.html +1 -0
- package/admin/words.js +24 -0
- package/io-package.json +85 -31
- package/main.js +213 -111
- package/package.json +7 -7
- package/admin/index.html +0 -336
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
[](https://weblate.iobroker.net/engage/adapters/?utm_source=widget)
|
|
10
10
|
[](https://www.npmjs.com/package/iobroker.telegram)
|
|
11
11
|
|
|
12
|
+
**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0.
|
|
13
|
+
|
|
12
14
|
## Configuration
|
|
13
15
|
Ask [@BotFather](https://telegram.me/botfather) to create new bot ```/newbot```.
|
|
14
16
|
|
|
@@ -696,6 +698,7 @@ msg.payload = {
|
|
|
696
698
|
"parse_mode": "MarkdownV2"
|
|
697
699
|
}
|
|
698
700
|
```
|
|
701
|
+
Before sending it to `telegram.INSTANCE.communicate.responseJson you need to stringify the object!`
|
|
699
702
|
|
|
700
703
|
<!--
|
|
701
704
|
Placeholder for the next version (at the beginning of the line):
|
|
@@ -703,6 +706,19 @@ msg.payload = {
|
|
|
703
706
|
-->
|
|
704
707
|
|
|
705
708
|
## Changelog
|
|
709
|
+
### 1.12.0 (2022-03-21)
|
|
710
|
+
* (Apollon77) Add new JSON states communication.responseJson and communication.responseSilentJson to also accept json structures (stringified!) to send messages
|
|
711
|
+
* (Apollon77) Try to prevent adapter crashes when internet is not available
|
|
712
|
+
* (Apollon77) Add Sentry for crash reporting
|
|
713
|
+
|
|
714
|
+
### 1.11.1 (2022-01-27)
|
|
715
|
+
* (bluefox) fixed the receiving files
|
|
716
|
+
|
|
717
|
+
### 1.11.0 (2022-01-26)
|
|
718
|
+
* (bluefox) Added bruteforce protection
|
|
719
|
+
* (bluefox) Extended blockly with `disable_web_preview` option
|
|
720
|
+
* (bluefox) added `communicate.responseSilent` state to answer silently
|
|
721
|
+
|
|
706
722
|
### 1.10.1 (2022-01-26)
|
|
707
723
|
* (bluefox) Updated telegram library
|
|
708
724
|
|
package/admin/blockly.js
CHANGED
|
@@ -31,7 +31,7 @@ Blockly.Words['telegram_log_warn'] = {'en': 'warning',
|
|
|
31
31
|
Blockly.Words['telegram_log_error'] = {'en': 'error', 'pt': 'erro', 'pl': 'błąd', 'nl': 'fout', 'it': 'errore', 'es': 'error', 'fr': 'Erreur', 'de': 'error', 'ru': 'ошибка'};
|
|
32
32
|
Blockly.Words['telegram_help'] = {'en': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'pt': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'pl': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'nl': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'it': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'es': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'fr': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'de': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'ru': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md'};
|
|
33
33
|
Blockly.Words['telegram_silent'] = {'en': 'without notification', 'de': 'ohne Benachrichtigung', 'ru': 'без уведомления', 'pt': 'sem notificação', 'nl': 'zonder kennisgeving', 'fr': 'sans notification', 'it': 'senza notifica', 'es': 'sin notificación', 'pl': 'bez powiadomienia'};
|
|
34
|
-
|
|
34
|
+
Blockly.Words['telegram_disable_web_preview'] = {'en': 'disable web preview', 'de': 'Deaktivieren Sie die Webvorschau', 'ru': 'отключить предварительный просмотр в Интернете', 'pt': 'desativar a visualização da web', 'nl': 'webvoorbeeld uitschakelen', 'fr': 'désactiver l\'aperçu Web','it': 'disabilitare l\'anteprima web', 'es': 'deshabilitar la vista previa web', 'pl': 'wyłącz podgląd internetowy', 'zh-cn': '禁用网页预览'};
|
|
35
35
|
Blockly.Sendto.blocks['telegram'] =
|
|
36
36
|
'<block type="telegram">'
|
|
37
37
|
+ ' <value name="INSTANCE">'
|
|
@@ -51,6 +51,8 @@ Blockly.Sendto.blocks['telegram'] =
|
|
|
51
51
|
+ ' </value>'
|
|
52
52
|
+ ' <value name="PARSEMODE">'
|
|
53
53
|
+ ' </value>'
|
|
54
|
+
+ ' <value name="DISABLE_WEB_PAGE_PREVIEW">'
|
|
55
|
+
+ ' </value>'
|
|
54
56
|
+ '</block>';
|
|
55
57
|
|
|
56
58
|
Blockly.Blocks['telegram'] = {
|
|
@@ -86,7 +88,7 @@ Blockly.Blocks['telegram'] = {
|
|
|
86
88
|
.setCheck('String')
|
|
87
89
|
.appendField(Blockly.Translate('telegram_username'));
|
|
88
90
|
|
|
89
|
-
var
|
|
91
|
+
var input1 = this.appendValueInput('CHATID')
|
|
90
92
|
.setCheck('String')
|
|
91
93
|
.appendField(Blockly.Translate('telegram_chatid'));
|
|
92
94
|
|
|
@@ -106,9 +108,18 @@ Blockly.Blocks['telegram'] = {
|
|
|
106
108
|
|
|
107
109
|
this.appendDummyInput('PARSEMODE')
|
|
108
110
|
.appendField('Parsemode')
|
|
109
|
-
.appendField(new Blockly.FieldDropdown([['default', 'default'], ['HTML', 'HTML'], ['
|
|
111
|
+
.appendField(new Blockly.FieldDropdown([['default', 'default'], ['HTML', 'HTML'], ['MarkdownV2', 'MarkdownV2']]), 'PARSEMODE');
|
|
110
112
|
|
|
111
|
-
|
|
113
|
+
this.appendDummyInput('DISABLE_WEB_PAGE_PREVIEW')
|
|
114
|
+
.appendField(Blockly.Translate('telegram_disable_web_preview'))
|
|
115
|
+
.appendField(new Blockly.FieldCheckbox('FALSE'), 'DISABLE_WEB_PAGE_PREVIEW');
|
|
116
|
+
|
|
117
|
+
if (input.connection) {
|
|
118
|
+
input.connection._optional = true;
|
|
119
|
+
}
|
|
120
|
+
if (input1.connection) {
|
|
121
|
+
input1.connection._optional = true;
|
|
122
|
+
}
|
|
112
123
|
|
|
113
124
|
this.setInputsInline(false);
|
|
114
125
|
this.setPreviousStatement(true, null);
|
|
@@ -127,6 +138,7 @@ Blockly.JavaScript['telegram'] = function(block) {
|
|
|
127
138
|
var value_username = Blockly.JavaScript.valueToCode(block, 'USERNAME', Blockly.JavaScript.ORDER_ATOMIC);
|
|
128
139
|
var value_chatid = Blockly.JavaScript.valueToCode(block, 'CHATID', Blockly.JavaScript.ORDER_ATOMIC);
|
|
129
140
|
var silent = block.getFieldValue('SILENT');
|
|
141
|
+
var disable_web_page_preview = block.getFieldValue('DISABLE_WEB_PAGE_PREVIEW');
|
|
130
142
|
var parsemode = block.getFieldValue('PARSEMODE');
|
|
131
143
|
|
|
132
144
|
var logText;
|
|
@@ -140,6 +152,7 @@ Blockly.JavaScript['telegram'] = function(block) {
|
|
|
140
152
|
value_message + (value_username ? ', \n user: ' + value_username : '') +
|
|
141
153
|
(value_chatid ? ', \n chatId: ' + value_chatid : '') +
|
|
142
154
|
(silent === 'TRUE' ? ', \n disable_notification: true' : '') +
|
|
155
|
+
(disable_web_page_preview === 'TRUE' ? ', \n disable_web_page_preview: true' : '') +
|
|
143
156
|
(parsemode !== 'default' ? ', \n parse_mode: "' + parsemode + '"': '') +
|
|
144
157
|
'\n});\n' +
|
|
145
158
|
logText;
|
package/admin/index_m.html
CHANGED
package/admin/words.js
CHANGED
|
@@ -79,4 +79,28 @@ systemDictionary = {
|
|
|
79
79
|
"value as boolean": { "en": "value as boolean", "de": "Wert als Boolean", "ru": "логическое значение", "pt": "valor como booleano", "nl": "waarde als Boolean", "fr": "valeur en tant que booléen", "it": "valore come booleano", "es": "valor como booleano", "pl": "wartość jako boolean", "zh-cn": "布尔值"},
|
|
80
80
|
"value as number": { "en": "value as number", "de": "Wert als Zahl", "ru": "значение в виде число", "pt": "valor como numero", "nl": "waarde als nummer", "fr": "valeur en nombre", "it": "valore come numero", "es": "valor como numero", "pl": "wartość jako liczba", "zh-cn": "价值作为数字"},
|
|
81
81
|
"value as string": { "en": "value as string", "de": "Wert als String", "ru": "значение в виде строки", "pt": "valor como string", "nl": "waarde als tekenreeks", "fr": "valeur sous forme de chaîne", "it": "valore come stringa", "es": "valor como cadena", "pl": "wartość jako ciąg", "zh-cn": "值作为字符串"},
|
|
82
|
+
"Too many attempts. Blocked for": {
|
|
83
|
+
"en": "Too many attempts. Blocked for",
|
|
84
|
+
"de": "Zu viele Versuche. Gesperrt für",
|
|
85
|
+
"ru": "Слишком много попыток. Заблокировано для",
|
|
86
|
+
"pt": "Muitas tentativas. Bloqueado por",
|
|
87
|
+
"nl": "Te veel pogingen. Geblokkeerd voor",
|
|
88
|
+
"fr": "Trop d'essais. Bloqué pour",
|
|
89
|
+
"it": "Troppi tentativi. Bloccato per",
|
|
90
|
+
"es": "Demasiados intentos. bloqueado por",
|
|
91
|
+
"pl": "Zbyt wiele prób. Zablokowany przez",
|
|
92
|
+
"zh-cn": "太多的尝试。被阻止"
|
|
93
|
+
},
|
|
94
|
+
"seconds": {
|
|
95
|
+
"en": "seconds",
|
|
96
|
+
"de": "Sekunden",
|
|
97
|
+
"ru": "секунд/ы",
|
|
98
|
+
"pt": "segundos",
|
|
99
|
+
"nl": "seconden",
|
|
100
|
+
"fr": "secondes",
|
|
101
|
+
"it": "secondi",
|
|
102
|
+
"es": "segundos",
|
|
103
|
+
"pl": "sekundy",
|
|
104
|
+
"zh-cn": "秒"
|
|
105
|
+
}
|
|
82
106
|
};
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "telegram",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.12.0": {
|
|
7
|
+
"en": "Add new JSON states communication.responseJson and communication.responseSilentJson to also accept json structures (stringified!) to send messages\nTry to prevent adapter crashes when internet is not available \nAdd Sentry for crash reporting",
|
|
8
|
+
"de": "Fügen Sie die neuen JSON-Zustände communication.responseJson und communication.responseSilentJson hinzu, um auch JSON-Strukturen (stringifiziert!) zum Senden von Nachrichten zu akzeptieren\nVersuchen Sie, Adapterabstürze zu verhindern, wenn das Internet nicht verfügbar ist\nFügen Sie Sentry für Absturzberichte hinzu",
|
|
9
|
+
"ru": "Добавьте новые состояния JSON Communication.responseJson и Communication.responseSilentJson, чтобы также принимать структуры json (строковые!) для отправки сообщений.\nПостарайтесь предотвратить сбои адаптера, когда интернет недоступен\nДобавьте Sentry для отчетов о сбоях",
|
|
10
|
+
"pt": "Adicione novos estados JSON communication.responseJson e communication.responseSilentJson para também aceitar estruturas json (stringified!) para enviar mensagens\nTente evitar falhas no adaptador quando a internet não estiver disponível\nAdicionar Sentinela para relatórios de falhas",
|
|
11
|
+
"nl": "Voeg nieuwe JSON-staten communication.responseJson en communication.responseSilentJson toe om ook json-structuren (stringified!) te accepteren om berichten te verzenden\nProbeer adaptercrashes te voorkomen wanneer internet niet beschikbaar is\nSentry toevoegen voor crashrapportage",
|
|
12
|
+
"fr": "Ajoutez de nouveaux états JSON communication.responseJson et communication.responseSilentJson pour accepter également les structures json (stringifiées !) Pour envoyer des messages\nEssayez d'éviter les plantages de l'adaptateur lorsque Internet n'est pas disponible\nAjouter Sentry pour les rapports de plantage",
|
|
13
|
+
"it": "Aggiungi nuovi stati JSON communication.responseJson e communication.responseSilentJson per accettare anche strutture json (stringate!) Per inviare messaggi\nCerca di evitare che l'adattatore si arresti in modo anomalo quando Internet non è disponibile\nAggiungi Sentinella per la segnalazione degli arresti anomali",
|
|
14
|
+
"es": "Agregue nuevos estados JSON communication.responseJson y communication.responseSilentJson para aceptar también estructuras json (¡en cadena!) para enviar mensajes\nIntente evitar fallas en el adaptador cuando no haya Internet disponible\nAgregar Sentry para informes de fallas",
|
|
15
|
+
"pl": "Dodaj nowe stany JSON communication.responseJson i communication.responseSilentJson, aby akceptować również struktury json (stringified!) do wysyłania wiadomości\nStaraj się zapobiegać awariom adaptera, gdy internet nie jest dostępny\nDodaj Sentry do zgłaszania awarii",
|
|
16
|
+
"zh-cn": "添加新的 JSON 状态communication.responseJson 和communication.responseSilentJson 也接受json 结构(字符串化!)发送消息\n尝试在互联网不可用时防止适配器崩溃\n添加 Sentry 以进行崩溃报告"
|
|
17
|
+
},
|
|
18
|
+
"1.11.1": {
|
|
19
|
+
"en": "fixed the receiving files",
|
|
20
|
+
"de": "die empfangenen Dateien repariert",
|
|
21
|
+
"ru": "исправлено получение файлов",
|
|
22
|
+
"pt": "corrigiu os arquivos de recebimento",
|
|
23
|
+
"nl": "de ontvangende bestanden gerepareerd",
|
|
24
|
+
"fr": "corrigé les fichiers de réception",
|
|
25
|
+
"it": "corretto i file di ricezione",
|
|
26
|
+
"es": "arregló los archivos de recepción",
|
|
27
|
+
"pl": "naprawiono odbieranie plików",
|
|
28
|
+
"zh-cn": "修复了接收文件"
|
|
29
|
+
},
|
|
30
|
+
"1.11.0": {
|
|
31
|
+
"en": "Added bruteforce protection\nExtended blockly with `disable_web_preview` option\nadded `communicate.responseSilent` state to answer silently",
|
|
32
|
+
"de": "Bruteforce-Schutz hinzugefügt\nBlockweise erweitert mit der Option `disable_web_preview`\n`communicate.responseSilent`-Zustand hinzugefügt, um still zu antworten",
|
|
33
|
+
"ru": "Добавлена защита от брутфорса\nРасширен блочно с опцией `disable_web_preview`\nдобавлено состояние `communicate.responseSilent` для молчаливого ответа",
|
|
34
|
+
"pt": "Proteção de força bruta adicionada\nEstendido em bloco com a opção `disable_web_preview`\nadicionado o estado `communicate.responseSilent` para responder silenciosamente",
|
|
35
|
+
"nl": "Bruteforce-bescherming toegevoegd\nBlockly uitgebreid met de optie 'disable_web_preview'\nstatus `communicate.responseSilent` toegevoegd om stil te antwoorden",
|
|
36
|
+
"fr": "Protection contre la force brute ajoutée\nÉtendu en bloc avec l'option `disable_web_preview`\najout de l'état `communicate.responseSilent` pour répondre en silence",
|
|
37
|
+
"it": "Aggiunta protezione dalla forza bruta\nEsteso in blocco con l'opzione `disable_web_preview`\naggiunto lo stato `communicate.responseSilent` per rispondere in silenzio",
|
|
38
|
+
"es": "Protección de fuerza bruta agregada\nExtendido en bloques con la opción `disable_web_preview`\nSe agregó el estado `communicate.responseSilent` para responder en silencio.",
|
|
39
|
+
"pl": "Dodano ochronę przed bruteforce\nRozszerzony blokowo z opcją `disable_web_preview`\ndodano stan `communicate.responseSilent` do cichej odpowiedzi",
|
|
40
|
+
"zh-cn": "添加了蛮力保护\n使用 `disable_web_preview` 选项扩展块\n添加了`communicate.responseSilent`状态以静默回答"
|
|
41
|
+
},
|
|
6
42
|
"1.10.1": {
|
|
7
43
|
"en": "Updated telegram library",
|
|
8
44
|
"de": "Aktualisierte Telegrammbibliothek",
|
|
@@ -50,34 +86,6 @@
|
|
|
50
86
|
"es": "error corregido con muchas solicitudes simultáneas\nformateo\nimplementado editMessageMedia y editMessageCaption\nCifrar token\nError corregido con contraseña\nError corregido con controles booleanos fáciles",
|
|
51
87
|
"pl": "poprawiony błąd z wieloma jednoczesnymi żądaniami\nformatowanie\nzaimplementowano editMessageMedia i editMessageCaption\nZaszyfruj token\nPoprawiony błąd z hasłem\nPoprawiony błąd z łatwymi kontrolkami boolowskimi",
|
|
52
88
|
"zh-cn": "修正了许多同时请求的错误\n格式化\n实现了 editMessageMedia 和 editMessageCaption\n加密令牌\n更正密码错误\n使用布尔型简单控件更正错误"
|
|
53
|
-
},
|
|
54
|
-
"1.8.2": {
|
|
55
|
-
"en": "fixed data types",
|
|
56
|
-
"de": "Datentypen korrigiert"
|
|
57
|
-
},
|
|
58
|
-
"1.8.1": {
|
|
59
|
-
"en": "added the admin5 support",
|
|
60
|
-
"de": "Die admin5-Unterstützung wurde hinzugefügt",
|
|
61
|
-
"ru": "добавлена поддержка admin5",
|
|
62
|
-
"pt": "adicionou o suporte admin5",
|
|
63
|
-
"nl": "de admin5-ondersteuning toegevoegd",
|
|
64
|
-
"fr": "a ajouté le support admin5",
|
|
65
|
-
"it": "aggiunto il supporto admin5",
|
|
66
|
-
"es": "agregó el soporte admin5",
|
|
67
|
-
"pl": "dodano obsługę admin5",
|
|
68
|
-
"zh-cn": "添加了admin5支持"
|
|
69
|
-
},
|
|
70
|
-
"1.8.0": {
|
|
71
|
-
"en": "(Apollon77/Nahasapeemapetilon) catch several API error cases to hopefully get around adapter crashes on network errors\nadd support for media groups and multiple image qualities",
|
|
72
|
-
"de": "(Apollon77 / Nahasapeemapetilon) fängt mehrere API-Fehlerfälle ab, um hoffentlich Adapterabstürze bei Netzwerkfehlern zu umgehen\nUnterstützung für Mediengruppen und mehrere Bildqualitäten hinzufügen",
|
|
73
|
-
"ru": "(Apollon77 / Nahasapeemapetilon) отлавливает несколько случаев ошибок API, чтобы, надеюсь, обойти сбои адаптера при сетевых ошибках\nдобавить поддержку медиа-групп и различных качеств изображений",
|
|
74
|
-
"pt": "(Apollon77 / Nahasapeemapetilon) captura vários casos de erro de API para contornar travamentos do adaptador em erros de rede\nadicionar suporte para grupos de mídia e várias qualidades de imagem",
|
|
75
|
-
"nl": "(Apollon77 / Nahasapeemapetilon) vangen verschillende API-foutgevallen op om hopelijk adaptercrashes door netwerkfouten te omzeilen\nondersteuning toevoegen voor mediagroepen en meerdere beeldkwaliteiten",
|
|
76
|
-
"fr": "(Apollon77 / Nahasapeemapetilon) attrapez plusieurs cas d'erreur d'API pour, espérons-le, contourner les plantages d'adaptateur en cas d'erreurs réseau\najouter la prise en charge des groupes de médias et de multiples qualités d'image",
|
|
77
|
-
"it": "(Apollon77 / Nahasapeemapetilon) rileva diversi casi di errore API per aggirare, si spera, i crash dell'adattatore in caso di errori di rete\naggiungere il supporto per i gruppi di media e più qualità di immagine",
|
|
78
|
-
"es": "(Apollon77 / Nahasapeemapetilon) detecta varios casos de error de API para, con suerte, evitar fallas del adaptador en errores de red\nagregar soporte para grupos de medios y múltiples calidades de imagen",
|
|
79
|
-
"pl": "(Apollon77 / Nahasapeemapetilon) Wyłap kilka przypadków błędów interfejsu API, aby mieć nadzieję na obejście awarii karty w przypadku błędów sieciowych\ndodać obsługę grup medialnych i wielu jakości obrazu",
|
|
80
|
-
"zh-cn": "(Apollon77 / Nahasapeemapetilon)捕获了几种API错误案例,以期解决因网络错误引起的适配器崩溃\n添加对媒体组和多种图像质量的支持"
|
|
81
89
|
}
|
|
82
90
|
},
|
|
83
91
|
"title": "Telegram",
|
|
@@ -130,7 +138,17 @@
|
|
|
130
138
|
{
|
|
131
139
|
"js-controller": ">=3.3.0"
|
|
132
140
|
}
|
|
133
|
-
]
|
|
141
|
+
],
|
|
142
|
+
"globalDependencies": [
|
|
143
|
+
{
|
|
144
|
+
"admin": ">=4.0.9"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"plugins": {
|
|
148
|
+
"sentry": {
|
|
149
|
+
"dsn": "https://ae1b374ffb5d40cbabe9bff369520972@sentry.iobroker.net/38"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
134
152
|
},
|
|
135
153
|
"protectedNative": [
|
|
136
154
|
"token",
|
|
@@ -289,7 +307,43 @@
|
|
|
289
307
|
"type": "state",
|
|
290
308
|
"common": {
|
|
291
309
|
"role": "text",
|
|
292
|
-
"name": "Send text through telegram",
|
|
310
|
+
"name": "Send text through telegram with notification",
|
|
311
|
+
"type": "string",
|
|
312
|
+
"read": true,
|
|
313
|
+
"write": true
|
|
314
|
+
},
|
|
315
|
+
"native": {}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"_id": "communicate.responseSilent",
|
|
319
|
+
"type": "state",
|
|
320
|
+
"common": {
|
|
321
|
+
"role": "text",
|
|
322
|
+
"name": "Send text through telegram silently",
|
|
323
|
+
"type": "string",
|
|
324
|
+
"read": true,
|
|
325
|
+
"write": true
|
|
326
|
+
},
|
|
327
|
+
"native": {}
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"_id": "communicate.responseJson",
|
|
331
|
+
"type": "state",
|
|
332
|
+
"common": {
|
|
333
|
+
"role": "json",
|
|
334
|
+
"name": "Send text through telegram with notification with json definition",
|
|
335
|
+
"type": "string",
|
|
336
|
+
"read": true,
|
|
337
|
+
"write": true
|
|
338
|
+
},
|
|
339
|
+
"native": {}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"_id": "communicate.responseSilentJson",
|
|
343
|
+
"type": "state",
|
|
344
|
+
"common": {
|
|
345
|
+
"role": "json",
|
|
346
|
+
"name": "Send text through telegram silently with json definition",
|
|
293
347
|
"type": "string",
|
|
294
348
|
"read": true,
|
|
295
349
|
"write": true
|
package/main.js
CHANGED
|
@@ -39,6 +39,8 @@ let isConnected = null;
|
|
|
39
39
|
let lastMessageTime = 0;
|
|
40
40
|
let lastMessageText = '';
|
|
41
41
|
const enums = {};
|
|
42
|
+
const protection = {};
|
|
43
|
+
let gcInterval = null;
|
|
42
44
|
|
|
43
45
|
const commands = {};
|
|
44
46
|
const callbackQueryId = {};
|
|
@@ -73,7 +75,24 @@ const systemLang2CallMe = {
|
|
|
73
75
|
|
|
74
76
|
function startAdapter(options) {
|
|
75
77
|
options = options || {};
|
|
76
|
-
Object.assign(options, {
|
|
78
|
+
Object.assign(options, {
|
|
79
|
+
name: adapterName,
|
|
80
|
+
/**
|
|
81
|
+
* If the JS-Controller catches an unhandled error, this will be called
|
|
82
|
+
* so we have a chance to handle it ourself.
|
|
83
|
+
* @param {Error} err
|
|
84
|
+
*/
|
|
85
|
+
error: (err) => {
|
|
86
|
+
// Identify unhandled errors originating from callbacks in scripts
|
|
87
|
+
// These are not caught by wrapping the execution code in try-catch
|
|
88
|
+
if (err && typeof err.stack === 'string') {
|
|
89
|
+
if (err.includes('getaddrinfo') || err.includes('api.telegram.org') || err.includes('EAI_AGAIN')) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
77
96
|
|
|
78
97
|
adapter = new utils.Adapter(options);
|
|
79
98
|
|
|
@@ -223,12 +242,14 @@ function startAdapter(options) {
|
|
|
223
242
|
});
|
|
224
243
|
adapter.log.info('https server listening on port ' + port);
|
|
225
244
|
|
|
226
|
-
main()
|
|
245
|
+
main()
|
|
246
|
+
.then(() => {});
|
|
227
247
|
});
|
|
228
248
|
}
|
|
229
249
|
});
|
|
230
250
|
} else {
|
|
231
|
-
main()
|
|
251
|
+
main()
|
|
252
|
+
.then(() => {});
|
|
232
253
|
}
|
|
233
254
|
});
|
|
234
255
|
|
|
@@ -236,6 +257,9 @@ function startAdapter(options) {
|
|
|
236
257
|
reconnectTimer && clearInterval(reconnectTimer);
|
|
237
258
|
reconnectTimer = null;
|
|
238
259
|
|
|
260
|
+
gcInterval && clearInterval(gcInterval);
|
|
261
|
+
gcInterval = null;
|
|
262
|
+
|
|
239
263
|
pollConnectionStatus && clearInterval(pollConnectionStatus);
|
|
240
264
|
pollConnectionStatus = null;
|
|
241
265
|
|
|
@@ -267,12 +291,35 @@ function startAdapter(options) {
|
|
|
267
291
|
adapter.on('stateChange', (id, state) => {
|
|
268
292
|
if (state) {
|
|
269
293
|
if (!state.ack) {
|
|
270
|
-
if (id.
|
|
294
|
+
if (id.endsWith('communicate.response')) {
|
|
271
295
|
// Send to someone this message
|
|
272
296
|
sendMessage(state.val)
|
|
273
|
-
.then(data =>
|
|
274
|
-
|
|
275
|
-
|
|
297
|
+
.then(data => adapter.setState('communicate.response', state.val, true));
|
|
298
|
+
} else
|
|
299
|
+
if (id.endsWith('communicate.responseSilent')) {
|
|
300
|
+
// Send to someone this message
|
|
301
|
+
sendMessage(state.val, null, null, {disable_notification: true})
|
|
302
|
+
.then(data => adapter.setState('communicate.responseSilent', state.val, true));
|
|
303
|
+
} else
|
|
304
|
+
if (id.endsWith('communicate.responseJson')) {
|
|
305
|
+
try {
|
|
306
|
+
const val = JSON.parse(state.val);
|
|
307
|
+
// Send to someone this message
|
|
308
|
+
sendMessage(val)
|
|
309
|
+
.then(data => adapter.setState('communicate.responseJson', state.val, true));
|
|
310
|
+
} catch (err) {
|
|
311
|
+
adapter.log.error(`could not parse Json in responseJon state: ${err.message}`);
|
|
312
|
+
}
|
|
313
|
+
} else
|
|
314
|
+
if (id.endsWith('communicate.responseSilentJson')) {
|
|
315
|
+
try {
|
|
316
|
+
const val = JSON.parse(state.val);
|
|
317
|
+
// Send to someone this message
|
|
318
|
+
sendMessage(val, null, null, {disable_notification: true})
|
|
319
|
+
.then(data => adapter.setState('communicate.responseSilent', state.val, true));
|
|
320
|
+
} catch (err) {
|
|
321
|
+
adapter.log.error(`could not parse Json in responseSilentJon state: ${err.message}`);
|
|
322
|
+
}
|
|
276
323
|
}
|
|
277
324
|
} else {
|
|
278
325
|
if (commands[id] && commands[id].report) {
|
|
@@ -323,7 +370,7 @@ function sendSystemMessage(text) {
|
|
|
323
370
|
.filter(id => users[id].sysMessages !== false)
|
|
324
371
|
.map(id => adapter.config.useUsername ? users[id].userName : users[id].firstName);
|
|
325
372
|
|
|
326
|
-
sendMessage(text, _users);
|
|
373
|
+
sendMessage(text, _users, null, {disable_notification: true});
|
|
327
374
|
}
|
|
328
375
|
|
|
329
376
|
function getStatus(id, state) {
|
|
@@ -939,7 +986,9 @@ function sendMessage(text, user, chatId, options) {
|
|
|
939
986
|
delete options.user;
|
|
940
987
|
}
|
|
941
988
|
}
|
|
989
|
+
|
|
942
990
|
options = options || {};
|
|
991
|
+
|
|
943
992
|
let tPromiseList = [];
|
|
944
993
|
// convert
|
|
945
994
|
if (text !== undefined && text !== null && typeof text !== 'object') {
|
|
@@ -1019,36 +1068,40 @@ function sendMessage(text, user, chatId, options) {
|
|
|
1019
1068
|
}
|
|
1020
1069
|
|
|
1021
1070
|
return Promise.all(tPromiseList)
|
|
1022
|
-
.then(
|
|
1071
|
+
.then(results =>
|
|
1023
1072
|
results.reduce((e, acc) => acc + e, 0))
|
|
1024
1073
|
.catch(e => -1);
|
|
1025
1074
|
}
|
|
1026
1075
|
|
|
1027
|
-
function saveFile(
|
|
1028
|
-
bot.getFileLink(
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1076
|
+
function saveFile(fileID, fileName, callback) {
|
|
1077
|
+
bot.getFileLink(fileID)
|
|
1078
|
+
.then(url => {
|
|
1079
|
+
adapter.log.debug('Received message: ' + url);
|
|
1080
|
+
https.get(url, res => {
|
|
1081
|
+
if (res.statusCode === 200) {
|
|
1082
|
+
const buf = [];
|
|
1083
|
+
res.on('data', data => buf.push(data));
|
|
1084
|
+
res.on('end', () => {
|
|
1085
|
+
try {
|
|
1086
|
+
fs.writeFileSync(tmpDirName + fileName, Buffer.concat(buf));
|
|
1087
|
+
} catch (err) {
|
|
1088
|
+
return callback({error: 'Error: ' + err});
|
|
1038
1089
|
}
|
|
1090
|
+
|
|
1039
1091
|
callback({
|
|
1040
1092
|
info: 'It\'s saved! : ' + tmpDirName + fileName,
|
|
1041
1093
|
path: tmpDirName + fileName
|
|
1042
1094
|
});
|
|
1043
|
-
})
|
|
1095
|
+
});
|
|
1044
1096
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1097
|
+
res.on('error', err =>
|
|
1098
|
+
callback({error: 'Error: ' + err}));
|
|
1099
|
+
} else {
|
|
1100
|
+
callback({error: 'Error: statusCode !== 200'});
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
})
|
|
1104
|
+
.catch(err => callback({error: 'Error bot.getFileLink: ' + err}));
|
|
1052
1105
|
}
|
|
1053
1106
|
|
|
1054
1107
|
function getMessage(msg) {
|
|
@@ -1104,6 +1157,7 @@ function getMessage(msg) {
|
|
|
1104
1157
|
} while (fs.existsSync(tmpDirName + fileName));
|
|
1105
1158
|
}
|
|
1106
1159
|
}
|
|
1160
|
+
|
|
1107
1161
|
saveFile(item.file_id, fileName, res => {
|
|
1108
1162
|
if (!res.error) {
|
|
1109
1163
|
adapter.log.info(res.info);
|
|
@@ -1158,7 +1212,7 @@ function processMessage(obj) {
|
|
|
1158
1212
|
// filter out double messages
|
|
1159
1213
|
const json = JSON.stringify(obj);
|
|
1160
1214
|
if (lastMessageTime && lastMessageText === JSON.stringify(obj) && Date.now() - lastMessageTime < 1200) {
|
|
1161
|
-
return adapter.log.debug(
|
|
1215
|
+
return adapter.log.debug(`Filter out double message [first was for ${Date.now() - lastMessageTime}ms]: ${json}`);
|
|
1162
1216
|
}
|
|
1163
1217
|
|
|
1164
1218
|
lastMessageTime = Date.now();
|
|
@@ -1475,6 +1529,33 @@ function isAnswerForQuestion(adapter, msg) {
|
|
|
1475
1529
|
}
|
|
1476
1530
|
}
|
|
1477
1531
|
|
|
1532
|
+
function garbageCollector() {
|
|
1533
|
+
const now = Date.now() - 5 * 60000; // last 5 minutes
|
|
1534
|
+
|
|
1535
|
+
Object.keys(protection)
|
|
1536
|
+
.forEach(user => {
|
|
1537
|
+
let a;
|
|
1538
|
+
for (a = 0; a < protection[user].length; a++) {
|
|
1539
|
+
// find first entry newer than 5 minutes
|
|
1540
|
+
if (protection[user][a] > now) {
|
|
1541
|
+
break;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
// remove all old entries
|
|
1545
|
+
if (a < protection[user].length && a) {
|
|
1546
|
+
protection[user].splice(0, a);
|
|
1547
|
+
}
|
|
1548
|
+
if (!protection[user].length) {
|
|
1549
|
+
delete protection[user];
|
|
1550
|
+
}
|
|
1551
|
+
});
|
|
1552
|
+
|
|
1553
|
+
if (!Object.keys(protection).length) {
|
|
1554
|
+
gcInterval && clearInterval(gcInterval);
|
|
1555
|
+
gcInterval = null;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1478
1559
|
function processTelegramText(msg) {
|
|
1479
1560
|
connectionState(true);
|
|
1480
1561
|
|
|
@@ -1493,7 +1574,7 @@ function processTelegramText(msg) {
|
|
|
1493
1574
|
if (now - msg.date * 1000 > pollingInterval + 30000) {
|
|
1494
1575
|
adapter.log.warn(`Message from ${msg.from.name} ignored, because too old: (${pollingInterval + 30000}) ${msg.text}`);
|
|
1495
1576
|
return bot.sendMessage(msg.from.id, _('Message ignored: ', systemLang) + msg.text)
|
|
1496
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1577
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1497
1578
|
|
|
1498
1579
|
}
|
|
1499
1580
|
|
|
@@ -1507,9 +1588,7 @@ function processTelegramText(msg) {
|
|
|
1507
1588
|
|
|
1508
1589
|
if (msg.text === '/password' && !adapter.config.doNotAcceptNewUser) {
|
|
1509
1590
|
return bot.sendMessage(msg.from.id, _('Please enter password in form "/password phrase"', systemLang))
|
|
1510
|
-
.catch(error =>
|
|
1511
|
-
adapter.log.error('send Message Error:' + error);
|
|
1512
|
-
});
|
|
1591
|
+
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1513
1592
|
}
|
|
1514
1593
|
|
|
1515
1594
|
if (adapter.config.password && !adapter.config.doNotAcceptNewUsers) {
|
|
@@ -1518,17 +1597,36 @@ function processTelegramText(msg) {
|
|
|
1518
1597
|
m = m || msg.text.match(/^\/p (.+)$/);
|
|
1519
1598
|
|
|
1520
1599
|
if (m) {
|
|
1600
|
+
garbageCollector();
|
|
1601
|
+
|
|
1602
|
+
if (protection[user] && protection[user].length >= 5) {
|
|
1603
|
+
return bot.sendMessage(msg.from.id, _('Too many attempts. Blocked for', systemLang) + ' ' + Math.round((now - protection[user][protection[user].length - 1]) / 1000) + ' ' + _('seconds', systemLang))
|
|
1604
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1521
1607
|
if (adapter.config.password === m[1]) {
|
|
1608
|
+
if (protection[user]) {
|
|
1609
|
+
delete protection[user];
|
|
1610
|
+
}
|
|
1522
1611
|
storeUser(msg.from.id, msg.from.first_name, msg.from.username);
|
|
1612
|
+
|
|
1523
1613
|
if (!msg.from.username) {
|
|
1524
1614
|
adapter.log.warn(`User ${msg.from.first_name} hast not set an username in the Telegram App!!`);
|
|
1525
1615
|
}
|
|
1616
|
+
|
|
1526
1617
|
return bot.sendMessage(msg.from.id, _('Welcome ', systemLang) + user)
|
|
1527
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1618
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1528
1619
|
} else {
|
|
1620
|
+
protection[user] = protection[user] || [];
|
|
1621
|
+
protection[user].push(Date.now());
|
|
1622
|
+
|
|
1623
|
+
gcInterval = gcInterval || setInterval(() => garbageCollector(), 60000);
|
|
1624
|
+
|
|
1529
1625
|
adapter.log.warn(`Got invalid password from ${user}: ${m[1]}`);
|
|
1626
|
+
|
|
1530
1627
|
bot.sendMessage(msg.from.id, _('Invalid password', systemLang))
|
|
1531
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1628
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1629
|
+
|
|
1532
1630
|
if (users[msg.from.id]) {
|
|
1533
1631
|
delete users[msg.from.id];
|
|
1534
1632
|
}
|
|
@@ -1541,12 +1639,12 @@ function processTelegramText(msg) {
|
|
|
1541
1639
|
// If user is not in the trusted list
|
|
1542
1640
|
if ((adapter.config.password || adapter.config.doNotAcceptNewUsers) && !users[msg.from.id]) {
|
|
1543
1641
|
return bot.sendMessage(msg.from.id, _(adapter.config.doNotAcceptNewUsers ? 'User is not in the list' : 'Please enter password in form "/password phrase"', systemLang))
|
|
1544
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1642
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1545
1643
|
}
|
|
1546
1644
|
|
|
1547
1645
|
if (msg.text === '/help') {
|
|
1548
1646
|
return bot.sendMessage(msg.from.id, getListOfCommands())
|
|
1549
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1647
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1550
1648
|
}
|
|
1551
1649
|
|
|
1552
1650
|
isAnswerForQuestion(adapter, msg);
|
|
@@ -1576,7 +1674,7 @@ function processTelegramText(msg) {
|
|
|
1576
1674
|
if (sValue === '?') {
|
|
1577
1675
|
adapter.getForeignState(id, (err, state) =>
|
|
1578
1676
|
bot.sendMessage(msg.chat.id, getStatus(id, state))
|
|
1579
|
-
.catch(error => adapter.log.error('send Message Error:' + error)));
|
|
1677
|
+
.catch(error => adapter.log.error('send Message Error: ' + error)));
|
|
1580
1678
|
} else {
|
|
1581
1679
|
let value;
|
|
1582
1680
|
if (commands[id].states) {
|
|
@@ -1594,7 +1692,7 @@ function processTelegramText(msg) {
|
|
|
1594
1692
|
value = parseFloat(sValue);
|
|
1595
1693
|
if (sValue !== value.toString()) {
|
|
1596
1694
|
bot.sendMessage(msg.chat.id, _('Invalid number %s', sValue))
|
|
1597
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1695
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1598
1696
|
continue;
|
|
1599
1697
|
}
|
|
1600
1698
|
} else {
|
|
@@ -1603,7 +1701,7 @@ function processTelegramText(msg) {
|
|
|
1603
1701
|
|
|
1604
1702
|
adapter.setForeignState(id, value, false, err =>
|
|
1605
1703
|
bot.sendMessage(msg.chat.id, _('Done')))
|
|
1606
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1704
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1607
1705
|
}
|
|
1608
1706
|
}
|
|
1609
1707
|
}
|
|
@@ -1624,6 +1722,7 @@ function processTelegramText(msg) {
|
|
|
1624
1722
|
if (m) {
|
|
1625
1723
|
let id1 = m[1];
|
|
1626
1724
|
let val1 = m[2];
|
|
1725
|
+
|
|
1627
1726
|
// clear by timeout id
|
|
1628
1727
|
let memoryLeak1 = setTimeout(() => {
|
|
1629
1728
|
msg = null;
|
|
@@ -1640,22 +1739,22 @@ function processTelegramText(msg) {
|
|
|
1640
1739
|
}
|
|
1641
1740
|
if (msg) {
|
|
1642
1741
|
if (err) bot.sendMessage(msg.from.id, err)
|
|
1643
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1742
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1644
1743
|
if (state) {
|
|
1645
1744
|
adapter.setForeignState(id1, val1, false, err => {
|
|
1646
1745
|
if (msg) {
|
|
1647
1746
|
if (err) {
|
|
1648
1747
|
bot.sendMessage(msg.from.id, err)
|
|
1649
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1748
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1650
1749
|
} else {
|
|
1651
1750
|
bot.sendMessage(msg.from.id, _('Done', systemLang))
|
|
1652
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1751
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1653
1752
|
}
|
|
1654
1753
|
}
|
|
1655
1754
|
});
|
|
1656
1755
|
} else {
|
|
1657
1756
|
bot.sendMessage(msg.from.id, _('ID "%s" not found.', systemLang).replace('%s', id1))
|
|
1658
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1757
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1659
1758
|
}
|
|
1660
1759
|
}
|
|
1661
1760
|
});
|
|
@@ -1666,12 +1765,14 @@ function processTelegramText(msg) {
|
|
|
1666
1765
|
m = msg.text.match(/^\/state (.+)$/);
|
|
1667
1766
|
if (m) {
|
|
1668
1767
|
let id2 = m[1];
|
|
1768
|
+
|
|
1669
1769
|
// clear by timeout id
|
|
1670
1770
|
let memoryLeak2 = setTimeout(() => {
|
|
1671
1771
|
id2 = null;
|
|
1672
1772
|
msg = null;
|
|
1673
1773
|
memoryLeak2 = null;
|
|
1674
1774
|
}, 1000);
|
|
1775
|
+
|
|
1675
1776
|
adapter.getForeignState(id2, (err, state) => {
|
|
1676
1777
|
if (memoryLeak2) {
|
|
1677
1778
|
clearTimeout(memoryLeak2);
|
|
@@ -1680,13 +1781,13 @@ function processTelegramText(msg) {
|
|
|
1680
1781
|
}
|
|
1681
1782
|
if (msg) {
|
|
1682
1783
|
if (err) bot.sendMessage(msg.from.id, err)
|
|
1683
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1784
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1684
1785
|
if (state) {
|
|
1685
1786
|
bot.sendMessage(msg.from.id, state.val.toString())
|
|
1686
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1787
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1687
1788
|
} else {
|
|
1688
1789
|
bot.sendMessage(msg.from.id, _('ID "%s" not found.', systemLang).replace('%s', id2))
|
|
1689
|
-
.catch(error => adapter.log.error('send Message Error:' + error));
|
|
1790
|
+
.catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1690
1791
|
}
|
|
1691
1792
|
}
|
|
1692
1793
|
});
|
|
@@ -1705,7 +1806,7 @@ function processTelegramText(msg) {
|
|
|
1705
1806
|
}, response => {
|
|
1706
1807
|
if (response && response.response) {
|
|
1707
1808
|
adapter.log.debug('Send response: ' + response.response);
|
|
1708
|
-
bot.sendMessage(response.id, response.response).catch(error => adapter.log.error('send Message Error:' + error));
|
|
1809
|
+
bot.sendMessage(response.id, response.response).catch(error => adapter.log.error('send Message Error: ' + error));
|
|
1709
1810
|
}
|
|
1710
1811
|
});
|
|
1711
1812
|
}
|
|
@@ -1814,7 +1915,7 @@ function connect() {
|
|
|
1814
1915
|
baseApiUrl: adapter.config.baseApiUrl
|
|
1815
1916
|
};
|
|
1816
1917
|
if (agent) {
|
|
1817
|
-
pollingOptions.request = { agent
|
|
1918
|
+
pollingOptions.request = { agent };
|
|
1818
1919
|
}
|
|
1819
1920
|
adapter.log.debug(`Start polling with: ${pollingOptions.polling.interval}(${typeof pollingOptions.polling.interval}) ms interval`);
|
|
1820
1921
|
bot = new TelegramBot(adapter.config.token, pollingOptions);
|
|
@@ -1908,10 +2009,10 @@ function connect() {
|
|
|
1908
2009
|
}
|
|
1909
2010
|
}
|
|
1910
2011
|
|
|
1911
|
-
function updateUsers(
|
|
2012
|
+
async function updateUsers() {
|
|
1912
2013
|
if (adapter.config.rememberUsers) {
|
|
1913
|
-
|
|
1914
|
-
|
|
2014
|
+
try {
|
|
2015
|
+
const state = await adapter.getStateAsync('communicate.users');
|
|
1915
2016
|
if (state && state.val) {
|
|
1916
2017
|
try {
|
|
1917
2018
|
users = JSON.parse(state.val);
|
|
@@ -1931,10 +2032,9 @@ function updateUsers(cb) {
|
|
|
1931
2032
|
adapter.log.error('Cannot parse stored user IDs!');
|
|
1932
2033
|
}
|
|
1933
2034
|
}
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
cb && cb();
|
|
2035
|
+
} catch (err) {
|
|
2036
|
+
adapter.log.error(err);
|
|
2037
|
+
}
|
|
1938
2038
|
}
|
|
1939
2039
|
}
|
|
1940
2040
|
|
|
@@ -2005,79 +2105,81 @@ function readEnums(name) {
|
|
|
2005
2105
|
});
|
|
2006
2106
|
}
|
|
2007
2107
|
|
|
2008
|
-
function main() {
|
|
2108
|
+
async function main() {
|
|
2009
2109
|
if (!adapter.config.token) {
|
|
2010
|
-
adapter.log.error('Token is not set!');
|
|
2011
|
-
return;
|
|
2110
|
+
return adapter.log.error('Token is not set!');
|
|
2012
2111
|
}
|
|
2013
2112
|
|
|
2014
2113
|
// if old encoding detected
|
|
2015
2114
|
if (!adapter.config.token.includes(':') || adapter.config.token[0] < '0' || adapter.config.token[0] > '9') {
|
|
2016
2115
|
// decode password and token
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
}));
|
|
2116
|
+
const obj = await adapter.getForeignObjectAsync('system.adapter.' + adapter.namespace);
|
|
2117
|
+
const data = await adapter.getForeignObjectAsync('system.config');
|
|
2118
|
+
let systemSecret;
|
|
2119
|
+
if (data && data.native) {
|
|
2120
|
+
systemSecret = data.native.secret;
|
|
2121
|
+
}
|
|
2122
|
+
systemSecret = systemSecret || DEFAULT_SECRET;
|
|
2123
|
+
if (obj.native.passwordRepeat) {
|
|
2124
|
+
obj.native.password = encrypt(systemSecret, obj.native.passwordRepeat);
|
|
2125
|
+
delete obj.native.passwordRepeat;
|
|
2126
|
+
} else {
|
|
2127
|
+
const password = decrypt('Zgfr56gFe87jJON', obj.native.password || '');
|
|
2128
|
+
obj.native.password = encrypt(systemSecret, password);
|
|
2129
|
+
}
|
|
2130
|
+
obj.native.token = encrypt(systemSecret, obj.native.token);
|
|
2131
|
+
await adapter.setForeignObjectAsync(obj._id, obj);
|
|
2132
|
+
return;
|
|
2035
2133
|
}
|
|
2036
2134
|
|
|
2037
|
-
adapter.
|
|
2135
|
+
await adapter.setStateAsync('info.connection', false, true);
|
|
2038
2136
|
|
|
2039
|
-
adapter.
|
|
2040
|
-
adapter.
|
|
2137
|
+
await adapter.subscribeStatesAsync('communicate.request');
|
|
2138
|
+
await adapter.subscribeStatesAsync('communicate.response');
|
|
2139
|
+
await adapter.subscribeStatesAsync('communicate.responseSilent');
|
|
2140
|
+
await adapter.subscribeStatesAsync('communicate.responseJson');
|
|
2141
|
+
await adapter.subscribeStatesAsync('communicate.responseSilentJson');
|
|
2041
2142
|
|
|
2042
2143
|
// clear states
|
|
2043
|
-
adapter.
|
|
2044
|
-
adapter.
|
|
2045
|
-
adapter.
|
|
2144
|
+
await adapter.setStateAsync('communicate.request', '', true);
|
|
2145
|
+
await adapter.setStateAsync('communicate.response', '', true);
|
|
2146
|
+
await adapter.setStateAsync('communicate.responseSilent', '', true);
|
|
2147
|
+
await adapter.setStateAsync('communicate.responseJson', '', true);
|
|
2148
|
+
await adapter.setStateAsync('communicate.responseSilentJson', '', true);
|
|
2149
|
+
await adapter.setStateAsync('communicate.pathFile', '', true);
|
|
2046
2150
|
|
|
2047
2151
|
adapter.config.password = adapter.config.password || '';
|
|
2048
2152
|
adapter.config.keyboard = adapter.config.keyboard || '/cmds';
|
|
2049
2153
|
|
|
2050
|
-
updateUsers(
|
|
2051
|
-
|
|
2052
|
-
|
|
2154
|
+
await updateUsers();
|
|
2155
|
+
if (adapter.config.allowStates !== undefined) {
|
|
2156
|
+
adapter.config.allowStates = true;
|
|
2157
|
+
}
|
|
2158
|
+
adapter.config.answerTimeoutSec = parseInt(adapter.config.answerTimeoutSec, 10) || 60;
|
|
2159
|
+
adapter.config.answerTimeoutSec *= 1000;
|
|
2160
|
+
adapter.config.rememberUsers = adapter.config.rememberUsers === 'true' || adapter.config.rememberUsers === true;
|
|
2161
|
+
|
|
2162
|
+
try {
|
|
2163
|
+
const obj = await adapter.getForeignObjectAsync('system.config');
|
|
2164
|
+
|
|
2165
|
+
if (obj) {
|
|
2166
|
+
systemLang = obj.common.language || 'en';
|
|
2053
2167
|
}
|
|
2054
|
-
adapter.config.answerTimeoutSec = parseInt(adapter.config.answerTimeoutSec, 10) || 60;
|
|
2055
|
-
adapter.config.answerTimeoutSec *= 1000;
|
|
2056
|
-
adapter.config.rememberUsers = adapter.config.rememberUsers === 'true' || adapter.config.rememberUsers === true;
|
|
2057
2168
|
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2169
|
+
await readStatesCommands()
|
|
2170
|
+
if (adapter.config.rooms) {
|
|
2171
|
+
await readEnums();
|
|
2172
|
+
}
|
|
2173
|
+
// init polling every hour
|
|
2174
|
+
reconnectTimer = setInterval(connect, 3600000);
|
|
2063
2175
|
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
})
|
|
2072
|
-
.then(() => {
|
|
2073
|
-
// init polling every hour
|
|
2074
|
-
reconnectTimer = setInterval(connect, 3600000);
|
|
2075
|
-
connect();
|
|
2076
|
-
// detect changes of objects
|
|
2077
|
-
adapter.subscribeForeignObjects('*');
|
|
2078
|
-
});
|
|
2079
|
-
});
|
|
2080
|
-
});
|
|
2176
|
+
connect();
|
|
2177
|
+
|
|
2178
|
+
// detect changes of objects
|
|
2179
|
+
await adapter.subscribeForeignObjectsAsync('*');
|
|
2180
|
+
} catch (err) {
|
|
2181
|
+
adapter.log.error(err);
|
|
2182
|
+
}
|
|
2081
2183
|
}
|
|
2082
2184
|
|
|
2083
2185
|
// If started as allInOne/compact mode => return function to create instance
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.telegram",
|
|
3
3
|
"description": "The adapter allows to send and receive telegram messages from ioBroker and to be a broker.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.0",
|
|
5
5
|
"author": "bluefox <dogafox@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/iobroker-community-adapters/ioBroker.telegram",
|
|
7
7
|
"repository": {
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"node-telegram-bot-api": "^0.56.0",
|
|
23
|
-
"@iobroker/adapter-core": "^2.
|
|
24
|
-
"axios": "^0.
|
|
23
|
+
"@iobroker/adapter-core": "^2.6.0",
|
|
24
|
+
"axios": "^0.26.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@alcalzone/release-script": "^3.5.
|
|
28
|
-
"@alcalzone/release-script-plugin-iobroker": "^3.5.
|
|
29
|
-
"@alcalzone/release-script-plugin-license": "^3.5.
|
|
27
|
+
"@alcalzone/release-script": "^3.5.6",
|
|
28
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.5.7",
|
|
29
|
+
"@alcalzone/release-script-plugin-license": "^3.5.3",
|
|
30
30
|
"gulp": "^4.0.2",
|
|
31
|
-
"mocha": "^9.2.
|
|
31
|
+
"mocha": "^9.2.2",
|
|
32
32
|
"chai": "^4.3.6"
|
|
33
33
|
},
|
|
34
34
|
"bugs": {
|
package/admin/index.html
DELETED
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<!-- these 4 files always have to be included -->
|
|
4
|
-
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
|
|
5
|
-
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
|
|
6
|
-
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
|
|
7
|
-
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>
|
|
8
|
-
|
|
9
|
-
<!-- these three files have to be always included -->
|
|
10
|
-
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
|
|
11
|
-
<script type="text/javascript" src="../../js/translate.js"></script>
|
|
12
|
-
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
|
|
13
|
-
<script type="text/javascript" src="words.js"></script>
|
|
14
|
-
|
|
15
|
-
<style>
|
|
16
|
-
.help {
|
|
17
|
-
font-size: small
|
|
18
|
-
}
|
|
19
|
-
.inputStyle {
|
|
20
|
-
width: 300px;
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
23
|
-
<!-- you have to define 2 functions in the global scope: -->
|
|
24
|
-
<script type="text/javascript">
|
|
25
|
-
|
|
26
|
-
function encrypt(key, value) {
|
|
27
|
-
var result="";
|
|
28
|
-
for(var i = 0; i < value.length; ++i) {
|
|
29
|
-
result += String.fromCharCode(key[i % key.length].charCodeAt(0) ^ value.charCodeAt(i));
|
|
30
|
-
}
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function decrypt(key, value) {
|
|
35
|
-
var result = "";
|
|
36
|
-
for(var i = 0; i < value.length; ++i) {
|
|
37
|
-
result += String.fromCharCode(key[i % key.length].charCodeAt(0) ^ value.charCodeAt(i));
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function showHideSettings() {
|
|
43
|
-
if ($('#server').val() === 'true') {
|
|
44
|
-
$('#tabs').tabs('option', 'disabled', []);
|
|
45
|
-
$('.pollingIntervalSub').hide();
|
|
46
|
-
$('.le-settings').show();
|
|
47
|
-
|
|
48
|
-
if ($('#leEnabled').prop('checked')) {
|
|
49
|
-
$('.le-sub-settings').show();
|
|
50
|
-
if ($('#leUpdate').prop('checked')) {
|
|
51
|
-
$('.le-sub-settings-update').show();
|
|
52
|
-
} else {
|
|
53
|
-
$('.le-sub-settings-update').hide();
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
$('.le-sub-settings').hide();
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
$('#tabs').tabs('option', 'disabled', [1]);
|
|
60
|
-
$('.pollingIntervalSub').show();
|
|
61
|
-
if($('#rememberUsers').prop('checked')) {
|
|
62
|
-
$('.useUsernameSub').show();
|
|
63
|
-
} else {
|
|
64
|
-
$('.useUsernameSub').hide();
|
|
65
|
-
}
|
|
66
|
-
if ($('#proxy').prop('checked')) {
|
|
67
|
-
$('.col-proxyHost').show();
|
|
68
|
-
$('.col-proxyPort').show();
|
|
69
|
-
$('.col-proxyLogin').show();
|
|
70
|
-
$('.col-proxyPassword').show();
|
|
71
|
-
} else {
|
|
72
|
-
$('.col-proxyHost').hide();
|
|
73
|
-
$('.col-proxyPort').hide();
|
|
74
|
-
$('.col-proxyLogin').hide();
|
|
75
|
-
$('.col-proxyPassword').hide();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// the function loadSettings has to exist ...
|
|
83
|
-
function load(settings, onChange) {
|
|
84
|
-
$('#tabs').tabs();
|
|
85
|
-
settings.password = decrypt('Zgfr56gFe87jJON', settings.password);
|
|
86
|
-
|
|
87
|
-
if (!settings.lePort) settings.lePort = 80;
|
|
88
|
-
if (!settings.server) settings.server = 'false';
|
|
89
|
-
if (!settings.pollingInterval) settings.pollingInterval = 300;
|
|
90
|
-
|
|
91
|
-
getIPs(function(ips) {
|
|
92
|
-
for (var i = 0; i < ips.length; i++) {
|
|
93
|
-
$('#bind').append('<option value="' + ips[i].address + '">' + ips[i].name + '</option>');
|
|
94
|
-
}
|
|
95
|
-
$('#bind.value').val(settings.bind);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
if (settings.restarted === undefined || settings.restarted === '_') settings.restarted = _('Started!');
|
|
99
|
-
if (settings.restarting === undefined || settings.restarting === '_') settings.restarting = _('Restarting...');
|
|
100
|
-
|
|
101
|
-
for (var key in settings) {
|
|
102
|
-
if (!settings.hasOwnProperty(key)) continue;
|
|
103
|
-
var $value = $('#' + key + '.value');
|
|
104
|
-
if ($value.attr('type') === 'checkbox') {
|
|
105
|
-
$value.prop('checked', settings[key]).change(function () {
|
|
106
|
-
var id = $(this).attr('id');
|
|
107
|
-
if (id === 'server' || id === 'leEnabled' || id === 'leUpdate' || id === 'rememberUsers' || id === 'proxy') showHideSettings();
|
|
108
|
-
onChange();
|
|
109
|
-
});
|
|
110
|
-
} else {
|
|
111
|
-
$value.val(settings[key]).change(function () {
|
|
112
|
-
var id = $(this).attr('id');
|
|
113
|
-
if (id === 'server' || id === 'leEnabled' || id === 'leUpdate' || id === 'rememberUsers' || id === 'proxy') showHideSettings();
|
|
114
|
-
onChange();
|
|
115
|
-
}).keyup(function () {
|
|
116
|
-
$(this).trigger('change');
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
fillSelectCertificates('#certPublic', 'public', settings.certPublic);
|
|
122
|
-
fillSelectCertificates('#certPrivate', 'private', settings.certPrivate);
|
|
123
|
-
fillSelectCertificates('#certChained', 'chained', settings.certChained);
|
|
124
|
-
|
|
125
|
-
getAdapterInstances('text2command', function (list) {
|
|
126
|
-
var text = '<option value="">' + _('none') + '</option>';
|
|
127
|
-
for (var l = 0; l < list.length; l++) {
|
|
128
|
-
text += '<option value="' + list[l]._id +'" ' + (settings.text2command === list[l]._id ? 'selected' : '') + '>' + list[l]._id.replace('system.adapter.', '') + '</option>';
|
|
129
|
-
}
|
|
130
|
-
$('#text2command').html(text);
|
|
131
|
-
});
|
|
132
|
-
$('#passwordRepeat').val(settings.password);
|
|
133
|
-
|
|
134
|
-
showHideSettings();
|
|
135
|
-
|
|
136
|
-
// Signal to admin, that no changes yet
|
|
137
|
-
onChange(false);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function save(callback) {
|
|
141
|
-
// example: select elements with class=value and build settings object
|
|
142
|
-
var obj = {};
|
|
143
|
-
$('.value').each(function () {
|
|
144
|
-
var $this = $(this);
|
|
145
|
-
if ($this.attr('type') === 'checkbox') {
|
|
146
|
-
obj[$this.attr('id')] = $this.prop('checked');
|
|
147
|
-
} else {
|
|
148
|
-
obj[$this.attr('id')] = $this.val();
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
if ($('#server').val() === 'true') {
|
|
153
|
-
if (!$('#leEnabled').prop('checked') && (!$('#certPublic').val() || !$('#certPrivate').val())) {
|
|
154
|
-
showMessage(_('Set certificates or load it first in the system settings (right top).'));
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (!$('#url').val()) {
|
|
158
|
-
showMessage(_('URL may not be empty'));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if ($('#passwordRepeat').val() !== obj.password) {
|
|
163
|
-
showMessage(_('Password confirmation is not equal with password'));
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
obj.password = encrypt('Zgfr56gFe87jJON', obj.password);
|
|
167
|
-
|
|
168
|
-
callback(obj);
|
|
169
|
-
}
|
|
170
|
-
</script>
|
|
171
|
-
</head>
|
|
172
|
-
<body>
|
|
173
|
-
<!-- you have to put your config page in a div with id adapter-container -->
|
|
174
|
-
<div id="adapter-container">
|
|
175
|
-
<table><tr>
|
|
176
|
-
<td><img src="telegram.png" width="100px"></td>
|
|
177
|
-
<td style="padding-top: 20px;padding-left: 10px"><h3 class="translate">telegram adapter settings</h3></td>
|
|
178
|
-
</tr></table>
|
|
179
|
-
|
|
180
|
-
<div id="tabs">
|
|
181
|
-
<ul>
|
|
182
|
-
<li><a href="#tabs-1" class="translate">Main settings</a></li>
|
|
183
|
-
<li><a href="#tabs-2" class="translate">Server settings</a></li>
|
|
184
|
-
</ul>
|
|
185
|
-
<div id="tabs-1">
|
|
186
|
-
<table style="width: 100%">
|
|
187
|
-
<tr>
|
|
188
|
-
<td colspan='3'><h4 class="translate" style="width: 90%">Main settings</h4></td>
|
|
189
|
-
</tr>
|
|
190
|
-
<tr>
|
|
191
|
-
<td><label class="translate" for="server">Type</label></td>
|
|
192
|
-
<td>
|
|
193
|
-
<select id="server" class="value inputStyle" >
|
|
194
|
-
<option value="false" class="translate">polling</option>
|
|
195
|
-
<option value="true" class="translate">server</option>
|
|
196
|
-
</select>
|
|
197
|
-
</td>
|
|
198
|
-
<td></td>
|
|
199
|
-
</tr>
|
|
200
|
-
<tr class="server pollingIntervalSub">
|
|
201
|
-
<td class="translate">Polling interval (ms)</td>
|
|
202
|
-
<td><input id="pollingInterval" class="value inputStyle" /></td>
|
|
203
|
-
<td></td>
|
|
204
|
-
</tr>
|
|
205
|
-
<tr>
|
|
206
|
-
<td class="translate">Token</td>
|
|
207
|
-
<td><input id="token" class="value inputStyle" /></td>
|
|
208
|
-
<td><a href="https://github.com/ioBroker/ioBroker.telegram#iobroker-telegram-adapter" target="_blank" class="translate help">Read README.md how to get token</a></td>
|
|
209
|
-
</tr>
|
|
210
|
-
<tr>
|
|
211
|
-
<td class="translate">API URL</td>
|
|
212
|
-
<td><input id="baseApiUrl" class="value inputStyle" /></td>
|
|
213
|
-
</tr>
|
|
214
|
-
<tr>
|
|
215
|
-
<td class="translate">Password</td>
|
|
216
|
-
<td><input id="password" class="value inputStyle" type="password"/></td>
|
|
217
|
-
<td class="translate help">Leave it blank if no password desired</td>
|
|
218
|
-
</tr>
|
|
219
|
-
<tr>
|
|
220
|
-
<td class="translate">Password repeat</td>
|
|
221
|
-
<td><input id="passwordRepeat" class="inputStyle" type="password"/></td>
|
|
222
|
-
<td class="translate help">Repeat password</td>
|
|
223
|
-
</tr>
|
|
224
|
-
<tr>
|
|
225
|
-
<td class="translate">Text2Command Instance</td>
|
|
226
|
-
<td><select id="text2command" class="value inputStyle"></select></td>
|
|
227
|
-
<td class="translate help">All requests will be sent to this text2Command instance</td>
|
|
228
|
-
</tr>
|
|
229
|
-
<tr>
|
|
230
|
-
<td class="translate">Store user's IDs</td>
|
|
231
|
-
<td><input id="rememberUsers" class="value" type="checkbox"/></td>
|
|
232
|
-
<td class="translate help">Remember authenticated users</td>
|
|
233
|
-
</tr>
|
|
234
|
-
<tr class="useUsernameSub">
|
|
235
|
-
<td class="translate">Store username not firstname</td>
|
|
236
|
-
<td><input id="useUsername" class="value" type="checkbox"/></td>
|
|
237
|
-
<td class="translate help">Store username instead of firstname of remembered users</td>
|
|
238
|
-
</tr>
|
|
239
|
-
<tr>
|
|
240
|
-
<td class="translate">Proxy Socks5 enable</td>
|
|
241
|
-
<td><input id="proxy" class="value" type="checkbox"/></td>
|
|
242
|
-
</tr>
|
|
243
|
-
<tr class="col-proxyHost">
|
|
244
|
-
<td class="translate" for="proxyHost">proxy Host</td>
|
|
245
|
-
<td><input id="proxyHost" class="value" type="text"/></td>
|
|
246
|
-
<td class="translate help">proxy Host</td>
|
|
247
|
-
</tr>
|
|
248
|
-
<tr class="col-proxyPort">
|
|
249
|
-
<td class="translate" for="proxyPort">port</td>
|
|
250
|
-
<td><input class="value number" id="proxyPort" size="5" maxlength="5" type="number"/></td>
|
|
251
|
-
<td class="translate help">port</td>
|
|
252
|
-
</tr>
|
|
253
|
-
<tr class="col-proxyLogin">
|
|
254
|
-
<td class="translate" for="proxyLogin">Login</td>
|
|
255
|
-
<td><input id="proxyLogin" class="value" type="text"/></td>
|
|
256
|
-
<td class="translate help">Login</td>
|
|
257
|
-
</tr>
|
|
258
|
-
<tr class="col-proxyPassword">
|
|
259
|
-
<td class="translate" for="proxyPassword">password</td>
|
|
260
|
-
<td><input id="proxyPassword" class="value" type="password"/></td>
|
|
261
|
-
<std class="translate help">password</td>
|
|
262
|
-
</tr>
|
|
263
|
-
<tr>
|
|
264
|
-
<td class="translate">Store raw request</td>
|
|
265
|
-
<td><input id="storeRawRequest" class="value" type="checkbox"/></td>
|
|
266
|
-
<td class="translate help">Remember raw request data</td>
|
|
267
|
-
</tr>
|
|
268
|
-
<tr>
|
|
269
|
-
<td class="translate">Save media files</td>
|
|
270
|
-
<td><input id="saveFiles" class="value" type="checkbox"/></td>
|
|
271
|
-
<td class="translate help">Save media files</td>
|
|
272
|
-
</tr>
|
|
273
|
-
<tr>
|
|
274
|
-
<td class="translate">Path</td>
|
|
275
|
-
<td><input id="path" class="value inputStyle" /></td>
|
|
276
|
-
<td class="translate help">The path where files will be stored</td>
|
|
277
|
-
</tr>
|
|
278
|
-
<tr>
|
|
279
|
-
<td colspan='3'><h4 class="translate" style="width: 90%">Texts</h4></td>
|
|
280
|
-
</tr>
|
|
281
|
-
<tr>
|
|
282
|
-
<td class="translate">"Started" text</td>
|
|
283
|
-
<td><input id="restarted" class="value inputStyle"/></td>
|
|
284
|
-
<td class="translate help">restarted_help</td>
|
|
285
|
-
</tr>
|
|
286
|
-
<tr>
|
|
287
|
-
<td class="translate">"Restarting" text</td>
|
|
288
|
-
<td><input id="restarting" class="value inputStyle"/></td>
|
|
289
|
-
<td class="translate help">restarting_help</td>
|
|
290
|
-
</tr>
|
|
291
|
-
</table>
|
|
292
|
-
</div>
|
|
293
|
-
<div id="tabs-2">
|
|
294
|
-
<table style="width: 100%">
|
|
295
|
-
<tr class="server">
|
|
296
|
-
<td ><label class="translate" for="url">URL</label></td>
|
|
297
|
-
<td><input class="value inputStyle" id="url"/></td>
|
|
298
|
-
<td class="translate help">url_help</td>
|
|
299
|
-
</tr>
|
|
300
|
-
<tr class="server">
|
|
301
|
-
<td ><label class="translate" for="bind">IP</label></td>
|
|
302
|
-
<td colspan="2"><select class="value inputStyle" id="bind"></select></td>
|
|
303
|
-
<td></td>
|
|
304
|
-
</tr>
|
|
305
|
-
<tr class="server">
|
|
306
|
-
<td><label class="translate" for="port">Port</label></td>
|
|
307
|
-
<td><input class="value" id="port" size="5" maxlength="5" type="number"/></td>
|
|
308
|
-
<td class="translate help">port_help</td>
|
|
309
|
-
</tr>
|
|
310
|
-
<tr class="server">
|
|
311
|
-
<td><label class="translate" for="certPublic">Public certificate</label></td>
|
|
312
|
-
<td><select id="certPublic" class="value" style="width: 200px"></select></td>
|
|
313
|
-
<td></td>
|
|
314
|
-
</tr>
|
|
315
|
-
<tr class="server">
|
|
316
|
-
<td><label class="translate" for="certPrivate">Private certificate</label></td>
|
|
317
|
-
<td><select id="certPrivate" class="value" style="width: 200px"></select></td>
|
|
318
|
-
<td></td>
|
|
319
|
-
</tr>
|
|
320
|
-
<tr class="server">
|
|
321
|
-
<td><label class="translate" for="certChained">Chained certificate</label></td>
|
|
322
|
-
<td><select id="certChained" class="value" style="width: 200px"></select></td>
|
|
323
|
-
<td></td>
|
|
324
|
-
</tr>
|
|
325
|
-
<tr class="server">
|
|
326
|
-
<td colspan='3'><h4 class="translate" style="width: 90%">Let's Encrypt settings</h4></td>
|
|
327
|
-
</tr>
|
|
328
|
-
<tr class="server le-settings"><td><label for="leEnabled" class="translate">Use Lets Encrypt certificates</label></td><td><input class="value" id="leEnabled" type="checkbox" /></td><td></td></tr>
|
|
329
|
-
<tr class="server le-settings le-sub-settings"><td><label for="leUpdate" class="translate">Use this instance for automatic update</label></td><td><input class="value" id="leUpdate" type="checkbox" /></td><td></td></tr>
|
|
330
|
-
<tr class="server le-settings le-sub-settings le-sub-settings-update"><td><label for="lePort" class="translate">Port to check the domain</label></td><td><input class="value number" id="lePort" type="number" size="5" maxlength="5" /></td><td></td></tr>
|
|
331
|
-
</table>
|
|
332
|
-
</div>
|
|
333
|
-
</div>
|
|
334
|
-
</div>
|
|
335
|
-
</body>
|
|
336
|
-
</html>
|