underpost 2.89.45 → 2.90.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/src/cli/run.js CHANGED
@@ -7,6 +7,7 @@
7
7
  import { daemonProcess, getTerminalPid, openTerminal, pbcopy, shellCd, shellExec } from '../server/process.js';
8
8
  import {
9
9
  awaitDeployMonitor,
10
+ buildKindPorts,
10
11
  Config,
11
12
  getNpmRootPath,
12
13
  getUnderpostRootPath,
@@ -68,6 +69,13 @@ class UnderpostRun {
68
69
  * @property {boolean} terminal - Whether to open a terminal.
69
70
  * @property {number} devProxyPortOffset - The port offset for the development proxy.
70
71
  * @property {boolean} hostNetwork - Whether to use host networking.
72
+ * @property {string} requestsMemory - The memory request for the container.
73
+ * @property {string} requestsCpu - The CPU request for the container.
74
+ * @property {string} limitsMemory - The memory limit for the container.
75
+ * @property {string} limitsCpu - The CPU limit for the container.
76
+ * @property {string} resourceTemplateId - The resource template ID.
77
+ * @property {boolean} expose - Whether to expose the service.
78
+ * @property {boolean} etcHosts - Whether to modify /etc/hosts.
71
79
  * @property {string} confServerPath - The configuration server path.
72
80
  * @property {string} underpostRoot - The root path of the Underpost installation.
73
81
  * @memberof UnderpostRun
@@ -100,6 +108,13 @@ class UnderpostRun {
100
108
  terminal: false,
101
109
  devProxyPortOffset: 0,
102
110
  hostNetwork: false,
111
+ requestsMemory: '',
112
+ requestsCpu: '',
113
+ limitsMemory: '',
114
+ limitsCpu: '',
115
+ resourceTemplateId: '',
116
+ expose: false,
117
+ etcHosts: false,
103
118
  confServerPath: '',
104
119
  underpostRoot: '',
105
120
  };
@@ -186,8 +201,8 @@ class UnderpostRun {
186
201
  * @param {Object} options - The default underpost runner options for customizing workflow
187
202
  * @memberof UnderpostRun
188
203
  */
189
- 'underpost-config': (path, options = UnderpostRun.DEFAULT_OPTION) => {
190
- UnderpostDeploy.API.configMap(path ?? 'production');
204
+ 'underpost-config': (path = '', options = UnderpostRun.DEFAULT_OPTION) => {
205
+ UnderpostDeploy.API.configMap(path ? path : 'production', options.namespace);
191
206
  },
192
207
  /**
193
208
  * @method gpu-env
@@ -224,7 +239,7 @@ class UnderpostRun {
224
239
  'dev-cluster': (path, options = UnderpostRun.DEFAULT_OPTION) => {
225
240
  const baseCommand = options.dev ? 'node bin' : 'underpost';
226
241
  const mongoHosts = ['mongodb-0.mongodb-service'];
227
- if (path !== 'expose') {
242
+ if (!options.expose) {
228
243
  shellExec(`${baseCommand} cluster${options.dev ? ' --dev' : ''} --reset`);
229
244
  shellExec(`${baseCommand} cluster${options.dev ? ' --dev' : ''}`);
230
245
 
@@ -253,7 +268,7 @@ class UnderpostRun {
253
268
  metadata: async (path, options = UnderpostRun.DEFAULT_OPTION) => {
254
269
  const ports = '6379,27017';
255
270
  shellExec(`node bin run kill '${ports}'`);
256
- shellExec(`node bin run dev-cluster --dev expose`, { async: true });
271
+ shellExec(`node bin run dev-cluster --dev --expose`, { async: true });
257
272
  console.log('Loading fordward services...');
258
273
  await timer(5000);
259
274
  shellExec(`node bin metadata --generate ${path}`);
@@ -502,7 +517,7 @@ class UnderpostRun {
502
517
  }
503
518
 
504
519
  const currentTraffic = isDeployRunnerContext(path, options)
505
- ? UnderpostDeploy.API.getCurrentTraffic(deployId)
520
+ ? UnderpostDeploy.API.getCurrentTraffic(deployId, { namespace: options.namespace })
506
521
  : '';
507
522
  let targetTraffic = currentTraffic ? (currentTraffic === 'blue' ? 'green' : 'blue') : '';
508
523
  if (targetTraffic) versions = targetTraffic;
@@ -517,10 +532,15 @@ class UnderpostRun {
517
532
  shellExec(
518
533
  `${baseCommand} deploy --kubeadm --disable-update-proxy ${deployId} ${env} --versions ${versions}${options.namespace ? ` --namespace ${options.namespace}` : ''}`,
519
534
  );
520
- if (!targetTraffic) targetTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId);
535
+ if (!targetTraffic)
536
+ targetTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId, { namespace: options.namespace });
521
537
  await UnderpostDeploy.API.monitorReadyRunner(deployId, env, targetTraffic);
522
538
  UnderpostDeploy.API.switchTraffic(deployId, env, targetTraffic);
523
- } else logger.info('current traffic', UnderpostDeploy.API.getCurrentTraffic(deployId));
539
+ } else
540
+ logger.info(
541
+ 'current traffic',
542
+ UnderpostDeploy.API.getCurrentTraffic(deployId, { namespace: options.namespace }),
543
+ );
524
544
  },
525
545
 
526
546
  /**
@@ -555,6 +575,190 @@ class UnderpostRun {
555
575
  shellExec(`node bin env clean`);
556
576
  },
557
577
 
578
+ /**
579
+ * @method get-proxy
580
+ * @description Retrieves and logs the HTTPProxy resources in the specified namespace using `kubectl get HTTPProxy`.
581
+ * @param {string} path - The input value, identifier, or path for the operation (used as an optional filter for the HTTPProxy resources).
582
+ * @param {Object} options - The default underpost runner options for customizing workflow
583
+ * @memberof UnderpostRun
584
+ */
585
+ 'get-proxy': async (path = '', options = UnderpostRun.DEFAULT_OPTION) => {
586
+ console.log(
587
+ shellExec(`kubectl get HTTPProxy -n ${options.namespace} ${path} -o yaml`, {
588
+ silent: true,
589
+ stdout: true,
590
+ })
591
+ .replaceAll(`blue`, `blue`.bgBlue.bold.black)
592
+ .replaceAll('green', 'green'.bgGreen.bold.black)
593
+ .replaceAll('Error', 'Error'.bold.red)
594
+ .replaceAll('error', 'error'.bold.red)
595
+ .replaceAll('ERROR', 'ERROR'.bold.red)
596
+ .replaceAll('Invalid', 'Invalid'.bold.red)
597
+ .replaceAll('invalid', 'invalid'.bold.red)
598
+ .replaceAll('INVALID', 'INVALID'.bold.red),
599
+ );
600
+ },
601
+
602
+ 'instance-promote': async (path, options = UnderpostRun.DEFAULT_OPTION) => {
603
+ const env = options.dev ? 'development' : 'production';
604
+ const baseCommand = options.dev ? 'node bin' : 'underpost';
605
+ const baseClusterCommand = options.dev ? ' --dev' : '';
606
+ let [deployId, id] = path.split(',');
607
+ const confInstances = JSON.parse(
608
+ fs.readFileSync(`./engine-private/conf/${deployId}/conf.instances.json`, 'utf8'),
609
+ );
610
+ for (const instance of confInstances) {
611
+ let {
612
+ id: _id,
613
+ host: _host,
614
+ path: _path,
615
+ image: _image,
616
+ fromPort: _fromPort,
617
+ toPort: _toPort,
618
+ cmd: _cmd,
619
+ volumes: _volumes,
620
+ metadata: _metadata,
621
+ } = instance;
622
+ if (id !== _id) continue;
623
+ const _deployId = `${deployId}-${_id}`;
624
+ const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(_deployId, {
625
+ hostTest: _host,
626
+ });
627
+ const targetTraffic = currentTraffic ? (currentTraffic === 'blue' ? 'green' : 'blue') : 'blue';
628
+ let proxyYaml =
629
+ UnderpostDeploy.API.baseProxyYamlFactory({ host: _host, env: options.tls ? 'production' : env, options }) +
630
+ UnderpostDeploy.API.deploymentYamlServiceFactory({
631
+ path: _path,
632
+ port: _fromPort,
633
+ // serviceId: deployId,
634
+ deployId: _deployId,
635
+ env,
636
+ deploymentVersions: [targetTraffic],
637
+ // pathRewritePolicy,
638
+ });
639
+ if (options.tls) {
640
+ shellExec(`sudo kubectl delete Certificate ${_host} -n ${options.namespace} --ignore-not-found`);
641
+ proxyYaml += UnderpostDeploy.API.buildCertManagerCertificate({ ...options, host: _host });
642
+ }
643
+ // console.log(proxyYaml);
644
+ shellExec(`kubectl delete HTTPProxy ${_host} --namespace ${options.namespace} --ignore-not-found`);
645
+ shellExec(
646
+ `kubectl apply -f - -n ${options.namespace} <<EOF
647
+ ${proxyYaml}
648
+ EOF
649
+ `,
650
+ { disableLog: true },
651
+ );
652
+ }
653
+ },
654
+
655
+ /**
656
+ * @method instance
657
+ * @param {string} path - The input value, identifier, or path for the operation (used as a comma-separated string containing workflow parameters).
658
+ * @param {Object} options - The default underpost runner options for customizing workflow
659
+ * @memberof UnderpostRun
660
+ */
661
+ instance: async (path = '', options = UnderpostRun.DEFAULT_OPTION) => {
662
+ const env = options.dev ? 'development' : 'production';
663
+ const baseCommand = options.dev ? 'node bin' : 'underpost';
664
+ const baseClusterCommand = options.dev ? ' --dev' : '';
665
+ let [deployId, id, replicas = 1] = path.split(',');
666
+ const confInstances = JSON.parse(
667
+ fs.readFileSync(`./engine-private/conf/${deployId}/conf.instances.json`, 'utf8'),
668
+ );
669
+ const etcHosts = [];
670
+ for (const instance of confInstances) {
671
+ let {
672
+ id: _id,
673
+ host: _host,
674
+ path: _path,
675
+ image: _image,
676
+ fromPort: _fromPort,
677
+ toPort: _toPort,
678
+ cmd: _cmd,
679
+ volumes: _volumes,
680
+ metadata: _metadata,
681
+ } = instance;
682
+ if (id !== _id) continue;
683
+ const _deployId = `${deployId}-${_id}`;
684
+ etcHosts.push(_host);
685
+ if (options.expose) continue;
686
+ // Examples images:
687
+ // `underpost/underpost-engine:${Underpost.version}`
688
+ // `localhost/rockylinux9-underpost:${Underpost.version}`
689
+ if (!_image) _image = `underpost/underpost-engine:${Underpost.version}`;
690
+
691
+ if (options.nodeName) {
692
+ shellExec(`sudo crictl pull ${_image}`);
693
+ } else {
694
+ shellExec(`docker pull ${_image}`);
695
+ shellExec(`sudo kind load docker-image ${_image}`);
696
+ }
697
+
698
+ const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(_deployId, {
699
+ hostTest: _host,
700
+ });
701
+
702
+ const targetTraffic = currentTraffic ? (currentTraffic === 'blue' ? 'green' : 'blue') : 'blue';
703
+ const podId = `${_deployId}-${env}-${targetTraffic}`;
704
+ const ignorePods = UnderpostDeploy.API.get(podId).map((p) => p.NAME);
705
+ UnderpostDeploy.API.configMap(env, options.namespace);
706
+ shellExec(`kubectl delete service ${podId}-service --namespace ${options.namespace} --ignore-not-found`);
707
+ shellExec(`kubectl delete deployment ${podId} --namespace ${options.namespace} --ignore-not-found`);
708
+ for (const _volume of _volumes)
709
+ if (_volume.claimName)
710
+ UnderpostDeploy.API.deployVolume(_volume, {
711
+ namespace: options.namespace,
712
+ deployId: _deployId,
713
+ env,
714
+ version: targetTraffic,
715
+ nodeName: options.nodeName,
716
+ });
717
+ let deploymentYaml = `---
718
+ ${UnderpostDeploy.API.deploymentYamlPartsFactory({
719
+ deployId: _deployId,
720
+ env,
721
+ suffix: targetTraffic,
722
+ resources: UnderpostDeploy.API.resourcesFactory(options),
723
+ replicas,
724
+ image: _image,
725
+ namespace: options.namespace,
726
+ volumes: _volumes,
727
+ cmd: _cmd[env],
728
+ }).replace('{{ports}}', buildKindPorts(_fromPort, _toPort))}
729
+ `;
730
+ // console.log(deploymentYaml);
731
+ shellExec(
732
+ `kubectl apply -f - -n ${options.namespace} <<EOF
733
+ ${deploymentYaml}
734
+ EOF
735
+ `,
736
+ { disableLog: true },
737
+ );
738
+ const { ready, readyPods } = await UnderpostDeploy.API.monitorReadyRunner(
739
+ _deployId,
740
+ env,
741
+ targetTraffic,
742
+ ignorePods,
743
+ );
744
+
745
+ if (!ready) {
746
+ logger.error(`Deployment ${deployId} did not become ready in time.`);
747
+ return;
748
+ }
749
+ shellExec(
750
+ `${baseCommand} run${baseClusterCommand} --namespace ${options.namespace}` +
751
+ `${options.nodeName ? ` --node-name ${options.nodeName}` : ''}` +
752
+ `${options.tls ? ` --tls` : ''}` +
753
+ ` instance-promote '${path}'`,
754
+ );
755
+ }
756
+ if (options.etcHosts) {
757
+ const hostListenResult = UnderpostDeploy.API.etcHostFactory(etcHosts);
758
+ logger.info(hostListenResult.renderHosts);
759
+ }
760
+ },
761
+
558
762
  /**
559
763
  * @method ls-deployments
560
764
  * @description Retrieves and logs a table of Kubernetes deployments using `UnderpostDeploy.API.get`.
@@ -827,12 +1031,12 @@ class UnderpostRun {
827
1031
  if (!inputReplicas) inputReplicas = 1;
828
1032
  if (inputDeployId === 'dd') {
829
1033
  for (const deployId of fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(',')) {
830
- const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId);
1034
+ const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId, { namespace: options.namespace });
831
1035
  const targetTraffic = currentTraffic === 'blue' ? 'green' : 'blue';
832
1036
  UnderpostDeploy.API.switchTraffic(deployId, inputEnv, targetTraffic, inputReplicas);
833
1037
  }
834
1038
  } else {
835
- const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(inputDeployId);
1039
+ const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(inputDeployId, { namespace: options.namespace });
836
1040
  const targetTraffic = currentTraffic === 'blue' ? 'green' : 'blue';
837
1041
  UnderpostDeploy.API.switchTraffic(inputDeployId, inputEnv, targetTraffic, inputReplicas);
838
1042
  }
@@ -919,7 +1123,7 @@ class UnderpostRun {
919
1123
  const deployId = path;
920
1124
  const { validVersion } = UnderpostRepository.API.privateConfUpdate(deployId);
921
1125
  if (!validVersion) throw new Error('Version mismatch');
922
- const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId);
1126
+ const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId, { namespace: options.namespace });
923
1127
  const targetTraffic = currentTraffic === 'blue' ? 'green' : 'blue';
924
1128
  const env = 'production';
925
1129
  const ignorePods = UnderpostDeploy.API.get(`${deployId}-${env}-${targetTraffic}`).map((p) => p.NAME);
@@ -970,7 +1174,7 @@ class UnderpostRun {
970
1174
  envObj.DEV_PROXY_PORT_OFFSET = options.devProxyPortOffset;
971
1175
  writeEnv(envPath, envObj);
972
1176
  }
973
- shellExec(`node bin run dev-cluster expose`, { async: true });
1177
+ shellExec(`node bin run dev-cluster --expose`, { async: true });
974
1178
  {
975
1179
  const cmd = `npm run dev-api ${deployId} ${subConf} ${host} ${_path} ${clientHostPort}${options.tls ? ' tls' : ''}`;
976
1180
  options.terminal ? openTerminal(cmd) : shellExec(cmd, { async: true });
@@ -1061,7 +1265,7 @@ class UnderpostRun {
1061
1265
  }
1062
1266
  const success = await UnderpostTest.API.statusMonitor(podToMonitor);
1063
1267
  if (success) {
1064
- const versions = UnderpostDeploy.API.getCurrentTraffic(deployId) || 'blue';
1268
+ const versions = UnderpostDeploy.API.getCurrentTraffic(deployId, { namespace: options.namespace }) || 'blue';
1065
1269
  if (!node) node = os.hostname();
1066
1270
  shellExec(
1067
1271
  `${baseCommand} deploy${options.dev ? '' : ' --kubeadm'}${options.devProxyPortOffset ? ' --disable-deployment-proxy' : ''} --build-manifest --sync --info-router --replicas ${
@@ -25,9 +25,7 @@ const eventDateFactory = (event) =>
25
25
  const CalendarCore = {
26
26
  RenderStyle: async function () {},
27
27
  Data: {},
28
- Render: async function (
29
- options = { idModal: '', Elements: {}, heightTopBar: 50, heightBottomBar: 50, hiddenDates: [] },
30
- ) {
28
+ Render: async function (options = { idModal: '', Elements: {}, hiddenDates: [] }) {
31
29
  this.Data[options.idModal] = {
32
30
  data: [],
33
31
  originData: [],
@@ -36,8 +34,6 @@ const CalendarCore = {
36
34
  hiddenDates: options.hiddenDates ? options.hiddenDates : [],
37
35
  };
38
36
 
39
- const { heightTopBar, heightBottomBar } = options;
40
-
41
37
  const titleIcon = html`<i class="fas fa-calendar-alt"></i>`;
42
38
 
43
39
  const getPanelData = async () => {
@@ -234,8 +230,6 @@ const CalendarCore = {
234
230
  idPanel,
235
231
  parentIdModal: options.idModal,
236
232
  formData,
237
- heightTopBar,
238
- heightBottomBar,
239
233
  data: this.Data[options.idModal].data,
240
234
  formContainerClass: '',
241
235
  scrollClassContainer: `main-body-calendar-${options.idModal}`,
@@ -54,8 +54,8 @@ const Modal = {
54
54
  disableBoxShadow: false,
55
55
  },
56
56
  ) {
57
- if (options.heightBottomBar === undefined) options.heightBottomBar = 50;
58
- if (options.heightTopBar === undefined) options.heightTopBar = 50;
57
+ options.heightBottomBar = 50;
58
+ options.heightTopBar = 50;
59
59
  let originHeightBottomBar = options.heightBottomBar ? newInstance(options.heightBottomBar) : 0;
60
60
  let originHeightTopBar = options.heightTopBar ? newInstance(options.heightTopBar) : 0;
61
61
  let width = 300;
@@ -38,7 +38,7 @@ const Panel = {
38
38
  formObj.id = `${idPanel}-${formObj.id}`;
39
39
  return formObj;
40
40
  });
41
- const { scrollClassContainer, formData, data, heightTopBar, heightBottomBar } = options;
41
+ const { scrollClassContainer, formData, data } = options;
42
42
 
43
43
  const titleObj = formData.find((f) => f.panel && f.panel.type === 'title');
44
44
  const titleKey = titleObj ? titleObj.model : '';
@@ -21,8 +21,6 @@ const PanelForm = {
21
21
  instance: async function (
22
22
  options = {
23
23
  idPanel: '',
24
- heightTopBar: 50,
25
- heightBottomBar: 50,
26
24
  defaultUrlImage: '',
27
25
  Elements: {},
28
26
  parentIdModal: undefined,
@@ -31,7 +29,7 @@ const PanelForm = {
31
29
  firsUpdateEvent: async () => {},
32
30
  },
33
31
  ) {
34
- const { idPanel, heightTopBar, heightBottomBar, defaultUrlImage, Elements } = options;
32
+ const { idPanel, defaultUrlImage, Elements } = options;
35
33
 
36
34
  let prefixTags = [idPanel, 'public'];
37
35
  this.Data[idPanel] = {
@@ -101,8 +99,6 @@ const PanelForm = {
101
99
  await Panel.Render({
102
100
  idPanel,
103
101
  formData,
104
- heightTopBar,
105
- heightBottomBar,
106
102
  data,
107
103
  htmlFormHeader: options.htmlFormHeader,
108
104
  parentIdModal: options.parentIdModal,
@@ -40,8 +40,7 @@ const MenuDefault = {
40
40
  const RouterInstance = RouterDefault();
41
41
 
42
42
  const { barConfig } = await Themes[Css.currentTheme]();
43
- const heightTopBar = 50;
44
- const heightBottomBar = 50;
43
+
45
44
  const badgeNotificationMenuStyle = { top: '-33px', left: '24px' };
46
45
  const barMode = undefined; // 'top-bottom-bar';
47
46
  await Modal.Render({
@@ -221,8 +220,6 @@ const MenuDefault = {
221
220
  },
222
221
  mode: 'slide-menu',
223
222
  RouterInstance,
224
- heightTopBar,
225
- heightBottomBar,
226
223
  htmlMainBody: options.htmlMainBody,
227
224
  });
228
225
 
@@ -252,7 +249,7 @@ const MenuDefault = {
252
249
  `.style-lading-render`,
253
250
  html` <style>
254
251
  .landing-container {
255
- min-height: calc(100vh - ${heightTopBar + heightBottomBar}px);
252
+ min-height: calc(100vh - 100px);
256
253
  display: flex;
257
254
  /* align-items: center; */
258
255
  justify-content: center;
@@ -306,7 +303,9 @@ const MenuDefault = {
306
303
  padding: 2rem;
307
304
  border-radius: 12px;
308
305
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
309
- transition: transform 0.3s ease, box-shadow 0.3s ease;
306
+ transition:
307
+ transform 0.3s ease,
308
+ box-shadow 0.3s ease;
310
309
  opacity: 0;
311
310
  animation: fadeInUp 0.6s ease-out forwards;
312
311
  }
@@ -494,8 +493,6 @@ const MenuDefault = {
494
493
  mode: 'view',
495
494
  slideMenu: 'modal-menu',
496
495
  RouterInstance,
497
- heightTopBar,
498
- heightBottomBar,
499
496
  });
500
497
  });
501
498
 
@@ -515,8 +512,6 @@ const MenuDefault = {
515
512
  mode: 'view',
516
513
  slideMenu: 'modal-menu',
517
514
  RouterInstance,
518
- heightTopBar,
519
- heightBottomBar,
520
515
  });
