Skip to content

Commit b8beec2

Browse files
committed
### 4.6.12 (2020-05-19)
* (bluefox) Fixed blockly blocks because of deprecated functions * (bluefox) Corrected schedule wizard
1 parent 9bc896a commit b8beec2

File tree

9 files changed

+47
-46
lines changed

9 files changed

+47
-46
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
Executes Javascript, Typescript and Coffescript Scripts.
1111

12+
**Coffescript is deprecated**
13+
1214
[Function documentation](docs/en/javascript.md)
1315

1416
[Benutzung](docs/de/usage.md)
@@ -33,7 +35,7 @@ And then call "npm run build".
3335
- ...
3436

3537
## Changelog
36-
### 4.6.11 (2020-05-16)
38+
### 4.6.12 (2020-05-19)
3739
* (bluefox) Fixed blockly blocks because of deprecated functions
3840
* (bluefox) Corrected schedule wizard
3941

admin/google-blockly/own/blocks_timeout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Blockly.Blocks['timeouts_settimeout'] = {
131131
},
132132
getVarModels: function () {
133133
var name = this.getFieldValue('NAME');
134-
return [{getId: function () {return name;}, type: 'timeout', name: name}];
134+
return [{getId: function () {return name;}, name: name, type: 'timeout'}];
135135
}
136136
};
137137

@@ -251,7 +251,7 @@ Blockly.Blocks['timeouts_setinterval'] = {
251251
},
252252
getVarModels: function () {
253253
var name = this.getFieldValue('NAME');
254-
return [{getId: function () {return name;}, type: 'interval', name: name}];
254+
return [{getId: function () {return name;}, name: name, type: 'interval'}];
255255
}
256256
};
257257

admin/google-blockly/own/blocks_trigger.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ Blockly.Blocks['schedule_create'] = {
649649
},
650650
getVarModels: function () {
651651
var name = this.getFieldValue('NAME');
652-
return [{getId: function () {return name}, name: name}];
652+
return [{getId: function () {return name;}, name: name, type: 'cron'}];
653653
}
654654
};
655655

@@ -672,7 +672,17 @@ Blockly.Trigger.getAllSchedules = function (workspace) {
672672
result.push([blocks[i].getFieldValue('NAME'), blocks[i].getFieldValue('NAME')]);
673673
}
674674
}
675-
if (!result.length) result.push(['', '']);
675+
676+
// BF(2020.05.16) : for back compatibility. Remove it after 5 years
677+
if (window.scripts.loading) {
678+
var variables = workspace.getVariablesOfType('');
679+
variables.forEach(v => !result.find(it => it[0] === v.name) && result.push([v.name, v.name]));
680+
}
681+
682+
var variables1 = workspace.getVariablesOfType('cron');
683+
variables1.forEach(v => !result.find(it => it[0] === v.name) && result.push([v.name, v.name]));
684+
685+
!result.length && result.push(['', '']);
676686

677687
return result;
678688
};

