total5 0.0.6-1 → 0.0.6-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/builders.js CHANGED
@@ -1307,6 +1307,7 @@ ActionCaller.prototype.exec = function() {
1307
1307
  $.user = self.options.user;
1308
1308
 
1309
1309
  $.$callback = function(err, response) {
1310
+
1310
1311
  if (err) {
1311
1312
  // close
1312
1313
  self.cancel();
@@ -1335,11 +1336,8 @@ ActionCaller.prototype.exec = function() {
1335
1336
  if (action.permissions) {
1336
1337
  let permissions = action.permissions.slice(0);
1337
1338
  permissions.unshift($);
1338
- if (F.unauthorized.apply(global, permissions)) {
1339
- self.finish = null;
1340
- self.cancel();
1339
+ if (F.unauthorized.apply(global, permissions))
1341
1340
  return;
1342
- }
1343
1341
  }
1344
1342
 
1345
1343
  var params = self.options.params || EMPTYOBJECT;
package/changelog.txt CHANGED
@@ -9,6 +9,10 @@
9
9
  - extended `edit` mode:
10
10
  - added `restart` command
11
11
  - fixed partial validation
12
+ - fixed permissions error handling in actions
13
+ - added `Image` global variable
14
+ - added `Utils.filestreamer(filename, onbuffer(buffer, next), onend, [buffer_size])`
15
+ - fix image bug in the `Image.measureWEBP()` method by [Marek Mraz](https://github.com/Mrazbb)
12
16
 
13
17
  ========================
14
18
  0.0.5
package/global.js CHANGED
@@ -61,6 +61,7 @@ global.MAIL = F.mail;
61
61
  global.Mail = F.TMail.Mailer;
62
62
  global.RESTBuilder = F.TBuilders.RESTBuilder;
63
63
  global.ErrorBuilder = F.TBuilders.ErrorBuilder;
64
+ global.Image = F.TImages;
64
65
  global.DOWNLOAD = F.download;
65
66
  global.OPENCLIENT = (url, id) => require('./openclient').create(url, id);
66
67
  global.NEWMACRO = (str, nocompile, isasync) => require('./macros').compile(str, nocompile, isasync);
package/images.js CHANGED
@@ -102,7 +102,7 @@ exports.measureWEBP = function(buffer) {
102
102
  }
103
103
 
104
104
  if (header === 'VP8 ' && buffer[0] !== 0x2f)
105
- return { width: buffer.readInt16LE(8) & 0x3fff, height: buffer.readInt16LE(6) & 0x3fff };
105
+ return { width: buffer.readInt16LE(6) & 0x3fff, height: buffer.readInt16LE(8) & 0x3fff };
106
106
 
107
107
  var signature = buffer.toString('hex', 3, 6);
108
108
  if (header === 'VP8L' && signature !== '9d012a')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "total5",
3
- "version": "0.0.6-1",
3
+ "version": "0.0.6-3",
4
4
  "description": "Total.js framework v5",
5
5
  "main": "index.js",
6
6
  "directories": {
package/utils.js CHANGED
@@ -1556,6 +1556,34 @@ exports.streamer2 = function(beg, end, callback, skip, stream) {
1556
1556
  return exports.streamer(beg, end, callback, skip, stream, true);
1557
1557
  };
1558
1558
 
1559
+ exports.filestreamer = function(filename, onbuffer, onend, size) {
1560
+
1561
+ if (typeof(onend) === 'number') {
1562
+ size = onend;
1563
+ onend = null;
1564
+ }
1565
+
1566
+ var Fd = null;
1567
+
1568
+ var read = function(offset) {
1569
+ var buffer = Buffer.alloc(size || (1024 * 16));
1570
+ Total.Fs.read(Fd, buffer, 0, buffer.length, offset, function(err, bytes) {
1571
+ if (err || !bytes) {
1572
+ onend && onend(err);
1573
+ Total.Fs.close(Fd, NOOP);
1574
+ } else {
1575
+ onbuffer(buffer.length !== read ? buffer.slice(0, bytes) : buffer, next => read(offset + bytes));
1576
+ }
1577
+ });
1578
+ };
1579
+
1580
+ Total.Fs.open(filename, function(err, fd) {
1581
+ Fd = fd;
1582
+ read(0);
1583
+ });
1584
+
1585
+ };
1586
+
1559
1587
  exports.parseInt = function(obj, def) {
1560
1588
  if (obj == null || obj === '')
1561
1589
  return def === undefined ? 0 : def;