Skip to content

Commit ed7a404

Browse files
committed
chore: release v7.9.3
* (klein0r) Added timeout option for http blocks * (klein0r) Added option for basic auth in url (user:pass)
1 parent 10ddb6d commit ed7a404

16 files changed

+91
-41
lines changed

CHANGELOG_OLD.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
The newest change log is in README.md
2+
## 7.7.0 (2024-01-14)
3+
4+
* (klein0r) Added block for multiple and conditions
5+
26
## 7.6.3 (2024-01-11)
37

48
* (klein0r) Fixed bug in formatTimeDiff Blockly

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the
4646
<!--
4747
### **WORK IN PROGRESS**
4848
-->
49-
### **WORK IN PROGRESS**
49+
### 7.9.3 (2024-03-19)
5050

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

78-
### 7.7.0 (2024-01-14)
79-
80-
* (klein0r) Added block for multiple and conditions
81-
8278
## License
8379
The MIT License (MIT)
8480

admin/asset-manifest.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"files": {
3-
"main.js": "/static/js/main.7cef0c28.js",
3+
"main.js": "/static/js/main.f61d5390.js",
44
"static/css/864.42bfc5f3.chunk.css": "/static/css/864.42bfc5f3.chunk.css",
5-
"static/js/864.d2336593.chunk.js": "/static/js/864.d2336593.chunk.js",
5+
"static/js/864.d62d2890.chunk.js": "/static/js/864.d62d2890.chunk.js",
66
"static/js/805.7c367e53.chunk.js": "/static/js/805.7c367e53.chunk.js",
77
"static/js/431.a62490cf.chunk.js": "/static/js/431.a62490cf.chunk.js",
88
"static/js/702.1692c400.chunk.js": "/static/js/702.1692c400.chunk.js",
@@ -160,9 +160,9 @@
160160
"static/media/Garage Doors.svg": "/static/media/Garage Doors.0c2a1cfca7ad1ea59625.svg",
161161
"static/media/Outdoor Blinds.svg": "/static/media/Outdoor Blinds.37b85a9c060a4af48da9.svg",
162162
"static/media/Upstairs.svg": "/static/media/Upstairs.441813e54e0daca0882d.svg",
163-
"main.7cef0c28.js.map": "/static/js/main.7cef0c28.js.map",
163+
"main.f61d5390.js.map": "/static/js/main.f61d5390.js.map",
164164
"864.42bfc5f3.chunk.css.map": "/static/css/864.42bfc5f3.chunk.css.map",
165-
"864.d2336593.chunk.js.map": "/static/js/864.d2336593.chunk.js.map",
165+
"864.d62d2890.chunk.js.map": "/static/js/864.d62d2890.chunk.js.map",
166166
"805.7c367e53.chunk.js.map": "/static/js/805.7c367e53.chunk.js.map",
167167
"431.a62490cf.chunk.js.map": "/static/js/431.a62490cf.chunk.js.map",
168168
"702.1692c400.chunk.js.map": "/static/js/702.1692c400.chunk.js.map",
@@ -195,6 +195,6 @@
195195
"96.fe9915d5.chunk.js.map": "/static/js/96.fe9915d5.chunk.js.map"
196196
},
197197
"entrypoints": [
198-
"static/js/main.7cef0c28.js"
198+
"static/js/main.f61d5390.js"
199199
]
200200
}

