underpost 2.8.866 → 2.8.867

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 CHANGED
@@ -29,10 +29,11 @@
29
29
 
30
30
 
31
31
 
32
+
32
33
  <!-- badges -->
33
34
 
34
35
 
35
- [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.8.866)](https://socket.dev/npm/package/underpost/overview/2.8.866) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
36
+ [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.8.867)](https://socket.dev/npm/package/underpost/overview/2.8.867) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
36
37
 
37
38
 
38
39
  <!-- end-badges -->
@@ -50,6 +51,7 @@
50
51
 
51
52
 
52
53
 
54
+
53
55
  </div>
54
56
 
55
57
  <div align="center">
@@ -94,7 +96,7 @@ Run dev client server
94
96
  npm run dev
95
97
  ```
96
98
  <!-- -->
97
- ## underpost ci/cd cli v2.8.866
99
+ ## underpost ci/cd cli v2.8.867
98
100
 
99
101
  ### Usage: `underpost [options] [command]`
100
102
  ```
package/bin/deploy.js CHANGED
@@ -28,6 +28,7 @@ import { DefaultConf } from '../conf.js';
28
28
  import colors from 'colors';
29
29
  import { program } from '../src/cli/index.js';
30
30
  import { getLocalIPv4Address, ip } from '../src/server/dns.js';
31
+ import { timer } from '../src/client/components/core/CommonJs.js';
31
32
 
32
33
  colors.enable();
33
34
 
@@ -367,6 +368,17 @@ try {
367
368
  }
368
369
 
369
370
  case 'version-build': {
371
+ shellExec(`node bin run kill 4001`);
372
+ shellExec(`node bin run kill 4002`);
373
+ shellExec(`node bin run kill 4003`);
374
+ shellExec(`npm run update-template`);
375
+ shellExec(`cd ../pwa-microservices-template && npm run build && timeout 5s npm run dev`, {
376
+ async: true,
377
+ });
378
+ await timer(5500);
379
+ const templateRunnerResult = fs.readFileSync(`../pwa-microservices-template/logs/start.js/all.log`, 'utf8');
380
+ logger.info('Test template runner result');
381
+ console.log(templateRunnerResult);
370
382
  shellExec(`node bin/deploy clean-core-repo`);
371
383
  shellCd(`/home/dd/engine`);
372
384
  const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
@@ -429,10 +441,23 @@ try {
429
441
  shellExec(`node bin/deploy update-dependencies`);
430
442
  shellExec(`auto-changelog`);
431
443
  shellExec(`node bin/build dd`);
432
- shellExec(`node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 --node ${node} dd`);
433
444
  shellExec(
434
445
  `node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 --node ${node} dd production`,
435
446
  );
447
+ for (const deployId of fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(`,`)) {
448
+ fs.copySync(
449
+ `./engine-private/conf/${deployId}/build/development/deployment.yaml`,
450
+ `./manifests/deployment/${deployId}-development/deployment.yaml`,
451
+ );
452
+ fs.copySync(
453
+ `./engine-private/conf/${deployId}/build/development/proxy.yaml`,
454
+ `./manifests/deployment/${deployId}-development/proxy.yaml`,
455
+ );
456
+ }
457
+ shellExec(`sudo rm -rf ./engine-private/conf/dd-default`);
458
+ shellExec(`node bin new --deploy-id dd-default`);
459
+ console.log(fs.existsSync(`./engine-private/conf/dd-default`));
460
+ shellExec(`sudo rm -rf ./engine-private/conf/dd-default`);
436
461
  break;
437
462
  }
438
463
 
package/bin/file.js CHANGED
@@ -60,6 +60,8 @@ try {
60
60
  else {
61
61
  shellExec(`cd ${toPath} && git reset && git checkout . && git clean -f -d`);
62
62
  shellExec(`underpost pull ${toPath} underpostnet/pwa-microservices-template`);
63
+ shellExec(`sudo rm -rf ${toPath}/engine-private`);
64
+ shellExec(`sudo rm -rf ${toPath}/logs`);
63
65
  }
64
66
  } else {
65
67
  fs.removeSync(toPath);
@@ -94,6 +96,7 @@ try {
94
96
  './manifests/deployment/dd-template-development',
95
97
  'bin/web3.js',
96
98
  'bin/cyberia.js',
99
+ 'bin/cyberia0.js',
97
100
  ]) {
98
101
  if (fs.existsSync(deletePath)) fs.removeSync('../pwa-microservices-template/' + deletePath);
99
102
  }
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.8.866
1
+ ## underpost ci/cd cli v2.8.867
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: localhost/rockylinux9-underpost:v2.8.866
20
+ image: localhost/rockylinux9-underpost:v2.8.867
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "124Ki"
@@ -100,7 +100,7 @@ spec:
100
100
  spec:
101
101
  containers:
102
102
  - name: dd-default-development-green
103
- image: localhost/rockylinux9-underpost:v2.8.866
103
+ image: localhost/rockylinux9-underpost:v2.8.867
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.8.866",
5
+ "version": "2.8.867",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
@@ -51,6 +51,7 @@ const Modal = {
51
51
  RouterInstance: {},
52
52
  disableTools: [],
53
53
  observer: false,
54
+ disableBoxShadow: false,
54
55
  },
55
56
  ) {
56
57
  if (options.heightBottomBar === undefined) options.heightBottomBar = 50;
@@ -89,6 +90,11 @@ const Modal = {
89
90
  onHome: {},
90
91
  homeModals: options.homeModals ? options.homeModals : [],
91
92
  query: options.query ? `${window.location.search}` : undefined,
93
+ getTop: () => window.innerHeight - (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar),
94
+ getHeight: () =>
95
+ window.innerHeight -
96
+ (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
97
+ (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar),
92
98
  };
93
99
 
94
100
  if (idModal !== 'main-body' && options.mode !== 'view') {
@@ -117,12 +123,7 @@ const Modal = {
117
123
 
118
124
  Responsive.Event[`view-${idModal}`] = () => {
119
125
  if (!this.Data[idModal]) return delete Responsive.Event[`view-${idModal}`];
120
- if (this.Data[idModal].slideMenu)
121
- s(`.${idModal}`).style.height = `${
122
- window.innerHeight -
123
- (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
124
- (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
125
- }px`;
126
+ if (this.Data[idModal].slideMenu) s(`.${idModal}`).style.height = `${this.Data[idModal].getHeight()}px`;
126
127
  };
127
128
  Responsive.Event[`view-${idModal}`]();
128
129
 
@@ -207,11 +208,7 @@ const Modal = {
207
208
  const { barConfig } = options;
208
209
  options.style = {
209
210
  position: 'absolute',
210
- height: `${
211
- window.innerHeight -
212
- (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
213
- (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
214
- }px`,
211
+ height: `${Modal.Data[idModal].getHeight()}px`,
215
212
  width: `${slideMenuWidth}px`,
216
213
  // 'overflow-x': 'hidden',
217
214
  // overflow: 'visible', // required for tooltip
@@ -239,11 +236,7 @@ const Modal = {
239
236
  if (this.Data[_idModal].slideMenu && this.Data[_idModal].slideMenu.id === idModal)
240
237
  this.Data[_idModal].slideMenu.callBack();
241
238
  }
242
- s(`.${idModal}`).style.height = `${
243
- window.innerHeight -
244
- (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
245
- (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
246
- }px`;
239
+ s(`.${idModal}`).style.height = `${Modal.Data[idModal].getHeight()}px`;
247
240
  if (s(`.main-body-top`)) {
248
241
  if (Modal.mobileModal()) {
249
242
  if (s(`.btn-menu-${idModal}`).classList.contains('hide') && collapseSlideMenuWidth !== slideMenuWidth)
@@ -753,9 +746,12 @@ const Modal = {
753
746
  s(`.main-btn-${results[currentKeyBoardSearchBoxIndex].routerId}`).click();
754
747
  Modal.removeModal(searchBoxHistoryId);
755
748
  };
756
-
749
+ let boxHistoryDelayRender = 0;
757
750
  const searchBoxHistoryOpen = async () => {
758
- if (!s(`.${id}`)) {
751
+ if (boxHistoryDelayRender) return;
752
+ boxHistoryDelayRender = 1000;
753
+ setTimeout(() => (boxHistoryDelayRender = 0));
754
+ if (!s(`.${searchBoxHistoryId}`)) {
759
755
  const { barConfig } = await Themes[Css.currentTheme]();
760
756
  barConfig.buttons.maximize.disabled = true;
761
757
  barConfig.buttons.minimize.disabled = true;
@@ -763,7 +759,7 @@ const Modal = {
763
759
  barConfig.buttons.menu.disabled = true;
764
760
  barConfig.buttons.close.disabled = false;
765
761
  await Modal.Render({
766
- id,
762
+ id: searchBoxHistoryId,
767
763
  barConfig,
768
764
  title: html`<div class="search-box-recent-title">
769
765
  ${renderViewTitle({
@@ -964,6 +960,7 @@ const Modal = {
964
960
  heightBottomBar: originHeightBottomBar,
965
961
  barMode: options.barMode,
966
962
  observer: true,
963
+ disableBoxShadow: true,
967
964
  });
968
965
  const maxWidthInputSearchBox = 450;
969
966
  const paddingInputSearchBox = 5;
@@ -985,12 +982,7 @@ const Modal = {
985
982
  s(`.top-bar-search-box`).style.top = `${
986
983
  (originHeightTopBar - s(`.top-bar-search-box`).clientHeight) / 2
987
984
  }px`;
988
- if (this.Data[id].slideMenu)
989
- s(`.${id}`).style.height = `${
990
- window.innerHeight -
991
- (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
992
- (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
993
- }px`;
985
+ if (this.Data[id].slideMenu) s(`.${id}`).style.height = `${Modal.Data[id].getHeight()}px`;
994
986
  };
995
987
  Responsive.Event[`view-${id}`]();
996
988
  Keyboard.instanceMultiPressKey({
@@ -1119,9 +1111,7 @@ const Modal = {
1119
1111
  if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
1120
1112
  // <div class="in fll right-offset-menu-bottom-bar" style="height: 100%"></div>
1121
1113
  // s(`.right-offset-menu-bottom-bar`).style.width = `${window.innerWidth - slideMenuWidth}px`;
1122
- s(`.${id}`).style.top = `${
1123
- window.innerHeight - (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
1124
- }px`;
1114
+ s(`.${id}`).style.top = `${Modal.Data[id].getTop()}px`;
1125
1115
  };
1126
1116
  Responsive.Event[`view-${id}`]();
1127
1117
  }
@@ -1293,11 +1283,7 @@ const Modal = {
1293
1283
  s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1294
1284
  s(`.btn-restore-${id}`).style.display !== 'none'
1295
1285
  ? `${window.innerHeight}px`
1296
- : `${
1297
- window.innerHeight -
1298
- (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
1299
- (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
1300
- }px`;
1286
+ : `${Modal.Data[id].getHeight()}px`;
1301
1287
 
1302
1288
  if (
1303
1289
  s(`.main-body-btn-ui-close`).classList.contains('hide') &&
@@ -1405,7 +1391,11 @@ const Modal = {
1405
1391
  }
1406
1392
  </style>
1407
1393
  ${renderStyleTag(`style-${idModal}`, `.${idModal}`, options)}
1408
- <div class="fix ${options && options.class ? options.class : ''} modal box-shadow ${idModal}">
1394
+ <div
1395
+ class="fix ${options && options.class ? options.class : ''} modal ${options.disableBoxShadow
1396
+ ? ''
1397
+ : 'box-shadow'} ${idModal}"
1398
+ >
1409
1399
  <div class="abs modal-handle-${idModal}"></div>
1410
1400
  <div class="in modal-html-${idModal}">
1411
1401
  <div class="stq bar-default-modal bar-default-modal-${idModal}">
@@ -1918,11 +1908,7 @@ const Modal = {
1918
1908
  if (s(`.btn-restore-${idModal}`) && s(`.btn-restore-${idModal}`).style.display !== 'none') {
1919
1909
  s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
1920
1910
  ? `${window.innerHeight}px`
1921
- : `${
1922
- window.innerHeight -
1923
- (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
1924
- (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
1925
- }px`;
1911
+ : `${Modal.Data[idModal].getHeight()}px`;
1926
1912
  }
1927
1913
  s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
1928
1914
  ? `0px`
package/src/index.js CHANGED
@@ -35,7 +35,7 @@ class Underpost {
35
35
  * @type {String}
36
36
  * @memberof Underpost
37
37
  */
38
- static version = 'v2.8.866';
38
+ static version = 'v2.8.867';
39
39
  /**
40
40
  * Repository cli API
41
41
  * @static
@@ -48,17 +48,17 @@ const Config = {
48
48
  if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });
49
49
  fs.writeFileSync(
50
50
  `${folder}/.env.production`,
51
- fs.readFileSync('./.env.production', 'utf8').replace('dd-default', deployId),
51
+ fs.readFileSync('./.env.production', 'utf8').replaceAll('dd-default', deployId),
52
52
  'utf8',
53
53
  );
54
54
  fs.writeFileSync(
55
55
  `${folder}/.env.development`,
56
- fs.readFileSync('./.env.development', 'utf8').replace('dd-default', deployId),
56
+ fs.readFileSync('./.env.development', 'utf8').replaceAll('dd-default', deployId),
57
57
  'utf8',
58
58
  );
59
59
  fs.writeFileSync(
60
60
  `${folder}/.env.test`,
61
- fs.readFileSync('./.env.test', 'utf8').replace('dd-default', deployId),
61
+ fs.readFileSync('./.env.test', 'utf8').replaceAll('dd-default', deployId),
62
62
  'utf8',
63
63
  );
64
64
  fs.writeFileSync(`${folder}/package.json`, fs.readFileSync('./package.json', 'utf8'), 'utf8');
@@ -562,16 +562,24 @@ const buildPortProxyRouter = (port, proxyRouter) => {
562
562
  // build router
563
563
  Object.keys(hosts).map((hostKey) => {
564
564
  let { host, path, target, proxy, peer } = hosts[hostKey];
565
- if (process.argv.includes('localhost') && process.env.NODE_ENV === 'development') host = `localhost`;
565
+ if (process.env.NODE_ENV === 'development') host = `localhost`;
566
+
567
+ if (!proxy.includes(port)) {
568
+ logger.warn('Proxy port not set on conf', { port, host, path, proxy, target });
569
+ if (process.env.NODE_ENV === 'production') {
570
+ logger.warn('Omitting host', { host, path, target });
571
+ return;
572
+ }
573
+ }
566
574
 
567
- if (!proxy.includes(port)) return;
568
575
  const absoluteHost = [80, 443].includes(port)
569
576
  ? `${host}${path === '/' ? '' : path}`
570
577
  : `${host}:${port}${path === '/' ? '' : path}`;
571
578
 
572
- if (process.argv.includes('localhost')) {
573
- if (!(absoluteHost in router)) router[absoluteHost] = target;
574
- } else router[absoluteHost] = target;
579
+ if (absoluteHost in router)
580
+ logger.warn('Overwrite: Absolute host already exists on router', { absoluteHost, target });
581
+
582
+ router[absoluteHost] = target;
575
583
  }); // order router
576
584
 
577
585
  if (Object.keys(router).length === 0) return router;
package/test/api.test.js CHANGED
@@ -21,12 +21,13 @@ const BASE_URL =
21
21
 
22
22
  describe(`GET 'Test' API Request `, async () => {
23
23
  {
24
- const url = `${BASE_URL}/test/youtube-id/?url=https://www.youtube.com/watch?v=o4f42SbyDMk`;
24
+ const youtubeId = '2aib-pmgUdQ';
25
+ const url = `${BASE_URL}/test/youtube-id/?url=https://www.youtube.com/watch?v=${youtubeId}`;
25
26
  it(`youtube id from raw youtube url`, async () => {
26
27
  logger.info('request info', { url });
27
28
  const res = await axios.get(url);
28
29
  logger.info('response', res.data);
29
- return expect(res.data.data).equal('o4f42SbyDMk');
30
+ return expect(res.data.data).equal(youtubeId);
30
31
  });
31
32
  }
32
33
  {
package/bin/cyberia0.js DELETED
@@ -1,78 +0,0 @@
1
- #! /usr/bin/env node
2
-
3
- import dotenv from 'dotenv';
4
- import { Command } from 'commander';
5
- import fs from 'fs-extra';
6
- import { pbcopy, shellExec } from '../src/server/process.js';
7
- import Jimp from 'jimp';
8
- import Underpost from '../src/index.js';
9
- import { loggerFactory } from '../src/server/logger.js';
10
- import { DataBaseProvider } from '../src/db/DataBaseProvider.js';
11
-
12
- dotenv.config();
13
-
14
- const logger = loggerFactory(import.meta);
15
-
16
- const deployId = process.env.DEFAULT_DEPLOY_ID;
17
- const host = process.env.DEFAULT_DEPLOY_HOST;
18
- const path = process.env.DEFAULT_DEPLOY_PATH;
19
-
20
- const confServerPath = `./engine-private/conf/${deployId}/conf.server.json`;
21
- const confServer = JSON.parse(fs.readFileSync(confServerPath, 'utf8'));
22
- const { db } = confServer[host][path];
23
-
24
- logger.info('env', {
25
- deployId,
26
- host,
27
- path,
28
- db,
29
- });
30
-
31
- await DataBaseProvider.load({
32
- apis: ['object-layer'],
33
- host,
34
- path,
35
- db,
36
- });
37
-
38
- const ObjectLayer = DataBaseProvider.instance[`${host}${path}`].mongoose.models.ObjectLayer;
39
-
40
- const program = new Command();
41
-
42
- program.name('cyberia').description(`content generator cli ${Underpost.version}`).version(Underpost.version);
43
-
44
- const pngDirectoryIteratorByObjectLayerType = async (
45
- objectLayerType = 'skin',
46
- callback = ({ path, objectLayerType, objectLayerId, direction, frame }) => {},
47
- ) => {
48
- for (const objectLayerId of await fs.readdir(`./src/client/public/cyberia/assets/${objectLayerType}`)) {
49
- for (const direction of await fs.readdir(
50
- `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}`,
51
- )) {
52
- const dirFolder = `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}/${direction}`;
53
- if (!fs.statSync(dirFolder).isDirectory()) continue;
54
- for (const frame of await fs.readdir(dirFolder)) {
55
- const imageFilePath = `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}/${direction}/${frame}`;
56
- await callback({ path: imageFilePath, objectLayerType, objectLayerId, direction, frame });
57
- }
58
- }
59
- }
60
- };
61
-
62
- program
63
- .command('ol')
64
- .option('--import [object-layer-type]', 'Import object layer from type storage png image')
65
- .action(async (options = { import: false }) => {
66
- if (options.import) {
67
- await pngDirectoryIteratorByObjectLayerType(
68
- options.import,
69
- async ({ path, objectLayerType, objectLayerId, direction, frame }) => {
70
- console.log(path, { objectLayerType, objectLayerId, direction, frame });
71
- },
72
- );
73
- }
74
- await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
75
- })
76
- .description('Object layer management');
77
-
78
- program.parse();