Skip to content

Commit

Permalink
chore: release v7.9.3
Browse files Browse the repository at this point in the history
* (klein0r) Added timeout option for http blocks
* (klein0r) Added option for basic auth in url (user:pass)
  • Loading branch information
klein0r committed Mar 19, 2024
1 parent 10ddb6d commit ed7a404
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG_OLD.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
The newest change log is in README.md
## 7.7.0 (2024-01-14)

* (klein0r) Added block for multiple and conditions

## 7.6.3 (2024-01-11)

* (klein0r) Fixed bug in formatTimeDiff Blockly
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the
<!--
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
### 7.9.3 (2024-03-19)

* (klein0r) Added timeout option for http blocks
* (klein0r) Added option for basic auth in url (user:pass)
Expand Down Expand Up @@ -75,10 +75,6 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the
* (klein0r) Raised supported ecmaVersion from es2018 to es2021
* (klein0r) Fixed getIdByName (returned the same id as array)

### 7.7.0 (2024-01-14)

* (klein0r) Added block for multiple and conditions

## License
The MIT License (MIT)

Expand Down
10 changes: 5 additions & 5 deletions admin/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"files": {
"main.js": "/static/js/main.7cef0c28.js",
"main.js": "/static/js/main.f61d5390.js",
"static/css/864.42bfc5f3.chunk.css": "/static/css/864.42bfc5f3.chunk.css",
"static/js/864.d2336593.chunk.js": "/static/js/864.d2336593.chunk.js",
"static/js/864.d62d2890.chunk.js": "/static/js/864.d62d2890.chunk.js",
"static/js/805.7c367e53.chunk.js": "/static/js/805.7c367e53.chunk.js",
"static/js/431.a62490cf.chunk.js": "/static/js/431.a62490cf.chunk.js",
"static/js/702.1692c400.chunk.js": "/static/js/702.1692c400.chunk.js",
Expand Down Expand Up @@ -160,9 +160,9 @@
"static/media/Garage Doors.svg": "/static/media/Garage Doors.0c2a1cfca7ad1ea59625.svg",
"static/media/Outdoor Blinds.svg": "/static/media/Outdoor Blinds.37b85a9c060a4af48da9.svg",
"static/media/Upstairs.svg": "/static/media/Upstairs.441813e54e0daca0882d.svg",
"main.7cef0c28.js.map": "/static/js/main.7cef0c28.js.map",
"main.f61d5390.js.map": "/static/js/main.f61d5390.js.map",
"864.42bfc5f3.chunk.css.map": "/static/css/864.42bfc5f3.chunk.css.map",
"864.d2336593.chunk.js.map": "/static/js/864.d2336593.chunk.js.map",
"864.d62d2890.chunk.js.map": "/static/js/864.d62d2890.chunk.js.map",
"805.7c367e53.chunk.js.map": "/static/js/805.7c367e53.chunk.js.map",
"431.a62490cf.chunk.js.map": "/static/js/431.a62490cf.chunk.js.map",
"702.1692c400.chunk.js.map": "/static/js/702.1692c400.chunk.js.map",
Expand Down Expand Up @@ -195,6 +195,6 @@
"96.fe9915d5.chunk.js.map": "/static/js/96.fe9915d5.chunk.js.map"
},
"entrypoints": [
"static/js/main.7cef0c28.js"
"static/js/main.f61d5390.js"
]
}
44 changes: 42 additions & 2 deletions admin/google-blockly/own/blocks_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ Blockly.Action.blocks['http_get'] =
+ ' <field name="TEXT">http://</field>'
+ ' </shadow>'
+ ' </value>'
+ ' <value name="TIMEOUT">'
+ ' </value>'
+ ' <value name="UNIT">'
+ ' </value>'
+ ' <value name="STATEMENT">'
+ ' </value>'
+ '</block>';
Expand All @@ -133,6 +137,14 @@ Blockly.Blocks['http_get'] = {
this.appendValueInput('URL')
.appendField(Blockly.Translate('http_get'));

this.appendDummyInput()
.appendField(Blockly.Translate('http_get_timeout'))
.appendField(new Blockly.FieldTextInput(2000), 'TIMEOUT')
.appendField(new Blockly.FieldDropdown([
[Blockly.Translate('http_get_settimeout_ms'), 'ms'],
[Blockly.Translate('http_get_settimeout_sec'), 'sec']
]), 'UNIT');

this.appendStatementInput('STATEMENT')
.setCheck(null);

Expand All @@ -149,8 +161,16 @@ Blockly.Blocks['http_get'] = {
Blockly.JavaScript['http_get'] = function(block) {
const URL = Blockly.JavaScript.valueToCode(block, 'URL', Blockly.JavaScript.ORDER_ATOMIC);
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
const unit = block.getFieldValue('UNIT');
let timeout = block.getFieldValue('TIMEOUT');
if (!timeout) {
timeout = 2000;
}
if (unit === 'sec') {
timeout *= 1000;
}

return `httpGet(${URL}, { timeout: 2000 }, async (err, response) => {\n` +
return `httpGet(${URL}, { timeout: ${timeout} }, async (err, response) => {\n` +
Blockly.JavaScript.prefixLines(`if (err) {`, Blockly.JavaScript.INDENT) + '\n' +
Blockly.JavaScript.prefixLines(`console.error(err);`, Blockly.JavaScript.INDENT + Blockly.JavaScript.INDENT) + '\n' +
Blockly.JavaScript.prefixLines(`}`, Blockly.JavaScript.INDENT) + '\n' +
Expand All @@ -166,6 +186,10 @@ Blockly.Action.blocks['http_post'] =
+ ' <field name="TEXT">http://</field>'
+ ' </shadow>'
+ ' </value>'
+ ' <value name="TIMEOUT">'
+ ' </value>'
+ ' <value name="UNIT">'
+ ' </value>'
+ ' <value name="DATA">'
+ ' <shadow type="object_new">'
+ ' </shadow>'
Expand All @@ -179,6 +203,14 @@ Blockly.Blocks['http_post'] = {
this.appendValueInput('URL')
.appendField(Blockly.Translate('http_post'));

this.appendDummyInput()
.appendField(Blockly.Translate('http_post_timeout'))
.appendField(new Blockly.FieldTextInput(2000), 'TIMEOUT')
.appendField(new Blockly.FieldDropdown([
[Blockly.Translate('http_post_settimeout_ms'), 'ms'],
[Blockly.Translate('http_post_settimeout_sec'), 'sec']
]), 'UNIT');

this.appendValueInput('DATA')
.appendField(Blockly.Translate('http_post_data'));

Expand All @@ -199,12 +231,20 @@ Blockly.JavaScript['http_post'] = function(block) {
const URL = Blockly.JavaScript.valueToCode(block, 'URL', Blockly.JavaScript.ORDER_ATOMIC);
const data = Blockly.JavaScript.valueToCode(block, 'DATA', Blockly.JavaScript.ORDER_ATOMIC);
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
const unit = block.getFieldValue('UNIT');
let timeout = block.getFieldValue('TIMEOUT');
if (!timeout) {
timeout = 2000;
}
if (unit === 'sec') {
timeout *= 1000;
}

if (!data) {
data = '{}';
}

return `httpPost(${URL}, ${data}, { timeout: 2000 }, async (err, response) => {\n` +
return `httpPost(${URL}, ${data}, { timeout: ${timeout} }, async (err, response) => {\n` +
Blockly.JavaScript.prefixLines(`if (err) {`, Blockly.JavaScript.INDENT) + '\n' +
Blockly.JavaScript.prefixLines(`console.error(err);`, Blockly.JavaScript.INDENT + Blockly.JavaScript.INDENT) + '\n' +
Blockly.JavaScript.prefixLines(`}`, Blockly.JavaScript.INDENT) + '\n' +
Expand Down
6 changes: 4 additions & 2 deletions admin/google-blockly/own/blocks_system.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ Blockly.Blocks['create_ex'] = {
[Blockly.Translate('create_type_number'), 'number'],
[Blockly.Translate('create_type_boolean'), 'boolean'],
[Blockly.Translate('create_type_json'), 'json'],
//[Blockly.Translate('create_type_object'), 'object'],
//[Blockly.Translate('create_type_array'), 'array'],
[Blockly.Translate('create_type_object'), 'object'],
[Blockly.Translate('create_type_array'), 'array'],
//[Blockly.Translate('create_type_file'), 'file'],
]), 'TYPE');

Expand Down Expand Up @@ -726,6 +726,8 @@ Blockly.JavaScript['create_ex'] = function(block) {
if (value !== null && value !== '') {
if (type === 'number') {
paraV = `, parseFloat(${value})`;
} else if (type === 'boolean') {
paraV = `, !!${value}`;
} else {
paraV = ', ' + value;
}
Expand Down
Loading

0 comments on commit ed7a404

Please sign in to comment.