Skip to content

Commit 195426a

Browse files
committed
### 4.6.2 (2020-05-13)
* (bluefox) Corrected blockly blocks: request, exec
1 parent 5d84b6e commit 195426a

File tree

8 files changed

+59
-36
lines changed

8 files changed

+59
-36
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ And then call "npm run build".
3333
- ...
3434

3535
## Changelog
36+
### 4.6.2 (2020-05-13)
37+
* (bluefox) Corrected block: request, exec
38+
3639
### 4.6.1 (2020-05-11)
3740
* (bluefox) Updated blockly to 3.20200402.1
3841
* (bluefox) Added to blockly the switch/case block.

io-package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"common": {
33
"name": "javascript",
4-
"version": "4.6.1",
4+
"version": "4.6.2",
55
"title": "Script Engine",
66
"titleLang": {
77
"en": "Script Engine",
@@ -22,6 +22,18 @@
2222
"AlCalzone"
2323
],
2424
"news": {
25+
"4.6.2": {
26+
"en": "Corrected block: request, exec",
27+
"de": "Korrigierter Block: Anfrage, Exec",
28+
"ru": "Исправленный блок: запрос, exec",
29+
"pt": "Bloco corrigido: solicitação, exec",
30+
"nl": "Gecorrigeerd blok: verzoek, exec",
31+
"fr": "Bloc corrigé: demande, exécut",
32+
"it": "Blocco corretto: richiesta, esec",
33+
"es": "Bloque corregido: solicitud, ejecutivo",
34+
"pl": "Poprawiony blok: żądanie, wykon",
35+
"zh-cn": "更正的块:请求,执行"
36+
},
2537
"4.6.1": {
2638
"en": "Updated blockly to 3.20200402.1\nAdded to blockly the switch/case block\ncreateState and deleteState now also support 0_userdata.0 states",
2739
"de": "Blockweise auf 3.20200402.1 aktualisiert\nHinzugefügt, um den Schalter- / Gehäuseblock zu blockieren\ncreateState und deleteState unterstützen jetzt auch die Zustände 0_userdata.0",

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iobroker.javascript",
3-
"version": "4.6.1",
3+
"version": "4.6.2",
44
"description": "Javascript/Coffescript Script Engine for ioBroker",
55
"author": "bluefox <dogafox@gmail.com>",
66
"contributors": [
@@ -30,7 +30,7 @@
3030
},
3131
"dependencies": {
3232
"@iobroker/adapter-core": "^2.4.0",
33-
"@types/node": "^12.12.38",
33+
"@types/node": "^14.0.1",
3434
"@types/request": "^2.48.4",
3535
"coffee-compiler": "^0.3.2",
3636
"coffee-script": "^1.12.7",
@@ -39,7 +39,7 @@
3939
"request": "^2.88.2",
4040
"semver": "^7.3.2",
4141
"suncalc2": "^1.8.1",
42-
"typescript": "^3.8.3",
42+
"typescript": "^3.9.2",
4343
"virtual-tsc": "^0.5.0",
4444
"wake_on_lan": "^1.0.0"
4545
},
@@ -48,7 +48,7 @@
4848
"alcalzone-shared": "^2.2.0",
4949
"chai": "^4.2.0",
5050
"del": "^5.1.0",
51-
"eslint": "^7.0.0",
51+
"eslint": "^6.6.0",
5252
"gulp": "^4.0.2",
5353
"gulp-connect": "^5.7.0",
5454
"gulp-exec": "^4.0.0",

src/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"name": "js",
3-
"version": "4.6.0",
3+
"version": "4.6.1",
44
"private": true,
55
"dependencies": {
6-
"@material-ui/core": "^4.9.11",
7-
"@iobroker/adapter-react": "^0.3.8",
6+
"@material-ui/core": "^4.9.14",
7+
"@iobroker/adapter-react": "^0.4.4",
88
"@sentry/browser": "^5.15.5",
99
"@sentry/integrations": "^5.15.5",
1010
"classnames": "^2.2.6",
11-
"cronstrue": "^1.93.0",
12-
"eslint": "^6.8.0",
11+
"cronstrue": "^1.94.0",
12+
"eslint": "^6.6.0",
1313
"monaco-editor": "^0.20.0",
1414
"react": "^16.13.1",
1515
"react-beautiful-dnd": "^13.0.0",
1616
"react-bem-helper": "^1.4.1",
1717
"react-dom": "^16.13.1",
18-
"react-dropzone": "^10.2.2",
18+
"react-dropzone": "^11.0.1",
1919
"react-fullscreen": "^0.1.0",
20-
"react-i18next": "^11.3.5",
20+
"react-i18next": "^11.4.0",
2121
"react-icons": "^3.10.0",
2222
"react-monaco-editor": "^0.36.0",
2323
"react-scripts": "^3.4.1",
@@ -41,4 +41,4 @@
4141
"not op_mini all"
4242
],
4343
"devDependencies": {}
44-
}
44+
}

src/public/google-blockly/own/blocks_action.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Blockly.Blocks['exec'] = {
4141
this.appendDummyInput('WITH_STATEMENT')
4242
.appendField(Blockly.Translate('exec_statement'))
4343
.appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
44-
var delayInput = (option == true);
44+
var delayInput = option === true || option === 'true' || option === 'TRUE';
4545
this.sourceBlock_.updateShape_(delayInput);
4646
}), 'WITH_STATEMENT');
4747