521
516
  });
522
517
 
@@ -536,8 +531,6 @@ const MenuDefault = {
536
531
  mode: 'view',
537
532
  slideMenu: 'modal-menu',
538
533
  RouterInstance,
539
- heightTopBar,
540
- heightBottomBar,
541
534
  });
542
535
  });
543
536
 
@@ -562,8 +555,6 @@ const MenuDefault = {
562
555
  mode: 'view',
563
556
  slideMenu: 'modal-menu',
564
557
  RouterInstance,
565
- heightTopBar,
566
- heightBottomBar,
567
558
  });
568
559
  });
569
560
 
@@ -583,8 +574,6 @@ const MenuDefault = {
583
574
  mode: 'view',
584
575
  slideMenu: 'modal-menu',
585
576
  RouterInstance,
586
- heightTopBar,
587
- heightBottomBar,
588
577
  });
589
578
  });
590
579
 
@@ -605,8 +594,6 @@ const MenuDefault = {
605
594
  mode: 'view',
606
595
  slideMenu: 'modal-menu',
607
596
  RouterInstance,
608
- heightTopBar,
609
- heightBottomBar,
610
597
  });
611
598
  });
612
599
 
@@ -626,8 +613,6 @@ const MenuDefault = {
626
613
  mode: 'view',
627
614
  slideMenu: 'modal-menu',
628
615
  RouterInstance,
629
- heightTopBar,
630
- heightBottomBar,
631
616
  observer: true,
632
617
  });
