underpost 2.8.867 → 2.8.871
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/README.md +50 -36
- package/bin/build.js +1 -0
- package/bin/deploy.js +4 -0
- package/bin/util.js +1 -56
- package/cli.md +88 -86
- package/conf.js +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/mongo-express/deployment.yaml +12 -12
- package/manifests/maas/nvim.sh +91 -0
- package/package.json +1 -10
- package/src/api/file/file.service.js +28 -8
- package/src/api/user/user.router.js +24 -0
- package/src/api/user/user.service.js +3 -4
- package/src/cli/cluster.js +2 -13
- package/src/cli/cron.js +0 -1
- package/src/cli/db.js +0 -19
- package/src/cli/deploy.js +17 -26
- package/src/cli/fs.js +1 -0
- package/src/cli/index.js +1 -0
- package/src/cli/run.js +9 -2
- package/src/client/components/core/CalendarCore.js +1 -1
- package/src/client/components/core/CssCore.js +12 -0
- package/src/client/components/core/Docs.js +2 -2
- package/src/client/components/core/FullScreen.js +19 -28
- package/src/client/components/core/Input.js +1 -0
- package/src/client/components/core/Modal.js +41 -24
- package/src/client/components/core/ObjectLayerEngine.js +229 -4
- package/src/client/components/core/ObjectLayerEngineModal.js +441 -0
- package/src/client/components/core/Panel.js +4 -1
- package/src/client/components/core/PanelForm.js +1 -1
- package/src/client/components/core/Router.js +29 -25
- package/src/client/components/core/ToggleSwitch.js +15 -1
- package/src/client/components/core/VanillaJs.js +12 -13
- package/src/client/public/default/assets/mailer/api-user-default-avatar.png +0 -0
- package/src/index.js +1 -1
- package/src/server/client-build.js +3 -11
- package/src/server/client-icons.js +6 -78
- package/src/server/conf.js +4 -56
- package/src/server/process.js +2 -1
|
@@ -1,80 +1,17 @@
|
|
|
1
1
|
import { favicons } from 'favicons';
|
|
2
|
-
// TODO: search alternatives
|
|
3
|
-
// import textToImage from 'text-to-image';
|
|
4
2
|
import { loggerFactory } from './logger.js';
|
|
5
3
|
import fs from 'fs-extra';
|
|
6
|
-
import { getCapVariableName
|
|
7
|
-
import { FileFactory } from '../api/file/file.service.js';
|
|
8
|
-
import { svg, png, png3x } from 'font-awesome-assets';
|
|
4
|
+
import { getCapVariableName } from '../client/components/core/CommonJs.js';
|
|
9
5
|
|
|
10
6
|
const logger = loggerFactory(import.meta);
|
|
11
7
|
|
|
12
|
-
const faBase64Png = (faId = 'check', width = 100, height = 100, color = '#209e00') => {
|
|
13
|
-
const b64Src = png3x(faId, color, width, height);
|
|
14
|
-
return b64Src.split('src="data:image/png;base64,')[1].split('"')[0];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const defaultBaseTextImgOptions = {
|
|
18
|
-
debug: true,
|
|
19
|
-
fontFamily: 'Arial',
|
|
20
|
-
fontWeight: 'bold',
|
|
21
|
-
bgColor: 'black',
|
|
22
|
-
textColor: 'white',
|
|
23
|
-
debugFilename: 'src/client/public/text-image.png',
|
|
24
|
-
verticalAlign: 'center',
|
|
25
|
-
textAlign: 'center',
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const defaultBaseTextImgOptionsSizes = {
|
|
29
|
-
'70x70': {
|
|
30
|
-
maxWidth: 70,
|
|
31
|
-
customHeight: 70,
|
|
32
|
-
fontSize: 25,
|
|
33
|
-
margin: 10,
|
|
34
|
-
},
|
|
35
|
-
'100x100': {
|
|
36
|
-
maxWidth: 100,
|
|
37
|
-
customHeight: 100,
|
|
38
|
-
fontSize: 30,
|
|
39
|
-
margin: 12,
|
|
40
|
-
},
|
|
41
|
-
'100x300': {
|
|
42
|
-
maxWidth: 300,
|
|
43
|
-
customHeight: 100,
|
|
44
|
-
fontSize: 30,
|
|
45
|
-
margin: 12,
|
|
46
|
-
},
|
|
47
|
-
'1200x1200': {
|
|
48
|
-
maxWidth: 1200,
|
|
49
|
-
customHeight: 1200,
|
|
50
|
-
fontSize: 500,
|
|
51
|
-
margin: 50,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const buildTextImg = async (text = 'APP', options, size = '1200x1200') => {
|
|
56
|
-
options = { ...defaultBaseTextImgOptions, ...defaultBaseTextImgOptionsSizes[size], ...options };
|
|
57
|
-
// await textToImage.generate(text, options);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const getBufferPngText = async ({ text, textColor, bgColor, size, debugFilename }) => {
|
|
61
|
-
if (!text) text = 'Hello World!';
|
|
62
|
-
if (!textColor) textColor = '#000000';
|
|
63
|
-
if (!bgColor) bgColor = '#ffffff';
|
|
64
|
-
if (!size) size = '100x300';
|
|
65
|
-
if (!debugFilename) debugFilename = `./${s4()}${s4()}${s4()}.png`;
|
|
66
|
-
await buildTextImg(text, { textColor, bgColor, size, debugFilename }, size);
|
|
67
|
-
if (!fs.existsSync(debugFilename)) return Buffer.alloc(0); // Return empty buffer if file not found
|
|
68
|
-
const bufferImage = fs.readFileSync(debugFilename);
|
|
69
|
-
fs.removeSync(debugFilename);
|
|
70
|
-
return bufferImage;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
8
|
const buildIcons = async ({
|
|
74
9
|
publicClientId,
|
|
75
|
-
metadata: { title, description, keywords, author, thumbnail, themeColor },
|
|
10
|
+
metadata: { title, description, keywords, author, thumbnail, themeColor, baseBuildIconReference },
|
|
76
11
|
}) => {
|
|
77
|
-
const source =
|
|
12
|
+
const source = baseBuildIconReference
|
|
13
|
+
? baseBuildIconReference
|
|
14
|
+
: `src/client/public/${publicClientId}/assets/logo/base-icon.png`; // Source image(s). `string`, `buffer` or array of `string`
|
|
78
15
|
|
|
79
16
|
const configuration = {
|
|
80
17
|
path: '/', // Path for overriding default icons path. `string`
|
|
@@ -149,13 +86,4 @@ const buildIcons = async ({
|
|
|
149
86
|
}
|
|
150
87
|
};
|
|
151
88
|
|
|
152
|
-
|
|
153
|
-
const faId = 'user';
|
|
154
|
-
const tmpFilePath = `./tmp/${faId}-${s4() + s4()}.svg`;
|
|
155
|
-
fs.writeFileSync(tmpFilePath, svg(faId, '#f5f5f5d1'), 'utf8');
|
|
156
|
-
const file = await new File(FileFactory.svg(fs.readFileSync(tmpFilePath), `${faId}.svg`)).save();
|
|
157
|
-
fs.removeSync(tmpFilePath);
|
|
158
|
-
return file._id;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export { buildIcons, buildTextImg, defaultBaseTextImgOptions, faBase64Png, getBufferPngText, getDefaultProfileImageId };
|
|
89
|
+
export { buildIcons };
|
package/src/server/conf.js
CHANGED
|
@@ -9,17 +9,12 @@ import {
|
|
|
9
9
|
timer,
|
|
10
10
|
} from '../client/components/core/CommonJs.js';
|
|
11
11
|
import * as dir from 'path';
|
|
12
|
-
import cliProgress from 'cli-progress';
|
|
13
|
-
import cliSpinners from 'cli-spinners';
|
|
14
|
-
import logUpdate from 'log-update';
|
|
15
12
|
import colors from 'colors';
|
|
16
13
|
import { loggerFactory } from './logger.js';
|
|
17
14
|
import { shellExec } from './process.js';
|
|
18
15
|
import { DefaultConf } from '../../conf.js';
|
|
19
|
-
import read from 'read';
|
|
20
16
|
import splitFile from 'split-file';
|
|
21
|
-
import
|
|
22
|
-
import { ssrFactory } from './client-formatted.js';
|
|
17
|
+
import UnderpostRootEnv from '../cli/env.js';
|
|
23
18
|
|
|
24
19
|
colors.enable();
|
|
25
20
|
|
|
@@ -32,7 +27,7 @@ const Config = {
|
|
|
32
27
|
build: async function (deployContext = 'dd-default', deployList, subConf) {
|
|
33
28
|
if (typeof process.argv[2] === 'string' && process.argv[2].startsWith('dd-')) deployContext = process.argv[2];
|
|
34
29
|
if (!fs.existsSync(`./tmp`)) fs.mkdirSync(`./tmp`, { recursive: true });
|
|
35
|
-
|
|
30
|
+
UnderpostRootEnv.API.set('await-deploy', new Date().toISOString());
|
|
36
31
|
if (fs.existsSync(`./engine-private/replica/${deployContext}`))
|
|
37
32
|
return loadConf(deployContext, process.env.NODE_ENV, subConf);
|
|
38
33
|
else if (deployContext.startsWith('dd-')) return loadConf(deployContext, process.env.NODE_ENV, subConf);
|
|
@@ -591,51 +586,6 @@ const buildPortProxyRouter = (port, proxyRouter) => {
|
|
|
591
586
|
return reOrderRouter;
|
|
592
587
|
};
|
|
593
588
|
|
|
594
|
-
const cliBar = async (time = 5000) => {
|
|
595
|
-
// create new progress bar
|
|
596
|
-
const b = new cliProgress.SingleBar({
|
|
597
|
-
format: 'Delay | {bar} | {percentage}% || {value}/{total} Chunks || Speed: {speed}',
|
|
598
|
-
barCompleteChar: '\u2588',
|
|
599
|
-
barIncompleteChar: '\u2591',
|
|
600
|
-
hideCursor: true,
|
|
601
|
-
});
|
|
602
|
-
|
|
603
|
-
const maxValueDisplay = 200;
|
|
604
|
-
const minValueDisplay = 0;
|
|
605
|
-
const steps = 10;
|
|
606
|
-
const incrementValue = 200 / steps;
|
|
607
|
-
const delayTime = time / steps;
|
|
608
|
-
// initialize the bar - defining payload token "speed" with the default value "N/A"
|
|
609
|
-
b.start(maxValueDisplay, minValueDisplay, {
|
|
610
|
-
speed: 'N/A',
|
|
611
|
-
});
|
|
612
|
-
|
|
613
|
-
// update values
|
|
614
|
-
// b1.increment();
|
|
615
|
-
// b1.update(20);
|
|
616
|
-
|
|
617
|
-
for (const step of range(1, steps)) {
|
|
618
|
-
b.increment(incrementValue);
|
|
619
|
-
await timer(delayTime);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
// stop the bar
|
|
623
|
-
b.stop();
|
|
624
|
-
};
|
|
625
|
-
|
|
626
|
-
const cliSpinner = async (time = 5000, message0, message1, color, type = 'dots') => {
|
|
627
|
-
const { frames, interval } = cliSpinners[type];
|
|
628
|
-
const steps = parseInt(time / interval);
|
|
629
|
-
let index = 0;
|
|
630
|
-
for (const step of range(1, steps)) {
|
|
631
|
-
const msg = `${message0 ? message0 : ''}${frames[index]}${message1 ? message1 : ''}`;
|
|
632
|
-
logUpdate(color ? msg[color] : msg);
|
|
633
|
-
await timer(interval);
|
|
634
|
-
index++;
|
|
635
|
-
if (index === frames.length) index = 0;
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
|
|
639
589
|
const buildReplicaId = ({ deployId, replica }) => `${deployId}-${replica.slice(1)}`;
|
|
640
590
|
|
|
641
591
|
const getDataDeploy = (
|
|
@@ -777,9 +727,9 @@ const validateTemplatePath = (absolutePath = '') => {
|
|
|
777
727
|
};
|
|
778
728
|
|
|
779
729
|
const awaitDeployMonitor = async (init = false, deltaMs = 1000) => {
|
|
780
|
-
if (init)
|
|
730
|
+
if (init) UnderpostRootEnv.API.set('await-deploy', new Date().toISOString());
|
|
781
731
|
await timer(deltaMs);
|
|
782
|
-
if (
|
|
732
|
+
if (UnderpostRootEnv.API.get('await-deploy')) return await awaitDeployMonitor();
|
|
783
733
|
};
|
|
784
734
|
|
|
785
735
|
const getCronBackUpFolder = (host = '', path = '') => {
|
|
@@ -991,8 +941,6 @@ export {
|
|
|
991
941
|
buildWsSrc,
|
|
992
942
|
cloneSrcComponents,
|
|
993
943
|
buildProxyRouter,
|
|
994
|
-
cliBar,
|
|
995
|
-
cliSpinner,
|
|
996
944
|
getDataDeploy,
|
|
997
945
|
validateTemplatePath,
|
|
998
946
|
buildReplicaId,
|
package/src/server/process.js
CHANGED
|
@@ -5,6 +5,7 @@ import dotenv from 'dotenv';
|
|
|
5
5
|
import fs from 'fs-extra';
|
|
6
6
|
import { loggerFactory } from './logger.js';
|
|
7
7
|
import clipboard from 'clipboardy';
|
|
8
|
+
import UnderpostRootEnv from '../cli/env.js';
|
|
8
9
|
|
|
9
10
|
dotenv.config();
|
|
10
11
|
|
|
@@ -47,7 +48,7 @@ const ProcessController = {
|
|
|
47
48
|
this.logger.info(`process on exit`, args);
|
|
48
49
|
});
|
|
49
50
|
this.onSigListen();
|
|
50
|
-
|
|
51
|
+
UnderpostRootEnv.API.delete('await-deploy');
|
|
51
52
|
},
|
|
52
53
|
};
|
|
53
54
|
|