boomack 0.10.0-dev → 0.11.0
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/LICENSE.md +22 -0
- package/client/public/js/client.js +143 -46
- package/default-config.yaml +40 -49
- package/package.json +22 -20
- package/server-build/cli.js +0 -1
- package/server-build/index.js +20 -4
- package/server-build/middleware/basic-auth.js +0 -1
- package/server-build/middleware/data-parser.js +0 -1
- package/server-build/middleware/standard-auth.js +0 -1
- package/server-build/middleware/token-auth.js +0 -1
- package/server-build/model/action.js +0 -1
- package/server-build/model/action.test.js +0 -1
- package/server-build/model/display-request.js +0 -1
- package/server-build/model/display-request.test.js +0 -1
- package/server-build/model/layout.js +0 -1
- package/server-build/model/layout.test.js +0 -1
- package/server-build/pipeline/format.js +0 -1
- package/server-build/pipeline/format.test.js +0 -1
- package/server-build/pipeline/load.js +0 -1
- package/server-build/pipeline/load.test.js +0 -1
- package/server-build/pipeline/render.js +1 -2
- package/server-build/pipeline/render.test.js +0 -2
- package/server-build/pipeline/store.js +0 -1
- package/server-build/pipeline/store.test.js +0 -1
- package/server-build/pipeline/transform.js +1 -2
- package/server-build/pipeline/transform.test.js +0 -1
- package/server-build/pipeline.js +4 -5
- package/server-build/pipeline.test.js +0 -1
- package/server-build/plugins/client-resources/tablesort.js +0 -1
- package/server-build/plugins/csv.js +10 -2
- package/server-build/plugins/generic.js +0 -1
- package/server-build/plugins/highlight.js +31 -1
- package/server-build/plugins/markdown.js +9 -1
- package/server-build/plugins/media.js +0 -1
- package/server-build/plugins/text.js +0 -1
- package/server-build/routes/actions.js +0 -1
- package/server-build/routes/display-requests.js +10 -3
- package/server-build/routes/eval-requests.js +1 -6
- package/server-build/routes/export.js +0 -1
- package/server-build/routes/media-types.js +0 -1
- package/server-build/routes/panels.js +13 -3
- package/server-build/routes/presets.js +0 -1
- package/server-build/routes/resources.js +20 -8
- package/server-build/routes/web-client.js +14 -6
- package/server-build/service/actions.js +0 -1
- package/server-build/service/actions.test.js +0 -1
- package/server-build/service/char-encoding.js +0 -1
- package/server-build/service/char-encoding.test.js +0 -1
- package/server-build/service/cli-args.js +0 -1
- package/server-build/service/cli-args.test.js +0 -1
- package/server-build/service/client-resources.js +0 -1
- package/server-build/service/config-check.js +4 -4
- package/server-build/service/config.js +35 -1
- package/server-build/service/config.test.js +0 -1
- package/server-build/service/display-task-helper.js +0 -1
- package/server-build/service/highlight.js +0 -1
- package/server-build/service/html.js +0 -1
- package/server-build/service/html.test.js +0 -1
- package/server-build/service/logging.js +0 -1
- package/server-build/service/media-types.js +0 -1
- package/server-build/service/media-types.test.js +0 -1
- package/server-build/service/micro-markdown.js +0 -1
- package/server-build/service/micro-markdown.test.js +0 -1
- package/server-build/service/mime-type.js +0 -1
- package/server-build/service/mime-type.test.js +0 -1
- package/server-build/service/panels.js +20 -17
- package/server-build/service/{displays.test.js → panels.test.js} +2 -2
- package/server-build/service/persistence.js +0 -1
- package/server-build/service/plugins.js +0 -1
- package/server-build/service/plugins.test.js +0 -1
- package/server-build/service/presets.js +0 -1
- package/server-build/service/presets.test.js +0 -1
- package/server-build/service/rbac.js +0 -1
- package/server-build/service/render.js +0 -1
- package/server-build/service/render.test.js +0 -1
- package/server-build/service/resources.js +1 -2
- package/server-build/service/resources.test.js +0 -1
- package/server-build/service/response-messages.js +0 -1
- package/server-build/service/themes.js +0 -1
- package/server-build/service/transform.js +0 -1
- package/server-build/service/transform.test.js +0 -1
- package/server-build/service/web-ui-paths.js +0 -1
- package/server-build/service/web-user.js +0 -1
- package/server-build/typedefs.js +6 -1
- package/server-build/utils.js +0 -1
- package/server-build/utils.test.js +0 -1
- package/server-build/cli.js.map +0 -1
- package/server-build/index.js.map +0 -1
- package/server-build/middleware/basic-auth.js.map +0 -1
- package/server-build/middleware/data-parser.js.map +0 -1
- package/server-build/middleware/standard-auth.js.map +0 -1
- package/server-build/middleware/token-auth.js.map +0 -1
- package/server-build/model/action.js.map +0 -1
- package/server-build/model/action.test.js.map +0 -1
- package/server-build/model/display-request.js.map +0 -1
- package/server-build/model/display-request.test.js.map +0 -1
- package/server-build/model/layout.js.map +0 -1
- package/server-build/model/layout.test.js.map +0 -1
- package/server-build/pipeline/format.js.map +0 -1
- package/server-build/pipeline/format.test.js.map +0 -1
- package/server-build/pipeline/load.js.map +0 -1
- package/server-build/pipeline/load.test.js.map +0 -1
- package/server-build/pipeline/render.js.map +0 -1
- package/server-build/pipeline/render.test.js.map +0 -1
- package/server-build/pipeline/store.js.map +0 -1
- package/server-build/pipeline/store.test.js.map +0 -1
- package/server-build/pipeline/transform.js.map +0 -1
- package/server-build/pipeline/transform.test.js.map +0 -1
- package/server-build/pipeline.js.map +0 -1
- package/server-build/pipeline.test.js.map +0 -1
- package/server-build/plugins/client-resources/tablesort.js.map +0 -1
- package/server-build/plugins/csv.js.map +0 -1
- package/server-build/plugins/generic.js.map +0 -1
- package/server-build/plugins/highlight.js.map +0 -1
- package/server-build/plugins/markdown.js.map +0 -1
- package/server-build/plugins/media copy.js +0 -85
- package/server-build/plugins/media copy.js.map +0 -1
- package/server-build/plugins/media.js.map +0 -1
- package/server-build/plugins/text.js.map +0 -1
- package/server-build/routes/actions.js.map +0 -1
- package/server-build/routes/display-requests.js.map +0 -1
- package/server-build/routes/eval-request.js +0 -134
- package/server-build/routes/eval-request.js.map +0 -1
- package/server-build/routes/eval-requests.js.map +0 -1
- package/server-build/routes/export.js.map +0 -1
- package/server-build/routes/media-types.js.map +0 -1
- package/server-build/routes/option-sets.js +0 -90
- package/server-build/routes/option-sets.js.map +0 -1
- package/server-build/routes/panels.js.map +0 -1
- package/server-build/routes/presets.js.map +0 -1
- package/server-build/routes/resources.js.map +0 -1
- package/server-build/routes/web-client.js.map +0 -1
- package/server-build/service/actions.js.map +0 -1
- package/server-build/service/actions.test.js.map +0 -1
- package/server-build/service/brand.js +0 -9
- package/server-build/service/brand.js.map +0 -1
- package/server-build/service/char-encoding.js.map +0 -1
- package/server-build/service/char-encoding.test.js.map +0 -1
- package/server-build/service/cli-args.js.map +0 -1
- package/server-build/service/cli-args.test.js.map +0 -1
- package/server-build/service/client-resources.js.map +0 -1
- package/server-build/service/config-check.js.map +0 -1
- package/server-build/service/config.js.map +0 -1
- package/server-build/service/config.test.js.map +0 -1
- package/server-build/service/display-task-helper.js.map +0 -1
- package/server-build/service/displays.test.js.map +0 -1
- package/server-build/service/highlight.js.map +0 -1
- package/server-build/service/html.js.map +0 -1
- package/server-build/service/html.test.js.map +0 -1
- package/server-build/service/logging.js.map +0 -1
- package/server-build/service/media-types.js.map +0 -1
- package/server-build/service/media-types.test.js.map +0 -1
- package/server-build/service/micro-markdown.js.map +0 -1
- package/server-build/service/micro-markdown.test.js.map +0 -1
- package/server-build/service/mime-type.js.map +0 -1
- package/server-build/service/mime-type.test.js.map +0 -1
- package/server-build/service/option-sets.js +0 -123
- package/server-build/service/option-sets.js.map +0 -1
- package/server-build/service/option-sets.test.js +0 -130
- package/server-build/service/option-sets.test.js.map +0 -1
- package/server-build/service/panels.js.map +0 -1
- package/server-build/service/pdf-export.js +0 -73
- package/server-build/service/pdf-export.js.map +0 -1
- package/server-build/service/persistence.js.map +0 -1
- package/server-build/service/plugins.js.map +0 -1
- package/server-build/service/plugins.test.js.map +0 -1
- package/server-build/service/presets.js.map +0 -1
- package/server-build/service/presets.test.js.map +0 -1
- package/server-build/service/rbac.js.map +0 -1
- package/server-build/service/render.js.map +0 -1
- package/server-build/service/render.test.js.map +0 -1
- package/server-build/service/resources.js.map +0 -1
- package/server-build/service/resources.test.js.map +0 -1
- package/server-build/service/response-messages.js.map +0 -1
- package/server-build/service/themes.js.map +0 -1
- package/server-build/service/transform.js.map +0 -1
- package/server-build/service/transform.test.js.map +0 -1
- package/server-build/service/type-mappings.js +0 -39
- package/server-build/service/type-mappings.js.map +0 -1
- package/server-build/service/web-ui-paths.js.map +0 -1
- package/server-build/service/web-user.js.map +0 -1
- package/server-build/text-types.js +0 -12
- package/server-build/text-types.js.map +0 -1
- package/server-build/typedefs.js.map +0 -1
- package/server-build/utils.js.map +0 -1
- package/server-build/utils.test.js.map +0 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
**Copyright (c) 2022 Tobias Kiertscher <dev@mastersign.de>**
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
|
@@ -120,7 +120,7 @@ window.boomack = window.boomack || {};
|
|
|
120
120
|
|
|
121
121
|
function ensureSlotResizeSensor(slotId) {
|
|
122
122
|
if (_.has(slotResizeSensors, slotId)) return;
|
|
123
|
-
var slotE =
|
|
123
|
+
var slotE = getSlot(slotId);
|
|
124
124
|
if (!slotE.length) {
|
|
125
125
|
console.log("Could not find the slot '" + slotId + "' for registering a slot resize handler.");
|
|
126
126
|
return;
|
|
@@ -198,11 +198,25 @@ window.boomack = window.boomack || {};
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
ctx.findSlot = function(slotHint) {
|
|
202
|
+
var slotE = typeof slotHint === 'string' ? getSlot(slotHint) : {};
|
|
203
|
+
if (!slotE.length) {
|
|
204
|
+
// try to use slotHint as selector for slot content element
|
|
205
|
+
// and search parents for slot
|
|
206
|
+
slotE = $(slotHint).closest('.slot');
|
|
207
|
+
}
|
|
208
|
+
return slotE.length === 1 ? slotE[0] : null;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
ctx.getSlotId = function(slot) {
|
|
212
|
+
return slot ? slot.getAttribute('data-slot-id') : null;
|
|
213
|
+
};
|
|
214
|
+
|
|
201
215
|
ctx.registerSlotResizeHandler = function (slotHint, handler, callImmediately) {
|
|
202
216
|
var slotId = null;
|
|
203
217
|
var slotE = null;
|
|
204
218
|
// try to use slotHint as slot ID
|
|
205
|
-
slotE =
|
|
219
|
+
slotE = getSlot(slotHint);
|
|
206
220
|
if (!slotE.length) {
|
|
207
221
|
// try to use slotHint as selector for slot content element
|
|
208
222
|
// and search parents for slot
|
|
@@ -228,7 +242,7 @@ window.boomack = window.boomack || {};
|
|
|
228
242
|
ctx.registerPersistentSlotResizeHandler = function(slotId, handler) {
|
|
229
243
|
ensureSlotResizeSensor(slotId);
|
|
230
244
|
persistentSlotResizeHandlers[slotId].push(handler);
|
|
231
|
-
var slotE =
|
|
245
|
+
var slotE = getSlot(slotId);
|
|
232
246
|
var size = getSlotInnerSize(slotE);
|
|
233
247
|
var zoomedSize = getZoomedSlotInnerSize(slotE, size);
|
|
234
248
|
handler(size, zoomedSize);
|
|
@@ -250,15 +264,15 @@ window.boomack = window.boomack || {};
|
|
|
250
264
|
$('#panel').html(layoutHtml);
|
|
251
265
|
}
|
|
252
266
|
|
|
253
|
-
function
|
|
267
|
+
function getAllSlots() {
|
|
254
268
|
return $('.slot');
|
|
255
269
|
}
|
|
256
270
|
|
|
257
|
-
function
|
|
271
|
+
function getSlot(slotId) {
|
|
258
272
|
return $(`#slot-${slotId}`);
|
|
259
273
|
}
|
|
260
274
|
|
|
261
|
-
function
|
|
275
|
+
function getAllButSlot(slotId) {
|
|
262
276
|
return $(`.slot:not(#slot-${slotId})`);
|
|
263
277
|
}
|
|
264
278
|
|
|
@@ -392,6 +406,14 @@ window.boomack = window.boomack || {};
|
|
|
392
406
|
classes.forEach(cls => { slotE.removeClass(cls); });
|
|
393
407
|
slotE.find('.cmd-zoom-in').removeClass('disabled');
|
|
394
408
|
slotE.find('.cmd-zoom-out').removeClass('disabled');
|
|
409
|
+
// make sure to reset styles of all content related elements,
|
|
410
|
+
// in case some JavaScript attached styles during display
|
|
411
|
+
slotE.find('.slot-content-box')
|
|
412
|
+
.each(function () { this.style = {}; })
|
|
413
|
+
.find('.slot-content-wrapper')
|
|
414
|
+
.each(function () { this.style = {}; })
|
|
415
|
+
.find('.slot-content')
|
|
416
|
+
.each(function () { this.style = {}; });
|
|
395
417
|
}
|
|
396
418
|
|
|
397
419
|
const imgPattern = /^\s*<img\s+src=\"([^\"]*)\"\s*\/?>/;
|
|
@@ -442,7 +464,6 @@ window.boomack = window.boomack || {};
|
|
|
442
464
|
}
|
|
443
465
|
|
|
444
466
|
let socket = null;
|
|
445
|
-
let actionCallback = null;
|
|
446
467
|
let scrollTimeout = null;
|
|
447
468
|
|
|
448
469
|
function scrollToSlot(slotId) {
|
|
@@ -451,7 +472,7 @@ window.boomack = window.boomack || {};
|
|
|
451
472
|
}
|
|
452
473
|
scrollTimeout = window.setTimeout(() => {
|
|
453
474
|
scrollTimeout = null;
|
|
454
|
-
const slotE =
|
|
475
|
+
const slotE = getSlot(slotId);
|
|
455
476
|
if (slotE) {
|
|
456
477
|
window.scrollTo({
|
|
457
478
|
top: slotE.offset().top - 10,
|
|
@@ -493,7 +514,7 @@ window.boomack = window.boomack || {};
|
|
|
493
514
|
} else if (envelope.command) {
|
|
494
515
|
const cmd = envelope.command;
|
|
495
516
|
if (cmd.panel != ctx.panelId) return;
|
|
496
|
-
const slotE =
|
|
517
|
+
const slotE = getSlot(cmd.slot);
|
|
497
518
|
const contentE = slotE.find('.slot-content');
|
|
498
519
|
if (!contentE) return;
|
|
499
520
|
const empty = contentE.is(':empty');
|
|
@@ -550,6 +571,83 @@ window.boomack = window.boomack || {};
|
|
|
550
571
|
ctx.run(function () { eval(cmd.script); });
|
|
551
572
|
}
|
|
552
573
|
|
|
574
|
+
const pendingActionCalls = {};
|
|
575
|
+
|
|
576
|
+
function cleanUpPendingActionCalls() {
|
|
577
|
+
var now = new Date().getTime();
|
|
578
|
+
for (const callId in pendingActionCalls) {
|
|
579
|
+
const ar = pendingActionCalls[callId];
|
|
580
|
+
if (now > ar.ts + ar.timeout) {
|
|
581
|
+
delete pendingActionCalls[callId]
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function padLeft(pad, x) {
|
|
587
|
+
return (pad + x).slice(-pad.length);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function newCallId(ts) {
|
|
591
|
+
const r = Math.floor(Math.random() * 1000);
|
|
592
|
+
return padLeft("00000000000000", ts) + "_" + padLeft("000", r);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function uniqueCallId(ts) {
|
|
596
|
+
let callId = newCallId(ts);
|
|
597
|
+
while (pendingActionCalls[callId]) {
|
|
598
|
+
callId = newCallId(ts);
|
|
599
|
+
}
|
|
600
|
+
return callId;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function beginActionCall(actionId, payload, cb, options = {
|
|
604
|
+
timeout: 10000,
|
|
605
|
+
}) {
|
|
606
|
+
cleanUpPendingActionCalls();
|
|
607
|
+
const ts = new Date().getTime();
|
|
608
|
+
const callId = uniqueCallId(ts);
|
|
609
|
+
const call = {
|
|
610
|
+
id: callId,
|
|
611
|
+
ts: ts,
|
|
612
|
+
timeout: options.timeout,
|
|
613
|
+
resolve: null,
|
|
614
|
+
reject: null,
|
|
615
|
+
};
|
|
616
|
+
const promise = new Promise((resolve, reject) => {
|
|
617
|
+
call.resolve = response => {
|
|
618
|
+
delete pendingActionCalls[callId];
|
|
619
|
+
resolve(response);
|
|
620
|
+
if (typeof cb === 'function') {
|
|
621
|
+
try {
|
|
622
|
+
cb(null, response);
|
|
623
|
+
} catch (err) {
|
|
624
|
+
console.error("Callback for action " + actionId + " has thrown an error:", err);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
call.reject = reason => {
|
|
629
|
+
delete pendingActionCalls[callId];
|
|
630
|
+
reject(reason);
|
|
631
|
+
if (typeof cb === 'function') {
|
|
632
|
+
try {
|
|
633
|
+
cb(reason);
|
|
634
|
+
} catch (err) {
|
|
635
|
+
console.error("Callback for action " + actionId + " has thrown an error:", err);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
});
|
|
640
|
+
pendingActionCalls[callId] = call;
|
|
641
|
+
socket.emit('action', {
|
|
642
|
+
action: actionId,
|
|
643
|
+
panel: ctx.panelId,
|
|
644
|
+
payload: payload,
|
|
645
|
+
token: callId,
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
return promise;
|
|
649
|
+
}
|
|
650
|
+
|
|
553
651
|
$(function () {
|
|
554
652
|
// run when page is ready
|
|
555
653
|
|
|
@@ -584,11 +682,11 @@ window.boomack = window.boomack || {};
|
|
|
584
682
|
|
|
585
683
|
socket.on('clear', cmd => {
|
|
586
684
|
if (cmd.slot) {
|
|
587
|
-
const slotE =
|
|
685
|
+
const slotE = getSlot(cmd.slot);
|
|
588
686
|
slotE.find('.slot-content').html('');
|
|
589
687
|
notifySlotEmpty(cmd.slot, slotE);
|
|
590
688
|
} else {
|
|
591
|
-
const slotEs =
|
|
689
|
+
const slotEs = getAllSlots();
|
|
592
690
|
slotEs.each(function () {
|
|
593
691
|
const slotE = $(this);
|
|
594
692
|
slotE.find('.slot-content').html('');
|
|
@@ -609,24 +707,28 @@ window.boomack = window.boomack || {};
|
|
|
609
707
|
}, 'html');
|
|
610
708
|
});
|
|
611
709
|
|
|
612
|
-
socket.on('action-error',
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
710
|
+
socket.on('action-error', response => {
|
|
711
|
+
const ar = pendingActionCalls[response.token];
|
|
712
|
+
if (ar) {
|
|
713
|
+
ar.reject(response.error);
|
|
714
|
+
} else {
|
|
715
|
+
console.warn("Response for action " + response.action + " without handler:", response.token);
|
|
616
716
|
}
|
|
617
717
|
});
|
|
618
|
-
socket.on('action-success',
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
718
|
+
socket.on('action-success', response => {
|
|
719
|
+
const ar = pendingActionCalls[response.token];
|
|
720
|
+
if (ar) {
|
|
721
|
+
ar.resolve(response.payload);
|
|
722
|
+
} else {
|
|
723
|
+
console.warn("Response for action " + response.action + " without handler:", response.token);
|
|
622
724
|
}
|
|
623
725
|
});
|
|
624
726
|
});
|
|
625
727
|
|
|
626
728
|
ctx.cmdToggleMaximize = function (slotId) {
|
|
627
|
-
const slotE =
|
|
729
|
+
const slotE = getSlot(slotId);
|
|
628
730
|
if (!slotE) return;
|
|
629
|
-
const otherSlotE =
|
|
731
|
+
const otherSlotE = getAllButSlot(slotId);
|
|
630
732
|
const cmdMaximize = slotE.find('.slot-toolbar .cmd-maximize i.icon');
|
|
631
733
|
if (slotE.hasClass('maximized')) {
|
|
632
734
|
slotE.removeClass('maximized');
|
|
@@ -646,7 +748,7 @@ window.boomack = window.boomack || {};
|
|
|
646
748
|
|
|
647
749
|
ctx.cmdHistoryBackward = function (slotId) {
|
|
648
750
|
if (ctx.offline) return;
|
|
649
|
-
const slotE =
|
|
751
|
+
const slotE = getSlot(slotId);
|
|
650
752
|
if (!slotE) return;
|
|
651
753
|
const no = Number.parseInt(slotE.data('sequence-no')) - 1;
|
|
652
754
|
if (!isValidHistoryNo(slotE, no)) return;
|
|
@@ -665,7 +767,7 @@ window.boomack = window.boomack || {};
|
|
|
665
767
|
|
|
666
768
|
ctx.cmdHistoryForward = function (slotId) {
|
|
667
769
|
if (ctx.offline) return;
|
|
668
|
-
const slotE =
|
|
770
|
+
const slotE = getSlot(slotId);
|
|
669
771
|
if (!slotE) return;
|
|
670
772
|
const no = Number.parseInt(slotE.data('sequence-no')) + 1;
|
|
671
773
|
if (!isValidHistoryNo(slotE, no)) return;
|
|
@@ -684,7 +786,7 @@ window.boomack = window.boomack || {};
|
|
|
684
786
|
|
|
685
787
|
ctx.cmdTogglePause = function (slotId) {
|
|
686
788
|
if (ctx.offline) return;
|
|
687
|
-
const slotE =
|
|
789
|
+
const slotE = getSlot(slotId);
|
|
688
790
|
if (!slotE) return;
|
|
689
791
|
const cmdPause = slotE.find('.slot-toolbar .cmd-pause i.icon');
|
|
690
792
|
if (slotE.hasClass('paused')) {
|
|
@@ -741,7 +843,7 @@ window.boomack = window.boomack || {};
|
|
|
741
843
|
}
|
|
742
844
|
|
|
743
845
|
ctx.cmdSlotZoomOut = function (slotId) {
|
|
744
|
-
const slotE =
|
|
846
|
+
const slotE = getSlot(slotId);
|
|
745
847
|
const zoom = getSlotZoom(slotE);
|
|
746
848
|
const newZoom = zoomFromBase(baseFromZoom(zoom) - 1);
|
|
747
849
|
setData(slotE, 'zoom', newZoom);
|
|
@@ -749,7 +851,7 @@ window.boomack = window.boomack || {};
|
|
|
749
851
|
};
|
|
750
852
|
|
|
751
853
|
ctx.cmdSlotZoomIn = function (slotId) {
|
|
752
|
-
const slotE =
|
|
854
|
+
const slotE = getSlot(slotId);
|
|
753
855
|
const zoom = getSlotZoom(slotE);
|
|
754
856
|
const newZoom = zoomFromBase(baseFromZoom(zoom) + 1);
|
|
755
857
|
setData(slotE, 'zoom', newZoom);
|
|
@@ -774,31 +876,26 @@ window.boomack = window.boomack || {};
|
|
|
774
876
|
return replaceThemeProps(o);
|
|
775
877
|
};
|
|
776
878
|
|
|
777
|
-
ctx.
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
879
|
+
ctx.action = function (
|
|
880
|
+
actionId,
|
|
881
|
+
payload = null,
|
|
882
|
+
cb = null,
|
|
883
|
+
options = {
|
|
884
|
+
timeout: 10000,
|
|
781
885
|
}
|
|
782
|
-
|
|
783
|
-
socket.emit('action', {
|
|
784
|
-
action: actionId,
|
|
785
|
-
panel: ctx.panelId,
|
|
786
|
-
payload: payload,
|
|
787
|
-
});
|
|
788
|
-
};
|
|
789
|
-
|
|
790
|
-
ctx.boom = function (displayRequest, cb) {
|
|
886
|
+
) {
|
|
791
887
|
if (ctx.offline) {
|
|
792
|
-
console.warn('Can not
|
|
888
|
+
console.warn('Can not call action, if in print or exported mode.', 'Action', actionId);
|
|
793
889
|
return;
|
|
794
890
|
}
|
|
795
|
-
|
|
796
|
-
// possibly in an extra web client library
|
|
797
|
-
alert('Not implemented');
|
|
891
|
+
return beginActionCall(actionId, payload, cb, options);
|
|
798
892
|
};
|
|
799
893
|
|
|
800
|
-
//
|
|
801
|
-
|
|
802
|
-
|
|
894
|
+
// deprecated
|
|
895
|
+
ctx.arang = function () {
|
|
896
|
+
console.warn('The arang function is deprecated. Please use boomack.action().');
|
|
897
|
+
return ctx.action.apply(ctx, arguments);
|
|
898
|
+
};
|
|
899
|
+
window.arang = ctx.arang; // deprecated
|
|
803
900
|
|
|
804
901
|
})();
|
package/default-config.yaml
CHANGED
|
@@ -227,31 +227,45 @@ export:
|
|
|
227
227
|
resourceSizeLimit: 1536 MB
|
|
228
228
|
|
|
229
229
|
init:
|
|
230
|
-
#
|
|
230
|
+
# A map with initial panels
|
|
231
231
|
panels:
|
|
232
|
-
# one panel must have the ID default
|
|
233
|
-
default:
|
|
234
|
-
layout:
|
|
235
|
-
# the initial default panel has a minimal grid layout
|
|
236
|
-
grid:
|
|
237
|
-
columns: 1
|
|
238
|
-
rows: 1
|
|
239
|
-
slots:
|
|
240
|
-
# one slot in each panel must have the ID default
|
|
241
|
-
default:
|
|
242
|
-
history: 10
|
|
243
|
-
border: true
|
|
244
|
-
toobar: true
|
|
245
|
-
showId: true
|
|
246
|
-
column: 0
|
|
247
|
-
row: 0
|
|
248
|
-
columnSpan: 1
|
|
249
|
-
rowSpan: 1
|
|
232
|
+
# one panel must have the ID "default"
|
|
233
|
+
"default":
|
|
250
234
|
# show or hide the header above the slots
|
|
251
235
|
header: true
|
|
236
|
+
# the size of the header, if visible: mini, tiny, small, medium, large, huge, massive
|
|
237
|
+
headerSize: medium
|
|
252
238
|
# select a theme for this panel: default, dark
|
|
253
239
|
theme: default
|
|
254
|
-
|
|
240
|
+
# CSS code to be included in the HTML head of the panel
|
|
241
|
+
style: null
|
|
242
|
+
# JavaScript code to be executed when the panel was loaded
|
|
243
|
+
script: null
|
|
244
|
+
# the ID of the default slot (optional)
|
|
245
|
+
defaultSlot: null
|
|
246
|
+
# the initial default panel has a minimal grid layout
|
|
247
|
+
grid:
|
|
248
|
+
columns: 1
|
|
249
|
+
rows: 1
|
|
250
|
+
slots:
|
|
251
|
+
# if not explicitly defined, first slot is the default slot
|
|
252
|
+
"default":
|
|
253
|
+
history: 10
|
|
254
|
+
extensions: 100
|
|
255
|
+
border: true
|
|
256
|
+
toobar: true
|
|
257
|
+
noZoom: false
|
|
258
|
+
noClear: false
|
|
259
|
+
noMaximize: false
|
|
260
|
+
noSingleOut: false
|
|
261
|
+
showId: true
|
|
262
|
+
colorFilter: null
|
|
263
|
+
column: 0
|
|
264
|
+
row: 0
|
|
265
|
+
columnSpan: 1
|
|
266
|
+
rowSpan: 1
|
|
267
|
+
|
|
268
|
+
# A map with initial actions
|
|
255
269
|
actions: { }
|
|
256
270
|
# action-id:
|
|
257
271
|
# type: shell
|
|
@@ -270,32 +284,9 @@ init:
|
|
|
270
284
|
# background: #FFC080
|
|
271
285
|
|
|
272
286
|
# A map with initial MIME types
|
|
273
|
-
types:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
transformation: csv-table
|
|
280
|
-
"text/xml":
|
|
281
|
-
options:
|
|
282
|
-
syntax: xml
|
|
283
|
-
"application/xml":
|
|
284
|
-
text: true # indicate that this non-text MIME type can be treated as text
|
|
285
|
-
options:
|
|
286
|
-
syntax: xml
|
|
287
|
-
"text/yaml":
|
|
288
|
-
options:
|
|
289
|
-
syntax: yaml
|
|
290
|
-
"application/x-yaml":
|
|
291
|
-
text: true
|
|
292
|
-
options:
|
|
293
|
-
syntax: yaml
|
|
294
|
-
"application/javascript":
|
|
295
|
-
text: true
|
|
296
|
-
options:
|
|
297
|
-
syntax: js
|
|
298
|
-
"application/json":
|
|
299
|
-
text: true
|
|
300
|
-
options:
|
|
301
|
-
syntax: json
|
|
287
|
+
types: { }
|
|
288
|
+
# example type for a syntax highlighted text file
|
|
289
|
+
# "text/css":
|
|
290
|
+
# presets: []
|
|
291
|
+
# options:
|
|
292
|
+
# syntax: css
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boomack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "web app for displaying hyper-media items in concert with e.g. an IDE",
|
|
5
5
|
"author": "Tobias Kiertscher <dev@mastersign.de>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
"boomack": "./server-build/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
+
"LICENSE.md",
|
|
11
12
|
"server-build",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
13
|
+
"default-config.yaml",
|
|
14
|
+
"client"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
16
17
|
"build": "tsc",
|
|
@@ -28,21 +29,21 @@
|
|
|
28
29
|
"node": ">= 10.0.0"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"archiver": "^5.
|
|
32
|
+
"archiver": "^5.3.0",
|
|
32
33
|
"async": "^3.2.0",
|
|
33
34
|
"chalk": "^4.1.0",
|
|
34
|
-
"chardet": "^
|
|
35
|
+
"chardet": "^1.4.0",
|
|
35
36
|
"commonmark": "^0.30.0",
|
|
36
37
|
"cookie-parser": "^1.4.5",
|
|
37
38
|
"cors": "^2.8.5",
|
|
38
39
|
"csv-parse": "^4.15.1",
|
|
39
|
-
"ejs": "^
|
|
40
|
-
"express": "^4.
|
|
40
|
+
"ejs": "^3.1.8",
|
|
41
|
+
"express": "^4.18.0",
|
|
41
42
|
"express-basic-auth": "^1.2.0",
|
|
42
|
-
"got": "^
|
|
43
|
-
"iconv-lite": "^0.
|
|
44
|
-
"lodash": "^4.17.
|
|
45
|
-
"markdown-it": "^
|
|
43
|
+
"got": "^11.8.5",
|
|
44
|
+
"iconv-lite": "^0.6.0",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"markdown-it": "^13.0.0",
|
|
46
47
|
"markdown-it-container": "^3.0.0",
|
|
47
48
|
"markdown-it-emoji": "^2.0.0",
|
|
48
49
|
"markdown-it-ins": "^3.0.1",
|
|
@@ -51,21 +52,22 @@
|
|
|
51
52
|
"markdown-it-sup": "^1.0.0",
|
|
52
53
|
"moment": "^2.29.1",
|
|
53
54
|
"ncp": "^2.0.0",
|
|
54
|
-
"nocache": "^
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
55
|
+
"nocache": "^3.0.4",
|
|
56
|
+
"on-finished": "^2.4.1",
|
|
57
|
+
"open": "^8.4.0",
|
|
58
|
+
"prismjs": "^1.28.0",
|
|
59
|
+
"raw-body": "^2.5.1",
|
|
58
60
|
"rimraf": "^3.0.2",
|
|
59
61
|
"secure-random-string": "^1.1.3",
|
|
60
|
-
"socket.io": "^4.
|
|
61
|
-
"uuid": "^3.
|
|
62
|
-
"winston": "^3.
|
|
62
|
+
"socket.io": "^4.5.1",
|
|
63
|
+
"uuid": "^8.3.2",
|
|
64
|
+
"winston": "^3.8.1",
|
|
63
65
|
"yaml": "^1.10.0",
|
|
64
66
|
"yargs": "^15.4.1"
|
|
65
67
|
},
|
|
66
68
|
"devDependencies": {
|
|
67
|
-
"@types/express": "^4.17.
|
|
68
|
-
"@types/lodash": "^4.14.
|
|
69
|
+
"@types/express": "^4.17.13",
|
|
70
|
+
"@types/lodash": "^4.14.182",
|
|
69
71
|
"@types/rimraf": "^3.0.0",
|
|
70
72
|
"boomack-theme-blue-night": "https://github.com/boomack/themes/tarball/blue-night/v3",
|
|
71
73
|
"boomack-theme-dark": "https://github.com/boomack/themes/tarball/dark/v2",
|
package/server-build/cli.js
CHANGED
package/server-build/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const cors = require('cors');
|
|
|
8
8
|
const app = express();
|
|
9
9
|
const http = require('http');
|
|
10
10
|
const server = http.createServer(app);
|
|
11
|
+
const onFinished = require('on-finished');
|
|
11
12
|
const socketio = require('socket.io');
|
|
12
13
|
const io = socketio();
|
|
13
14
|
const utils = require('./utils');
|
|
@@ -23,6 +24,7 @@ const resources = require('./service/resources');
|
|
|
23
24
|
const panels = require('./service/panels');
|
|
24
25
|
const actions = require('./service/actions');
|
|
25
26
|
const persistence = require('./service/persistence');
|
|
27
|
+
const messages = require('./service/response-messages');
|
|
26
28
|
const log = logging.log;
|
|
27
29
|
function showPreamble(cb) {
|
|
28
30
|
if (!cli.args.logo) {
|
|
@@ -304,7 +306,14 @@ function setupApp(cb) {
|
|
|
304
306
|
app.use(require('nocache')());
|
|
305
307
|
// Log all HTTP request URLs
|
|
306
308
|
app.use((req, res, next) => {
|
|
307
|
-
|
|
309
|
+
onFinished(res, function (err, res) {
|
|
310
|
+
if (err) {
|
|
311
|
+
log.error(err);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
log.http(`${req.method} ${req.url} ${res.statusCode}`);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
308
317
|
next();
|
|
309
318
|
});
|
|
310
319
|
app.use(cors());
|
|
@@ -317,6 +326,13 @@ function setupApp(cb) {
|
|
|
317
326
|
require('./routes/display-requests').setup(app, io);
|
|
318
327
|
require('./routes/eval-requests').setup(app, io);
|
|
319
328
|
require('./routes/export').setup(app, io);
|
|
329
|
+
app.use((req, res) => {
|
|
330
|
+
messages.error(res, {
|
|
331
|
+
status: 404,
|
|
332
|
+
title: "Resource not found",
|
|
333
|
+
message: `The resource "${req.url}" was not found.`,
|
|
334
|
+
});
|
|
335
|
+
});
|
|
320
336
|
cb(null);
|
|
321
337
|
}
|
|
322
338
|
function startServer(cb) {
|
|
@@ -382,13 +398,14 @@ async.waterfall([
|
|
|
382
398
|
showPreamble,
|
|
383
399
|
logging.initialize,
|
|
384
400
|
cfg.parseArgsAndLoadConfig,
|
|
385
|
-
cfgCheck.run,
|
|
386
401
|
logging.configure,
|
|
387
402
|
initializeAuthentication,
|
|
388
403
|
initializeResources,
|
|
389
|
-
showConfiguration,
|
|
390
404
|
loadCorePlugIns,
|
|
391
405
|
loadPlugIns,
|
|
406
|
+
cfg.plugInInitConfigApplicatorFactory(plugins),
|
|
407
|
+
showConfiguration,
|
|
408
|
+
cfgCheck.run,
|
|
392
409
|
loadPresets,
|
|
393
410
|
loadMimeTypes,
|
|
394
411
|
loadActions,
|
|
@@ -404,4 +421,3 @@ async.waterfall([
|
|
|
404
421
|
log.error(err.message);
|
|
405
422
|
}
|
|
406
423
|
});
|
|
407
|
-
//# sourceMappingURL=index.js.map
|