633
618
  });
@@ -648,8 +633,6 @@ const MenuDefault = {
648
633
  mode: 'view',
649
634
  slideMenu: 'modal-menu',
650
635
  RouterInstance,
651
- heightTopBar,
652
- heightBottomBar,
653
636
  observer: true,
654
637
  });
655
638
  });
@@ -670,8 +653,6 @@ const MenuDefault = {
670
653
  mode: 'view',
671
654
  slideMenu: 'modal-menu',
672
655
  RouterInstance,
673
- heightTopBar,
674
- heightBottomBar,
675
656
  observer: true,
676
657
  });
677
658
  });
@@ -694,8 +675,6 @@ const MenuDefault = {
694
675
  setTimeout(async () => {
695
676
  await PanelForm.instance({
696
677
  idPanel: 'default-blog',
697
- heightTopBar,
698
- heightBottomBar,
699
678
  defaultUrlImage: `${getProxyPath()}android-chrome-96x96.png`,
700
679
  Elements: ElementsDefault,
701
680
  parentIdModal: idModal,
@@ -709,8 +688,6 @@ const MenuDefault = {
709
688
  mode: 'view',
710
689
  slideMenu: 'modal-menu',
711
690
  RouterInstance,
712
- heightTopBar,
713
- heightBottomBar,
714
691
  barMode,
715
692
  });
716
693
  });
@@ -732,8 +709,6 @@ const MenuDefault = {
732
709
  mode: 'view',
733
710
  slideMenu: 'modal-menu',
734
711
  RouterInstance,
735
- heightTopBar,
736
- heightBottomBar,
737
712
  barMode,
738
713
  });
739
714
  });
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.89.45';
38
+ static version = 'v2.90.0';
39
39
  /**
40
40
  * Repository cli API
41
41
  * @static
@@ -519,39 +519,21 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
519
519
 
520
520
  for (const ssrBodyComponent of confSSR[view.ssr].body) {
521
521
  const SrrComponent = await ssrFactory(`./src/client/ssr/body/${ssrBodyComponent}.js`);
522
- switch (ssrBodyComponent) {
523
- case 'UnderpostDefaultSplashScreen':
524
- case 'CyberiaDefaultSplashScreen':
525
- case 'NexodevSplashScreen':
526
- case 'DefaultSplashScreen':
527
- if (backgroundImage)
528
- ssrHeadComponents += SrrComponent({
529
- ...metadata,
530
- backgroundImage: (path === '/' ? path : `${path}/`) + backgroundImage,
531
- });
532
- else ssrHeadComponents += SrrComponent({ metadata });
533
- break;
534
-
535
- case 'CyberiaSplashScreenLore': {
522
+ if (ssrBodyComponent.match('SplashScreen')) {
523
+ if (backgroundImage)
536
524
  ssrBodyComponents += SrrComponent({
537
- ssrPath,
538
- host,
539
- path,
540
- ttiLoadTimeLimit,
525
+ ...metadata,
526
+ backgroundImage: (path === '/' ? path : `${path}/`) + backgroundImage,
541
527
  });
542
- break;
543
- }
544
-
545
- default:
546
- ssrBodyComponents += SrrComponent({
547
- ssrPath,
548
- host,
549
- path,
550
- ttiLoadTimeLimit,
551
- version: Underpost.version,
552
- });
553
- break;
554
- }
528
+ else ssrBodyComponents += SrrComponent({ metadata });
529
+ } else
530
+ ssrBodyComponents += SrrComponent({
531
+ ssrPath,
532
+ host,
533
+ path,
534
+ ttiLoadTimeLimit,
535
+ version: Underpost.version,
536
+ });
555
537
  }
556
538
  }
557
539
 
@@ -1,77 +0,0 @@
1
- function isPlainObject(obj) {
2
- return obj ? typeof obj === 'object' && Object.getPrototypeOf(obj) === Object.prototype : false;
3
- }
4
-
5
- const supportType = ['string', 'number', 'array', 'object', 'boolean', 'integer'];
6
-
7
- function getType(type) {
8
- if (!type) type = 'string';
9
- if (supportType.indexOf(type) !== -1) {
10
- return type;
11
- }
12
- return typeof type;
13
- }
14
-
15
- function isSchema(object) {
16
- if (supportType.indexOf(object.type) !== -1) {
17
- return true;
18
- }
19
- return false;
20
- }
21
-
22
- function handleSchema(json, schema) {
23
- Object.assign(schema, json);
24
- if (schema.type === 'object') {
25
- delete schema.properties;
26
- parse(json.properties, schema);
27
- }
28
- if (schema.type === 'array') {
29
- delete schema.items;
30
- schema.items = {};
31
- parse(json.items, schema.items);
32
- }
33
- }
34
-
35
- function handleArray(arr, schema) {
36
- schema.type = 'array';
37
- let props = (schema.items = {});
38
- parse(arr[0], props);
39
- }
40
-
41
- function handleObject(json, schema) {
42
- if (isSchema(json)) {
43
- return handleSchema(json, schema);
44
- }
45
- schema.type = 'object';
46
- schema.required = [];
47
- let props = (schema.properties = {});
48
- for (let key in json) {
49
- let item = json[key];
50
- let curSchema = (props[key] = {});
51
- if (key[0] === '*') {
52
- delete props[key];
53
- key = key.substr(1);
54
- schema.required.push(key);
55
- curSchema = props[key] = {};
56
- }
57
- parse(item, curSchema);
58
- }
59
- }
60
-
61
- function parse(json, schema) {
62
- if (Array.isArray(json)) {
63
- handleArray(json, schema);
64
- } else if (isPlainObject(json)) {
65
- handleObject(json, schema);
66
- } else {
67
- schema.type = getType(json);
68
- }
69
- }
70
-
71
- function ejs(data) {
72
- let JsonSchema = {};
73
- parse(data, JsonSchema);
74
- return JsonSchema;
75
- }
76
-
77
- export { ejs };