admin/google-blockly/own/blocks_action.js

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ Blockly.Action.blocks['http_get'] =
124124
+ ' <field name="TEXT">http://</field>'
125125
+ ' </shadow>'
126126
+ ' </value>'
127+
+ ' <value name="TIMEOUT">'
128+
+ ' </value>'
129+
+ ' <value name="UNIT">'
130+
+ ' </value>'
127131
+ ' <value name="STATEMENT">'
128132
+ ' </value>'
129133
+ '</block>';
@@ -133,6 +137,14 @@ Blockly.Blocks['http_get'] = {
133137
this.appendValueInput('URL')
134138
.appendField(Blockly.Translate('http_get'));
135139

140+
this.appendDummyInput()
141+
.appendField(Blockly.Translate('http_get_timeout'))
142+
.appendField(new Blockly.FieldTextInput(2000), 'TIMEOUT')
143+
.appendField(new Blockly.FieldDropdown([
144+
[Blockly.Translate('http_get_settimeout_ms'), 'ms'],
145+
[Blockly.Translate('http_get_settimeout_sec'), 'sec']
146+
]), 'UNIT');
147+
136148
this.appendStatementInput('STATEMENT')
137149
.setCheck(null);
138150

@@ -149,8 +161,16 @@ Blockly.Blocks['http_get'] = {
149161
Blockly.JavaScript['http_get'] = function(block) {
150162
const URL = Blockly.JavaScript.valueToCode(block, 'URL', Blockly.JavaScript.ORDER_ATOMIC);
151163
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
164+
const unit = block.getFieldValue('UNIT');
165+
let timeout = block.getFieldValue('TIMEOUT');
166+
if (!timeout) {
167+
timeout = 2000;
168+
}
169+
if (unit === 'sec') {
170+
timeout *= 1000;
171+
}
152172

153-
return `httpGet(${URL}, { timeout: 2000 }, async (err, response) => {\n` +
173+
return `httpGet(${URL}, { timeout: ${timeout} }, async (err, response) => {\n` +
154174
Blockly.JavaScript.prefixLines(`if (err) {`, Blockly.JavaScript.INDENT) + '\n' +
155175
Blockly.JavaScript.prefixLines(`console.error(err);`, Blockly.JavaScript.INDENT + Blockly.JavaScript.INDENT) + '\n' +
156176
Blockly.JavaScript.prefixLines(`}`, Blockly.JavaScript.INDENT) + '\n' +
@@ -166,6 +186,10 @@ Blockly.Action.blocks['http_post'] =
166186
+ ' <field name="TEXT">http://</field>'
167187
+ ' </shadow>'
168188
+ ' </value>'
189+
+ ' <value name="TIMEOUT">'
190+
+ ' </value>'
191+
+ ' <value name="UNIT">'
192+
+ ' </value>'
169193
+ ' <value name="DATA">'
170194
+ ' <shadow type="object_new">'
171195
+ ' </shadow>'
@@ -179,6 +203,14 @@ Blockly.Blocks['http_post'] = {
179203
this.appendValueInput('URL')
180204
.appendField(Blockly.Translate('http_post'));
181205

206+
this.appendDummyInput()
207+
.appendField(Blockly.Translate('http_post_timeout'))
208+
.appendField(new Blockly.FieldTextInput(2000), 'TIMEOUT')
209+
.appendField(new Blockly.FieldDropdown([
210+
[Blockly.Translate('http_post_settimeout_ms'), 'ms'],
211+
[Blockly.Translate('http_post_settimeout_sec'), 'sec']
212+
]), 'UNIT');
213+
182214
this.appendValueInput('DATA')
183215
.appendField(Blockly.Translate('http_post_data'));
184216

@@ -199,12 +231,20 @@ Blockly.JavaScript['http_post'] = function(block) {
199231
const URL = Blockly.JavaScript.valueToCode(block, 'URL', Blockly.JavaScript.ORDER_ATOMIC);
200232
const data = Blockly.JavaScript.valueToCode(block, 'DATA', Blockly.JavaScript.ORDER_ATOMIC);
201233
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
234+
const unit = block.getFieldValue('UNIT');
235+
let timeout = block.getFieldValue('TIMEOUT');
236+
if (!timeout) {
237+
timeout = 2000;
238+
}
239+
if (unit === 'sec') {
240+
timeout *= 1000;
241+
}
202242

203243
if (!data) {
204244
data = '{}';
205245
}
206246

207-
return `httpPost(${URL}, ${data}, { timeout: 2000 }, async (err, response) => {\n` +
247+
return `httpPost(${URL}, ${data}, { timeout: ${timeout} }, async (err, response) => {\n` +
208248
Blockly.JavaScript.prefixLines(`if (err) {`, Blockly.JavaScript.INDENT) + '\n' +
209249
Blockly.JavaScript.prefixLines(`console.error(err);`, Blockly.JavaScript.INDENT + Blockly.JavaScript.INDENT) + '\n' +
210250
Blockly.JavaScript.prefixLines(`}`, Blockly.JavaScript.INDENT) + '\n' +

admin/google-blockly/own/blocks_system.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,8 @@ Blockly.Blocks['create_ex'] = {
685685
[Blockly.Translate('create_type_number'), 'number'],
686686
[Blockly.Translate('create_type_boolean'), 'boolean'],
687687
[Blockly.Translate('create_type_json'), 'json'],
688-
//[Blockly.Translate('create_type_object'), 'object'],
689-
//[Blockly.Translate('create_type_array'), 'array'],
688+
[Blockly.Translate('create_type_object'), 'object'],
689+
[Blockly.Translate('create_type_array'), 'array'],
690690
//[Blockly.Translate('create_type_file'), 'file'],
691691
]), 'TYPE');
692692

@@ -726,6 +726,8 @@ Blockly.JavaScript['create_ex'] = function(block) {
726726
if (value !== null && value !== '') {
727727
if (type === 'number') {
728728
paraV = `, parseFloat(${value})`;
729+
} else if (type === 'boolean') {
730+
paraV = `, !!${value}`;
729731
} else {
730732
paraV = ', ' + value;
731733
}

0 commit comments

Comments
 (0)