total5 0.0.13 → 0.0.14-1
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/changelog.txt +13 -0
- package/controller.js +65 -10
- package/debug.js +1 -1
- package/flow-flowstream.js +3 -3
- package/index.js +17 -13
- package/package.json +1 -1
package/changelog.txt
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
========================
|
|
2
|
+
0.0.14
|
|
3
|
+
========================
|
|
4
|
+
|
|
5
|
+
- fixed loading plugin files (only `.js` files will load)
|
|
6
|
+
- removed loading of `.DS_STORE` files in plugins
|
|
7
|
+
- added watcher for `extensions/*.html` files
|
|
8
|
+
- __breaking change__: the audit logs object has been changed:
|
|
9
|
+
- `username` renamed to `createdby`
|
|
10
|
+
- `schema` renamed to `action`
|
|
11
|
+
- disabled auto-cleaning files in FlowStream workers
|
|
12
|
+
- improved loading static files in release mode
|
|
13
|
+
|
|
1
14
|
========================
|
|
2
15
|
0.0.13
|
|
3
16
|
========================
|
package/controller.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Total.js Controller
|
|
2
2
|
// The MIT License
|
|
3
|
-
// Copyright 2023 (c) Peter Širka <petersirka@gmail.com>
|
|
3
|
+
// Copyright 2023-2025 (c) Peter Širka <petersirka@gmail.com>
|
|
4
4
|
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
@@ -891,11 +891,12 @@ Controller.prototype.autoclear = function(value) {
|
|
|
891
891
|
|
|
892
892
|
Controller.prototype.resume = function() {
|
|
893
893
|
|
|
894
|
-
|
|
894
|
+
let ctrl = this;
|
|
895
895
|
|
|
896
896
|
if (ctrl.isfile) {
|
|
897
897
|
|
|
898
|
-
|
|
898
|
+
let path = ctrl.uri.key;
|
|
899
|
+
|
|
899
900
|
if (CONF.$root)
|
|
900
901
|
path = path.substring(CONF.$root.length - 1);
|
|
901
902
|
|
|
@@ -1379,12 +1380,24 @@ function send_html(ctrl, path) {
|
|
|
1379
1380
|
return;
|
|
1380
1381
|
}
|
|
1381
1382
|
|
|
1383
|
+
if (!DEBUG) {
|
|
1384
|
+
if (F.temporary.files[ctrl.uri.cache]) {
|
|
1385
|
+
F.temporary.files[ctrl.uri.cache].push(ctrl);
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1388
|
+
F.temporary.files[ctrl.uri.cache] = [];
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1382
1391
|
readfile(path, function(err, output) {
|
|
1383
1392
|
|
|
1384
1393
|
if (err) {
|
|
1385
1394
|
|
|
1386
|
-
if (!DEBUG)
|
|
1395
|
+
if (!DEBUG) {
|
|
1387
1396
|
F.temporary.notfound[ctrl.uri.cache] = 1;
|
|
1397
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1398
|
+
$.fallback(404);
|
|
1399
|
+
delete F.temporary.files[ctrl.uri.cache];
|
|
1400
|
+
}
|
|
1388
1401
|
|
|
1389
1402
|
ctrl.fallback(404);
|
|
1390
1403
|
return;
|
|
@@ -1405,12 +1418,18 @@ function send_html(ctrl, path) {
|
|
|
1405
1418
|
let filename = F.path.tmp(F.clusterid + ctrl.uri.cache.substring(1).replace(REG_FILETMP, '-') + '-min.html');
|
|
1406
1419
|
F.Fs.writeFile(filename, output.body, function(err) {
|
|
1407
1420
|
if (err) {
|
|
1421
|
+
err = err.toString();
|
|
1408
1422
|
F.temporary.notfound[ctrl.uri.cache] = 1;
|
|
1409
|
-
ctrl.fallback(404, err
|
|
1423
|
+
ctrl.fallback(404, err);
|
|
1424
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1425
|
+
$.fallback(404, err);
|
|
1410
1426
|
} else {
|
|
1411
1427
|
F.temporary.minified[ctrl.uri.cache] = filename;
|
|
1412
1428
|
send_file(ctrl, filename, 'html');
|
|
1429
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1430
|
+
send_file($, filename, 'html');
|
|
1413
1431
|
}
|
|
1432
|
+
delete F.temporary.files[ctrl.uri.cache];
|
|
1414
1433
|
});
|
|
1415
1434
|
}
|
|
1416
1435
|
});
|
|
@@ -1429,12 +1448,24 @@ function send_css(ctrl, path) {
|
|
|
1429
1448
|
return;
|
|
1430
1449
|
}
|
|
1431
1450
|
|
|
1451
|
+
if (!DEBUG) {
|
|
1452
|
+
if (F.temporary.files[ctrl.uri.cache]) {
|
|
1453
|
+
F.temporary.files[ctrl.uri.cache].push(ctrl);
|
|
1454
|
+
return;
|
|
1455
|
+
} else
|
|
1456
|
+
F.temporary.files[ctrl.uri.cache] = [];
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1432
1459
|
readfile(path, function(err, output) {
|
|
1433
1460
|
|
|
1434
1461
|
if (err) {
|
|
1435
1462
|
|
|
1436
|
-
if (!DEBUG)
|
|
1463
|
+
if (!DEBUG) {
|
|
1464
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1465
|
+
$.fallback(404);
|
|
1466
|
+
delete F.temporary.files[ctrl.uri.cache];
|
|
1437
1467
|
F.temporary.notfound[ctrl.uri.cache] = 1;
|
|
1468
|
+
}
|
|
1438
1469
|
|
|
1439
1470
|
ctrl.fallback(404);
|
|
1440
1471
|
return;
|
|
@@ -1454,11 +1485,17 @@ function send_css(ctrl, path) {
|
|
|
1454
1485
|
F.Fs.writeFile(filename, output.body, function(err) {
|
|
1455
1486
|
if (err) {
|
|
1456
1487
|
F.temporary.notfound[ctrl.uri.cache] = 1;
|
|
1457
|
-
|
|
1488
|
+
err = err.toString();
|
|
1489
|
+
ctrl.fallback(404, err);
|
|
1490
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1491
|
+
$.fallback(404, err);
|
|
1458
1492
|
} else {
|
|
1459
1493
|
F.temporary.minified[ctrl.uri.cache] = filename;
|
|
1460
1494
|
send_file(ctrl, filename, 'css');
|
|
1495
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1496
|
+
send_file($, filename, 'css');
|
|
1461
1497
|
}
|
|
1498
|
+
delete F.temporary.files[ctrl.uri.cache];
|
|
1462
1499
|
});
|
|
1463
1500
|
}
|
|
1464
1501
|
});
|
|
@@ -1477,12 +1514,24 @@ function send_js(ctrl, path) {
|
|
|
1477
1514
|
return;
|
|
1478
1515
|
}
|
|
1479
1516
|
|
|
1517
|
+
if (!DEBUG) {
|
|
1518
|
+
if (F.temporary.files[ctrl.uri.cache]) {
|
|
1519
|
+
F.temporary.files[ctrl.uri.cache].push(ctrl);
|
|
1520
|
+
return;
|
|
1521
|
+
} else
|
|
1522
|
+
F.temporary.files[ctrl.uri.cache] = [];
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1480
1525
|
readfile(path, function(err, output) {
|
|
1481
1526
|
|
|
1482
1527
|
if (err) {
|
|
1483
1528
|
|
|
1484
|
-
if (!DEBUG)
|
|
1529
|
+
if (!DEBUG) {
|
|
1530
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1531
|
+
$.fallback(404);
|
|
1532
|
+
delete F.temporary.files[ctrl.uri.cache];
|
|
1485
1533
|
F.temporary.notfound[ctrl.uri.cache] = 1;
|
|
1534
|
+
}
|
|
1486
1535
|
|
|
1487
1536
|
ctrl.fallback(404);
|
|
1488
1537
|
return;
|
|
@@ -1502,11 +1551,17 @@ function send_js(ctrl, path) {
|
|
|
1502
1551
|
F.Fs.writeFile(filename, output.body, function(err) {
|
|
1503
1552
|
if (err) {
|
|
1504
1553
|
F.temporary.notfound[ctrl.uri.cache] = 1;
|
|
1505
|
-
|
|
1554
|
+
err = err.toString();
|
|
1555
|
+
ctrl.fallback(404, err);
|
|
1556
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1557
|
+
$.fallback(404, err);
|
|
1506
1558
|
} else {
|
|
1507
1559
|
F.temporary.minified[ctrl.uri.cache] = filename;
|
|
1508
1560
|
send_file(ctrl, filename, 'js');
|
|
1561
|
+
for (let $ of F.temporary.files[ctrl.uri.cache])
|
|
1562
|
+
send_file($, filename, 'js');
|
|
1509
1563
|
}
|
|
1564
|
+
delete F.temporary.files[ctrl.uri.cache];
|
|
1510
1565
|
});
|
|
1511
1566
|
}
|
|
1512
1567
|
});
|
|
@@ -1520,7 +1575,7 @@ function send_file(ctrl, path, ext) {
|
|
|
1520
1575
|
return;
|
|
1521
1576
|
}
|
|
1522
1577
|
|
|
1523
|
-
|
|
1578
|
+
let cache = F.temporary.tmp[ctrl.uri.cache];
|
|
1524
1579
|
|
|
1525
1580
|
// HTTP Cache
|
|
1526
1581
|
if (ctrl.response.cache && cache && ctrl.notmodified(cache.date))
|
package/debug.js
CHANGED
|
@@ -74,7 +74,7 @@ function runwatching() {
|
|
|
74
74
|
const REG_FILES = /(config|bundles\.debug|\.js|\.ts|\.flow|\.py|\.resource)+$/i;
|
|
75
75
|
const REG_PUBLIC = /\/public\//i;
|
|
76
76
|
const REG_INDEX = new RegExp(FILENAME.replace(/\.js$/, '') + '_.*?\\.js$');
|
|
77
|
-
const REG_EXTENSION = /\.(js|ts|py|resource|package|bundle|build|flow|url)$/i;
|
|
77
|
+
const REG_EXTENSION = /\.(js|ts|py|resource|package|bundle|build|flow|url|html)$/i;
|
|
78
78
|
const REG_RELOAD = /\.(js|ts|py|css|html|htm|jpg|png|gif|ico|svg|webp|resource)$/i;
|
|
79
79
|
const isRELOAD = !!options.livereload;
|
|
80
80
|
const SPEED = isRELOAD ? 1000 : 1500;
|
package/flow-flowstream.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Total.js FlowStream module
|
|
2
2
|
// The MIT License
|
|
3
|
-
// Copyright 2021-
|
|
3
|
+
// Copyright 2021-2025 (c) Peter Širka <petersirka@gmail.com>
|
|
4
4
|
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
@@ -1004,11 +1004,11 @@ function init_current(meta, callback, nested) {
|
|
|
1004
1004
|
if (meta.unixsocket && meta.proxypath) {
|
|
1005
1005
|
if (!F.isWindows)
|
|
1006
1006
|
F.Fs.unlink(meta.unixsocket, NOOP);
|
|
1007
|
-
F.http({ load: 'none', unixsocket: meta.unixsocket, config: { $stats: false, $sourcemap: false }});
|
|
1007
|
+
F.http({ load: 'none', unixsocket: meta.unixsocket, clear: false, config: { $stats: false, $sourcemap: false }});
|
|
1008
1008
|
} else {
|
|
1009
1009
|
F.config.$sourcemap = false;
|
|
1010
1010
|
F.config.$stats = false;
|
|
1011
|
-
F.load('none');
|
|
1011
|
+
F.load('none', null, false);
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
1014
|
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Total.js framework
|
|
2
2
|
// The MIT License
|
|
3
|
-
// Copyright 2012-
|
|
3
|
+
// Copyright 2012-2025 (c) Peter Širka <petersirka@gmail.com>
|
|
4
4
|
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
@@ -36,7 +36,7 @@ global.DEF = {};
|
|
|
36
36
|
|
|
37
37
|
F.id = '';
|
|
38
38
|
F.clusterid = '';
|
|
39
|
-
F.is5 = F.version =
|
|
39
|
+
F.is5 = F.version = 5014;
|
|
40
40
|
F.isBundle = false;
|
|
41
41
|
F.isLoaded = false;
|
|
42
42
|
F.version_header = '5';
|
|
@@ -106,6 +106,7 @@ global.DEF = {};
|
|
|
106
106
|
versions: {},
|
|
107
107
|
dependencies: {}, // temporary for module dependencies
|
|
108
108
|
other: {},
|
|
109
|
+
files: {},
|
|
109
110
|
cryptokeys: {}, // for crypto keys
|
|
110
111
|
internal: {}, // controllers/modules names for the routing
|
|
111
112
|
ready: {},
|
|
@@ -743,7 +744,7 @@ F.auth = function(fn) {
|
|
|
743
744
|
F.def.onAuthorize = fn;
|
|
744
745
|
};
|
|
745
746
|
|
|
746
|
-
F.load = async function(types, callback) {
|
|
747
|
+
F.load = async function(types, callback, clear = true) {
|
|
747
748
|
|
|
748
749
|
if (!types)
|
|
749
750
|
types = '';
|
|
@@ -753,14 +754,16 @@ F.load = async function(types, callback) {
|
|
|
753
754
|
F.dir();
|
|
754
755
|
|
|
755
756
|
await F.TBundles.extract();
|
|
756
|
-
|
|
757
|
+
|
|
758
|
+
if (clear)
|
|
759
|
+
await F.clear(true);
|
|
757
760
|
|
|
758
761
|
process.send && process.send('total:ready');
|
|
759
762
|
|
|
760
763
|
if (typeof(types) === 'string')
|
|
761
764
|
types = types.split(',').trim();
|
|
762
765
|
|
|
763
|
-
var list = async (path, extension = 'js') => new Promise(resolve => F.TUtils.ls(path, files => resolve(files), (path, isdir) => isdir ? true : (path.
|
|
766
|
+
var list = async (path, extension = 'js') => new Promise(resolve => F.TUtils.ls(path, files => resolve(files), (path, isdir) => isdir ? true : (!path.includes('-bk') && !path.includes('_bk') && F.TUtils.getExtension(path) === extension)));
|
|
764
767
|
var read = async (path) => new Promise(resolve => F.Fs.readFile(path, 'utf8', (err, response) => resolve(response ? response : '')));
|
|
765
768
|
|
|
766
769
|
var update = function(type, arr) {
|
|
@@ -827,7 +830,7 @@ F.load = async function(types, callback) {
|
|
|
827
830
|
|
|
828
831
|
for (let plugin of tmp) {
|
|
829
832
|
|
|
830
|
-
if (plugin.
|
|
833
|
+
if (plugin.includes('-bk') || plugin.includes('_bk') || plugin.toLowerCase().includes('ds_store'))
|
|
831
834
|
continue;
|
|
832
835
|
|
|
833
836
|
files.push({ id: F.TUtils.getName(plugin).replace(/\.js$/, ''), type: 'plugins', filename: F.path.directory('plugins', plugin + '/index.js') });
|
|
@@ -900,9 +903,10 @@ F.load = async function(types, callback) {
|
|
|
900
903
|
F.stats.compilation = Date.now() - beg;
|
|
901
904
|
F.stats.compiled = files.length;
|
|
902
905
|
F.isLoaded = true;
|
|
906
|
+
|
|
903
907
|
DEBUG && F.TSourceMap.refresh();
|
|
904
|
-
callback && callback();
|
|
905
908
|
|
|
909
|
+
callback && callback();
|
|
906
910
|
F.emit('ready');
|
|
907
911
|
F.emit('load');
|
|
908
912
|
};
|
|
@@ -1167,6 +1171,7 @@ F.loadservices = function() {
|
|
|
1167
1171
|
F.internal.interval = setInterval(function() {
|
|
1168
1172
|
|
|
1169
1173
|
F.internal.ticks++;
|
|
1174
|
+
|
|
1170
1175
|
global.NOW = new Date();
|
|
1171
1176
|
|
|
1172
1177
|
for (let key in F.flowstreams) {
|
|
@@ -1249,7 +1254,7 @@ F.http = function(opt) {
|
|
|
1249
1254
|
F.loadconfig(cfg);
|
|
1250
1255
|
}
|
|
1251
1256
|
|
|
1252
|
-
F.load(opt.load || opt.type || '', () => F.httpload(opt));
|
|
1257
|
+
F.load(opt.load || opt.type || '', () => F.httpload(opt), opt.clear);
|
|
1253
1258
|
};
|
|
1254
1259
|
|
|
1255
1260
|
F.httpload = function(opt) {
|
|
@@ -1872,12 +1877,11 @@ F.clear = function(init = true, callback) {
|
|
|
1872
1877
|
F.TUtils.ls(dir, function(files, directories) {
|
|
1873
1878
|
|
|
1874
1879
|
if (init) {
|
|
1875
|
-
|
|
1880
|
+
let arr = [];
|
|
1876
1881
|
for (let file of files) {
|
|
1877
|
-
|
|
1882
|
+
let filename = file.substring(dir.length);
|
|
1878
1883
|
if (plus && !filename.startsWith(plus))
|
|
1879
1884
|
continue;
|
|
1880
|
-
|
|
1881
1885
|
if (filename.indexOf('/') === -1 && !filename.endsWith('.cache'))
|
|
1882
1886
|
arr.push(file);
|
|
1883
1887
|
}
|
|
@@ -2047,7 +2051,7 @@ F.audit = function(name, $, message, type) {
|
|
|
2047
2051
|
|
|
2048
2052
|
if ($.user) {
|
|
2049
2053
|
data.userid = $.user.id;
|
|
2050
|
-
data.
|
|
2054
|
+
data.createdby = $.user.name || $.user.nick || $.user.alias;
|
|
2051
2055
|
}
|
|
2052
2056
|
|
|
2053
2057
|
if ($.controller) {
|
|
@@ -2063,7 +2067,7 @@ F.audit = function(name, $, message, type) {
|
|
|
2063
2067
|
data.type = type || 'info';
|
|
2064
2068
|
|
|
2065
2069
|
if ($.id)
|
|
2066
|
-
data.
|
|
2070
|
+
data.action = $.id;
|
|
2067
2071
|
|
|
2068
2072
|
if ($.model)
|
|
2069
2073
|
data.data = JSON.stringify({ params: $.params, query: $.query, model: $.model }, auditjsonserialization);
|