@@ -69,7 +69,7 @@ Blockly.Blocks['exec'] = {
6969
return container;
7070
},
7171
domToMutation: function(xmlElement) {
72-
this.updateShape_(xmlElement.getAttribute('with_statement') == 'true');
72+
this.updateShape_(xmlElement.getAttribute('with_statement') === 'true');
7373
},
7474
updateShape_: function(withStatement) {
7575
// Add or remove a statement Input.
@@ -138,7 +138,7 @@ Blockly.Blocks['request'] = {
138138
this.appendDummyInput('WITH_STATEMENT')
139139
.appendField(Blockly.Translate('request_statement'))
140140
.appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
141-
var delayInput = (option == true);
141+
var delayInput = option === true || option === 'true' || option === 'TRUE';
142142
this.sourceBlock_.updateShape_(delayInput);
143143
}), 'WITH_STATEMENT');
144144

src/public/index.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@
1010
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
1111
-->
1212
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
13-
<script type="text/javascript" src="vendor/socket.io.js"></script>
13+
<script>
14+
var script = document.createElement('script');
15+
window.registerSocketOnLoad = function (cb) {
16+
window.socketLoadedHandler = cb;
17+
};
18+
script.onload = function () {
19+
typeof window.socketLoadedHandler === 'function' && window.socketLoadedHandler();
20+
};
21+
script.src = window.location.port === '3000' ? window.location.protocol + '//' + window.location.hostname + ':8081/lib/js/socket.io.js' : '%PUBLIC_URL%/../../lib/js/socket.io.js';
22+
23+
document.head.appendChild(script);
24+
</script>
1425
<!--
1526
Notice the use of %PUBLIC_URL% in the tags above.
1627
It will be replaced with the URL of the `public` folder during the build.

src/public/vendor/socket.io.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/src/App.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ class App extends Component {
171171
onReady: (objects, scripts) => {
172172
I18n.setLanguage(this.socket.systemLang);
173173
window.systemLang = this.socket.systemLang;
174+
this.subscribeOnAlive();
174175
this.onObjectChange(objects, scripts, true);
175176
},
176177
onObjectChange: (objects, scripts) => this.onObjectChange(objects, scripts),
@@ -186,18 +187,23 @@ class App extends Component {
186187
//this.setState({logMessage: {index: this.logIndex, message}})
187188
}
188189
});
190+
}
189191

190-
this.socket.subscribeState('system.adapter.javascript.*.alive', (id, state) => {
191-
if (id) {
192-
id = id && id.substring(0, id.length - 6); // - .alive
193-
194-
if (this.state.runningInstances[id] !== (state ? state.val : false)) {
195-
const runningInstances = JSON.parse(JSON.stringify(this.state.runningInstances));
196-
runningInstances[id] = (state ? state.val : false);
197-
this.setState({runningInstances});
192+
subscribeOnAlive() {
193+
if (!this.subscribeDone && this.socket) {
194+
this.subscribeDone = true;
195+
this.socket.subscribeState('system.adapter.javascript.*.alive', (id, state) => {
196+
if (id) {
197+
id = id && id.substring(0, id.length - 6); // - .alive
198+
199+
if (this.state.runningInstances[id] !== (state ? state.val : false)) {
200+
const runningInstances = JSON.parse(JSON.stringify(this.state.runningInstances));
201+
runningInstances[id] = (state ? state.val : false);
202+
this.setState({runningInstances});
203+
}
198204
}
199-
}
200-
});
205+
});
206+
}
201207
}
202208

203209
onObjectChange(objects, scripts, isReady) {

0 commit comments

Comments
 (0)