Skip to content

Commit ff3ec3d

Browse files
authored
Merge pull request #698 from totaljs/v3.2.0
v3.2.0
2 parents 769cf85 + 4ef3d4f commit ff3ec3d

11 files changed

+712
-163
lines changed

builders.js

+130-51
Large diffs are not rendered by default.

changes.txt

+37
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
======= 3.2.0
2+
3+
- added: `WORKER()` alias to `F.worker()`
4+
- added: `WORKER2()` alias to `F.worker2()`
5+
- added: `F.cluster.https()`
6+
- added: `TaskBuilder.done2([send_value])` returns `function` with wrapped `.done()`
7+
- added: `TaskBuilder.success2([send_value])` returns `function` with wrapped `.success()`
8+
- added: `TaskBuilder.next2(name)` returns `function` with wrapped `.next()`
9+
- added: new `RESTBuilder` aliases `.DELETE()`, `.PUT()`, `.POST()`, `.PATCH() and `.GET()`
10+
- added: `schema.before(key, (value, model, index) => value)` is a simple and new alternative to `schema.setPrepare()`
11+
- added: `SchemaInstance.$parent` returns a parent schema (if the schema is nested schema)
12+
- added: `SchemaOptions.redirect(url)` can perform a redirect from the schema
13+
- added: `OperationOptions.redirect(url)` can perform a redirect from the operation
14+
- added: `.ics` extension as acceptable file for the web server
15+
16+
- updated: `F.worker2()` returns entire `stdout` buffer in the `callback(err, buffer)`
17+
- updated: `$options()` by adding `disabled` key
18+
- updated: `String.ROOT()` by adding a support for jComponent `AJAX()` calls
19+
- updated: `RESTBuilder.method(method, [data])` added `data` argument
20+
- updated: `String.parseDate([format])` added `format` argument
21+
- updated: SMTP settings contain `heloid` as `heloidentifier` (manually can be defined `HELO` or `EHLO` command)
22+
- updated: SMTP hostname is computed from email if SMTP is not specified
23+
24+
- fixed: critical bug with security + improved security
25+
- fixed: system routing
26+
- fixed: NoSQL sorting, solved a strange problem
27+
- fixed: `U.request()` with `GET` method by @khaledkhalil94 (it doesn't send JSON data if `data` is null/undefined)
28+
- fixed: `F.wait()` in WebSocket
29+
- fixed: `String.capitalize(true)`
30+
- fixed: `REQUEST()` uploading of additional multipart/form-data (removed encoding)
31+
- fixed: view engine conditions defined in `<script>`
32+
- fixed: auto-redirects in `U.download()`
33+
- fixed: image streams resizing
34+
- fixed: `@{'%config_key'}` a problem with rendering a value with `'`
35+
36+
- removed: `X-Powered-By: Total.js`
37+
138
======= 3.1.0
239

340
- added: CSS variables support default values `border-radius: $radius || 10px`

cluster.js

+19-5
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ exports.http = function(count, mode, options, callback) {
158158
fork();
159159
};
160160

161+
exports.https = function(count, mode, options, callback) {
162+
// Fork will obtain options automatically via event
163+
if (Cluster.isMaster) {
164+
CLUSTER_REQ.id = 'master';
165+
CLUSTER_RES.id = 'master';
166+
CLUSTER_EMIT.id = 'master';
167+
master(count, mode, options, callback, true);
168+
} else
169+
fork();
170+
};
171+
161172
exports.restart = function(index) {
162173
if (index === undefined) {
163174
for (var i = 0; i < THREADS; i++)
@@ -173,7 +184,7 @@ exports.restart = function(index) {
173184
}
174185
};
175186

176-
function master(count, mode, options, callback) {
187+
function master(count, mode, options, callback, https) {
177188

178189
if (count == null || count === 'auto')
179190
count = require('os').cpus().length;
@@ -222,7 +233,7 @@ function master(count, mode, options, callback) {
222233
};
223234

224235
count.async(function(i, next) {
225-
exec(Math.abs(i - THREADS));
236+
exec(Math.abs(i - THREADS), https);
226237
can(next);
227238
}, function() {
228239
callback && callback(FORKS);
@@ -258,7 +269,7 @@ function mastersend(m) {
258269
FORKS[i] && FORKS[i].send(m);
259270
}
260271

261-
function exec(index) {
272+
function exec(index, https) {
262273
var fork = Cluster.fork();
263274
fork.$id = index.toString();
264275
fork.on('message', message);
@@ -272,7 +283,7 @@ function exec(index) {
272283
(function(fork) {
273284
setTimeout(function() {
274285
OPTIONS.options.id = fork.$id;
275-
fork.send({ TYPE: 'init', bundling: !CONTINUE, id: fork.$id, mode: OPTIONS.mode, options: OPTIONS.options, threads: OPTIONS.count, index: index });
286+
fork.send({ TYPE: 'init', bundling: !CONTINUE, id: fork.$id, mode: OPTIONS.mode, options: OPTIONS.options, threads: OPTIONS.count, index: index, https: https });
276287
}, fork.$id * 500);
277288
})(fork);
278289
}
@@ -290,7 +301,10 @@ function on_init(msg) {
290301
CLUSTER_RES.id = msg.id;
291302
THREADS = msg.threads;
292303
msg.options.bundling = msg.bundling;
293-
F.http(msg.mode, msg.options);
304+
if (msg.https)
305+
F.https(msg.mode, msg.options);
306+
else
307+
F.http(msg.mode, msg.options);
294308
F.isCluster = true;
295309
F.removeListener(msg.TYPE, on_init);
296310
break;

image.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const Fs = require('fs');
3434
const REGEXP_SVG = /(width="\d+")+|(height="\d+")+/g;
3535
const REGEXP_PATH = /\//g;
3636
const REGEXP_ESCAPE = /'/g;
37+
const SPAWN_OPT = { shell: true };
3738
const D = require('os').platform().substring(0, 3).toLowerCase() === 'win' ? '"' : '\'';
3839

3940
var CACHE = {};
@@ -280,8 +281,7 @@ Image.prototype.pipe = function(stream, type, options) {
280281
!self.builder.length && self.minify();
281282
!type && (type = self.outputType);
282283

283-
var cmd = spawn(self.isIM ? 'convert' : 'gm', self.arg(self.filename ? wrap(self.filename) : '-', (type ? type + ':' : '') + '-'));
284-
284+
var cmd = spawn(self.isIM ? 'convert' : 'gm', self.arg(self.filename ? wrap(self.filename) : '-', (type ? type + ':' : '') + '-'), SPAWN_OPT);
285285
cmd.stderr.on('data', stream.emit.bind(stream, 'error'));
286286
cmd.stdout.on('data', stream.emit.bind(stream, 'data'));
287287
cmd.stdout.on('end', stream.emit.bind(stream, 'end'));
@@ -318,8 +318,7 @@ Image.prototype.stream = function(type, writer) {
318318
if (!type)
319319
type = self.outputType;
320320

321-
var cmd = spawn(self.isIM ? 'convert' : 'gm', self.arg(self.filename ? wrap(self.filename) : '-', (type ? type + ':' : '') + '-'));
322-
321+
var cmd = spawn(self.isIM ? 'convert' : 'gm', self.arg(self.filename ? wrap(self.filename) : '-', (type ? type + ':' : '') + '-'), SPAWN_OPT);
323322
if (self.currentStream) {
324323
if (self.currentStream instanceof Buffer)
325324
cmd.stdin.end(self.currentStream);

0 commit comments

Comments
 (0)