io-package.json

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"common": {
33
"name": "javascript",
4-
"version": "4.6.11",
4+
"version": "4.6.12",
55
"title": "Script Engine",
66
"titleLang": {
77
"en": "Script Engine",
@@ -22,7 +22,7 @@
2222
"AlCalzone"
2323
],
2424
"news": {
25-
"4.6.11": {
25+
"4.6.12": {
2626
"en": "Fixed blockly blocks because of deprecated functions",
2727
"de": "Blockierte Blöcke wegen veralteter Funktionen behoben",
2828
"ru": "Исправлены блочные блоки из-за устаревших функций",
@@ -130,29 +130,6 @@
130130
"pl": "Dostosowano adapter do kontrolera js> = 2.2.x",
131131
"zh-cn": "使适配器与js-controller> = 2.2.x兼容"
132132
},
133-
"4.3.5": {
134-
"en": "fixed the load of zip files if more than one host",
135-
"de": "Das Laden von ZIP-Dateien wurde behoben, wenn mehr als ein Host vorhanden war",
136-
"ru": "исправлена загрузка zip-файлов, если несколько хостов",
137-
"pt": "Corrigido o carregamento de arquivos zip se mais de um host",
138-
"nl": "de belasting van zip-bestanden gerepareerd als meer dan één host",
139-
"fr": "correction de la charge des fichiers zip si plusieurs hôtes",
140-
"it": "corretto il caricamento dei file zip se più di un host",
141-
"es": "reparó la carga de archivos zip si hay más de un host",
142-
"pl": "naprawiono ładowanie plików zip, jeśli więcej niż jeden host",
143-
"zh-cn": "如果一台以上的主机修复了zip文件的加载"
144-
},
145-
"3.7.0": {
146-
"en": "Used VM2 as sandbox. The script errors will be caught.\nrefactoring: split into many modules",
147-
"de": "Verwendete VM2 als Sandbox. Die Skriptfehler werden abgefangen.\nRefactoring: Aufteilung in viele Module",
148-
"ru": "Используется VM2 как песочница. Ошибки скрипта будут обнаружены.\nрефакторинг: разделение на многие модули",
149-
"pt": "Usado VM2 como sandbox. Os erros de script serão capturados.\nrefatoração: dividida em vários módulos",
150-
"nl": "Gebruikte VM2 als sandbox. De scriptfouten worden gepakt.\nrefactoring: opgesplitst in vele modules",
151-
"fr": "VM2 utilisé comme bac à sable. Les erreurs de script seront interceptées.\nrefactoring: divisé en plusieurs modules",
152-
"it": "Usato VM2 come sandbox. Gli errori di script verranno catturati.\nrefactoring: suddiviso in molti moduli",
153-
"es": "Usó VM2 como sandbox. Los errores de script serán capturados.\nrefactorización: dividida en muchos módulos",
154-
"pl": "Używany VM2 jako sandbox. Błędy skryptu zostaną przechwycone.\nrefaktoryzacja: podzielona na wiele modułów"
155-
}
156133
},
157134
"desc": {
158135
"en": "Javascript/Blockly Script Engine for ioBroker",

lib/sandbox.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,12 @@ function sandBox(script, name, verbose, debug, context) {
23082308
language = 'de';
23092309
}
23102310
}
2311-
if(typeof date == 'number') date = new Date(date);
2311+
if (typeof date == 'number') {
2312+
date = new Date(date);
2313+
} else if (!(date instanceof Date)) {
2314+
sandbox.log('Invalid date object provided: ' + JSON.stringify(date), 'error');
2315+
return 'Invalid date';
2316+
}
23122317
const d = date.getDay();
23132318
text = text.replace('НН', consts.dayOfWeeksFull[language][d]);
23142319
let initialText = text;
@@ -2419,16 +2424,13 @@ function sandBox(script, name, verbose, debug, context) {
24192424
}
24202425

24212426
if (typeof callback !== 'function') {
2422-
adapter.log.error('No callback found!');
2423-
return;
2427+
return adapter.log.error('No callback found!');
24242428
}
24252429
if (!isObject(options)) {
2426-
adapter.log.error('No options found!');
2427-
return;
2430+
return adapter.log.error('No options found!');
24282431
}
24292432
if (!options.id) {
2430-
adapter.log.error('No ID found!');
2431-
return;
2433+
return adapter.log.error('No ID found!');
24322434
}
24332435
const timeoutMs = parseInt(options.timeout, 10) || 20000;
24342436

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iobroker.javascript",
3-
"version": "4.6.11",
3+
"version": "4.6.12",
44
"description": "Javascript/Coffescript Script Engine for ioBroker",
55
"author": "bluefox <dogafox@gmail.com>",
66
"contributors": [

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Blockly.Blocks['timeouts_settimeout'] = {
131131
},
132132
getVarModels: function () {
133133
var name = this.getFieldValue('NAME');
134-
return [{getId: function () {return name;}, type: 'timeout', name: name}];
134+
return [{getId: function () {return name;}, name: name, type: 'timeout'}];
135135
}
136136
};
137137

@@ -251,7 +251,7 @@ Blockly.Blocks['timeouts_setinterval'] = {
251251
},
252252
getVarModels: function () {
253253
var name = this.getFieldValue('NAME');
254-
return [{getId: function () {return name;}, type: 'interval', name: name}];
254+
return [{getId: function () {return name;}, name: name, type: 'interval'}];
255255
}
256256
};
257257

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ Blockly.Blocks['schedule_create'] = {
649649
},
650650
getVarModels: function () {
651651
var name = this.getFieldValue('NAME');
652-
return [{getId: function () {return name}, name: name}];
652+
return [{getId: function () {return name;}, name: name, type: 'cron'}];
653653
}
654654
};
655655

@@ -672,7 +672,17 @@ Blockly.Trigger.getAllSchedules = function (workspace) {
672672
result.push([blocks[i].getFieldValue('NAME'), blocks[i].getFieldValue('NAME')]);
673673
}
674674
}
675-
if (!result.length) result.push(['', '']);
675+
676+
// BF(2020.05.16): for back compatibility. Remove it after 5 years
677+
if (window.scripts.loading) {
678+
var variables = workspace.getVariablesOfType('');
679+
variables.forEach(v => !result.find(it => it[0] === v.name) && result.push([v.name, v.name]));
680+
}
681+
682+
var variables1 = workspace.getVariablesOfType('cron');
683+
variables1.forEach(v => !result.find(it => it[0] === v.name) && result.push([v.name, v.name]));
684+
685+
!result.length && result.push(['', '']);
676686

677687
return result;
678688
};

0 commit comments

Comments
 (0)