diff --git a/README.md b/README.md
index 202e61a24..4b80dbdb3 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,10 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the
+### **WORK IN PROGRESS**
+
+* (klein0r) Added new block for http response
+
### 7.9.1 (2024-03-15)
* (klein0r) Configurable trigger warning limit (default: 100 per script)
diff --git a/src/public/google-blockly/own/blocks_action.js b/src/public/google-blockly/own/blocks_action.js
index 9e73de713..6331572ae 100644
--- a/src/public/google-blockly/own/blocks_action.js
+++ b/src/public/google-blockly/own/blocks_action.js
@@ -212,6 +212,70 @@ Blockly.JavaScript['http_post'] = function(block) {
'});\n';
};
+// --- get info about event -----------------------------------------------------------
+Blockly.Action.blocks['http_response'] =
+ ''
+ + ' '
+ + ' '
+ + '';
+
+Blockly.Blocks['http_response'] = {
+ /**
+ * Block for conditionally returning a value from a procedure.
+ * @this Blockly.Block
+ */
+ init: function() {
+ this.appendDummyInput()
+ .appendField('🌐');
+
+ this.appendDummyInput('ATTR')
+ .appendField(new Blockly.FieldDropdown([
+ [Blockly.Translate('http_response_data'), 'response.data'],
+ ]), 'ATTR');
+
+ this.setInputsInline(true);
+ this.setOutput(true);
+ this.setColour(Blockly.Trigger.HUE);
+ this.setTooltip(Blockly.Translate('http_response_tooltip'));
+ //this.setHelpUrl(getHelp('http_response'));
+ },
+ /**
+ * Called whenever anything on the workspace changes.
+ * Add warning if this flow block is not nested inside a loop.
+ * @param {!Blockly.Events.Abstract} e Change event.
+ * @this Blockly.Block
+ */
+ onchange: function(e) {
+ let legal = false;
+ // Is the block nested in a trigger?
+ let block = this;
+ do {
+ if (this.FUNCTION_TYPES.includes(block.type)) {
+ legal = true;
+ break;
+ }
+ block = block.getSurroundParent();
+ } while (block);
+
+ if (legal) {
+ this.setWarningText(null, this.id);
+ } else {
+ this.setWarningText(Blockly.Translate('http_response_warning'), this.id);
+ }
+ },
+ /**
+ * List of block types that are functions and thus do not need warnings.
+ * To add a new function type add this to your code:
+ * Blockly.Blocks['procedures_ifreturn'].FUNCTION_TYPES.push('custom_func');
+ */
+ FUNCTION_TYPES: ['http_get', 'http_post'],
+};
+Blockly.JavaScript['http_response'] = function(block) {
+ const attr = block.getFieldValue('ATTR');
+
+ return [attr, Blockly.JavaScript.ORDER_ATOMIC];
+};
+
// --- action request --------------------------------------------------
Blockly.Action.blocks['request'] =
''
diff --git a/src/public/google-blockly/own/blocks_words.js b/src/public/google-blockly/own/blocks_words.js
index 090d4bce8..782fb905a 100644
--- a/src/public/google-blockly/own/blocks_words.js
+++ b/src/public/google-blockly/own/blocks_words.js
@@ -56,6 +56,12 @@ Blockly.Words['http_post_data'] = {'en': 'data',
Blockly.Words['http_post_tooltip'] = {'en': 'Request ressources via http', 'de': 'Ressourcen anfordern via http', 'ru': 'Запрос ресурсов через http', 'pt': 'Solicitar recursos via http', 'nl': 'Resources aanvragen via http', 'fr': 'Demander des ressources via http', 'it': 'Richiesta di risorse via http', 'es': 'Solicitar ressources via http', 'pl': 'Wniosek o ponowne źródła informacji za pośrednictwem http', 'zh-cn': '通过 http 请求资源源', 'uk': 'Запит ресурсів через HTTP'};
Blockly.Words['http_post_help'] = {'en': 'httpPost', 'de': 'httpPost', 'ru': 'httpPost', 'pt': 'httpPost', 'nl': 'httpPost', 'fr': 'httpPost', 'it': 'httpPost', 'es': 'httpPost', 'pl': 'httpPost', 'zh-cn': 'httpPost', 'uk': 'httpPost'};
+// --- action http_response --------------------------------------------------
+
+Blockly.Words['http_response_data'] = {'en': 'data', 'de': 'data', 'ru': 'data', 'pt': 'data', 'nl': 'data', 'fr': 'data', 'it': 'data', 'es': 'data', 'pl': 'data', 'zh-cn': 'data', 'uk': 'data'};
+Blockly.Words['http_response_warning'] = {'en': 'This block must be used inside of http blocks', 'de': 'Dieser Block muss innerhalb von http-Blöcken verwendet werden', 'ru': 'Этот блок должен быть использован внутри блоков http', 'pt': 'Este bloco deve ser usado dentro de blocos http', 'nl': 'Dit blok moet worden gebruikt binnen http-blokken', 'fr': 'Ce bloc doit être utilisé à l\'intérieur des blocs http', 'it': 'Questo blocco deve essere utilizzato all\'interno dei blocchi http', 'es': 'Este bloque debe ser utilizado dentro de bloques http', 'pl': 'Ten blok musi być używany wewnątrz bloków http', 'zh-cn': '此块必须在 http 块内使用', 'uk': 'Цей блок повинен використовуватися всередині блоків'};
+Blockly.Words['http_response_tooltip'] = {'en': 'Response information', 'de': 'Information aus der Antwort', 'ru': 'Информация о мерах реагирования', 'pt': 'InformaçÃμes de resposta', 'nl': 'Responsinformatie', 'fr': 'Réponse', 'it': 'Informazioni sulla risposta', 'es': 'Información sobre la respuesta', 'pl': 'Informacje o odpowiedzi', 'zh-cn': '答复信息', 'uk': 'Інформація про відповідь'};
+
// --- action request --------------------------------------------------
Blockly.Words['request'] = {'en': 'request (deprecated)', 'de': 'request (deprecated)', 'ru': 'request (deprecated)', 'pt': 'request (deprecated)', 'nl': 'verzoek (deprecated)', 'fr': 'demande (deprecated)', 'it': 'richiesta (deprecated)', 'es': 'solicitud (deprecated)', 'pl': 'request (deprecated)', 'zh-cn': '请求网址 (deprecated)', 'uk': 'запит (deprecated)'};
Blockly.Words['request_url'] = {'en': 'URL', 'de': 'URL', 'ru': 'URL', 'pt': 'URL', 'nl': 'URL', 'fr': 'URL', 'it': 'URL', 'es': 'URL', 'pl': 'URL', 'zh-cn': '网址', 'uk': 'URL'};