underpost 2.7.91 → 2.7.93

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.
Files changed (54) hide show
  1. package/bin/deploy.js +13 -11
  2. package/bin/file.js +1 -0
  3. package/bin/hwt.js +59 -0
  4. package/bin/index.js +1 -1
  5. package/conf.js +29 -5
  6. package/docker-compose.yml +1 -1
  7. package/package.json +133 -133
  8. package/src/client/Default.index.js +2 -1
  9. package/src/client/components/core/404.js +20 -0
  10. package/src/client/components/core/500.js +20 -0
  11. package/src/client/{ssr/common → components/core}/Alert.js +13 -11
  12. package/src/client/components/core/Docs.js +1 -1
  13. package/src/client/components/core/Modal.js +8 -6
  14. package/src/client/components/core/Scroll.js +65 -1
  15. package/src/client/components/core/Translate.js +21 -5
  16. package/src/client/components/core/VanillaJs.js +4 -1
  17. package/src/client/components/core/Worker.js +10 -11
  18. package/src/client/components/default/MenuDefault.js +69 -0
  19. package/src/client/components/default/RoutesDefault.js +2 -0
  20. package/src/client/public/default/plantuml/client-conf.svg +1 -1
  21. package/src/client/public/default/plantuml/client-schema.svg +1 -1
  22. package/src/client/public/default/plantuml/cron-schema.svg +1 -1
  23. package/src/client/public/default/plantuml/server-conf.svg +1 -1
  24. package/src/client/public/default/plantuml/server-schema.svg +1 -1
  25. package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
  26. package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
  27. package/src/client/ssr/Render.js +1 -6
  28. package/src/client/ssr/body/404.js +73 -0
  29. package/src/client/ssr/body/500.js +72 -0
  30. package/src/client/ssr/{components/body → body}/CacheControl.js +1 -1
  31. package/src/client/ssr/mailer/DefaultRecoverEmail.js +21 -0
  32. package/src/client/ssr/mailer/DefaultVerifyEmail.js +17 -0
  33. package/src/client/ssr/offline/NoNetworkConnection.js +67 -0
  34. package/src/client/ssr/pages/Test.js +198 -0
  35. package/src/client/sw/default.sw.js +43 -166
  36. package/src/mailer/EmailRender.js +2 -4
  37. package/src/mailer/MailerProvider.js +4 -1
  38. package/src/server/client-build.js +100 -74
  39. package/src/server/client-formatted.js +2 -4
  40. package/src/server/conf.js +40 -13
  41. package/src/server/proxy.js +0 -2
  42. package/src/server/runtime.js +38 -10
  43. package/src/client/ssr/common/SsrCore.js +0 -91
  44. package/src/client/ssr/common/Translate.js +0 -26
  45. package/src/client/ssr/common/Worker.js +0 -28
  46. package/src/client/ssr/components/head/PwaDefault.js +0 -60
  47. /package/src/client/ssr/{components/body → body}/DefaultSplashScreen.js +0 -0
  48. /package/src/client/ssr/{components/email → email}/DefaultRecoverEmail.js +0 -0
  49. /package/src/client/ssr/{components/email → email}/DefaultVerifyEmail.js +0 -0
  50. /package/src/client/ssr/{components/head → head}/Css.js +0 -0
  51. /package/src/client/ssr/{components/head → head}/DefaultScripts.js +0 -0
  52. /package/src/client/ssr/{components/head → head}/Production.js +0 -0
  53. /package/src/client/ssr/{components/head → head}/Pwa.js +0 -0
  54. /package/src/client/ssr/{components/head → head}/Seo.js +0 -0
@@ -827,6 +827,7 @@ const Modal = {
827
827
  heightTopBar: originHeightTopBar,
828
828
  heightBottomBar: originHeightBottomBar,
829
829
  barMode: options.barMode,
830
+ observer: true,
830
831
  });
831
832
  const maxWidthInputSearchBox = 450;
832
833
  const paddingInputSearchBox = 5;
@@ -1339,6 +1340,9 @@ const Modal = {
1339
1340
  backMenuButtonEvent();
1340
1341
  }
1341
1342
  s(`.btn-close-modal-menu`).click();
1343
+ if (window.location.pathname !== (getProxyPath() === '/' ? getProxyPath() : `${getProxyPath()}/`))
1344
+ setPath(getProxyPath());
1345
+ setDocTitle({ ...options.RouterInstance, route: '' });
1342
1346
  };
1343
1347
  EventsUI.onClick(`.btn-icon-menu-back`, backMenuButtonEvent);
1344
1348
  EventsUI.onClick(`.btn-icon-menu-mode`, () => {
@@ -1531,20 +1535,18 @@ const Modal = {
1531
1535
  Responsive.Event['h-ui-hide-' + idModal] = () => {
1532
1536
  setTimeout(() => {
1533
1537
  if (!s(`.${idModal}`) || !s(`.main-body-btn-ui-close`)) return;
1534
- s(`.${idModal}`).style.height =
1535
- s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1536
- s(`.btn-restore-${idModal}`).style.display !== 'none'
1538
+ if (s(`.btn-restore-${idModal}`).style.display !== 'none') {
1539
+ s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
1537
1540
  ? `${window.innerHeight}px`
1538
1541
  : `${
1539
1542
  window.innerHeight -
1540
1543
  (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
1541
1544
  (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
1542
1545
  }px`;
1543
- s(`.${idModal}`).style.top =
1544
- s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1545
- s(`.btn-restore-${idModal}`).style.display !== 'none'
1546
+ s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
1546
1547
  ? `0px`
1547
1548
  : `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
1549
+ }
1548
1550
  });
1549
1551
  };
1550
1552
  Responsive.Event['h-ui-hide-' + idModal]();
@@ -1,4 +1,5 @@
1
- import { s } from './VanillaJs.js';
1
+ import { borderChar } from './Css.js';
2
+ import { append, s } from './VanillaJs.js';
2
3
 
3
4
  const Scroll = {
4
5
  data: {},
@@ -29,6 +30,69 @@ const Scroll = {
29
30
  behavior: options.behavior || 'smooth',
30
31
  });
31
32
  },
33
+ pullTopRefresh: function () {
34
+ append(
35
+ 'body',
36
+ html` <style>
37
+ .pull-refresh-icon-container {
38
+ height: 60px;
39
+ width: 100%;
40
+ z-index: 10;
41
+ transition: 0.3s;
42
+ left: 0px;
43
+ }
44
+ .pull-refresh-icon {
45
+ width: 60px;
46
+ height: 60px;
47
+ margin: auto;
48
+ color: white;
49
+ font-size: 30px;
50
+ }
51
+ </style>
52
+ ${borderChar(2, 'black', [' .pull-refresh-icon-container'])}
53
+ <div style="top: -60px" class="abs pull-refresh-icon-container">
54
+ <div class="in pull-refresh-icon">
55
+ <div class="abs center"><i class="fa-solid fa-arrows-rotate"></i></div>
56
+ </div>
57
+ </div>`,
58
+ );
59
+
60
+ let touchstartY = 0;
61
+ let reload = false;
62
+ const minHeightDragReload = 3;
63
+ const maxHeightDragReload = 20;
64
+
65
+ document.addEventListener('touchstart', (e) => {
66
+ touchstartY = e.touches[0].clientY;
67
+ // console.warn('touchstart', touchstartY);
68
+ });
69
+
70
+ document.addEventListener('touchmove', (e) => {
71
+ const touchY = e.touches[0].clientY;
72
+ const touchDiff = touchY - touchstartY;
73
+
74
+ // console.warn('touchDiff', touchDiff, maxHeightDragReload);
75
+
76
+ if (touchDiff > maxHeightDragReload)
77
+ s(`.pull-refresh-icon-container`).style.top = 60 + maxHeightDragReload + 'px';
78
+ else s(`.pull-refresh-icon-container`).style.top = 60 + touchDiff + 'px';
79
+
80
+ if (touchDiff > minHeightDragReload && window.scrollY === 0) {
81
+ reload = true;
82
+ } else {
83
+ reload = false;
84
+ }
85
+ });
86
+ document.addEventListener('touchend', (e) => {
87
+ // console.warn('touchend');
88
+ s(`.pull-refresh-icon-container`).style.top = '-60px';
89
+ if (reload) {
90
+ location.reload();
91
+ // console.warn('reload');
92
+ }
93
+ reload = false;
94
+ });
95
+ },
32
96
  };
33
97
 
34
98
  export { Scroll };
@@ -66,11 +66,7 @@ const Translate = {
66
66
 
67
67
  const TranslateCore = {
68
68
  Init: async function () {
69
- s('html').lang = localStorage.getItem('lang')
70
- ? localStorage.getItem('lang')
71
- : getLang() && getLang().match('es')
72
- ? 'es'
73
- : 'en';
69
+ s('html').lang = getLang();
74
70
  Translate.Data = {
75
71
  ...Translate.Data,
76
72
  isEmpty: {
@@ -252,6 +248,26 @@ const TranslateCore = {
252
248
  en: 'Comments',
253
249
  es: 'Comentarios',
254
250
  },
251
+ ['server-maintenance']: {
252
+ en: "The server is under maintenance <br> we'll be back soon.",
253
+ es: 'El servidor está en mantenimiento <br> volveremos pronto.',
254
+ },
255
+ ['no-internet-connection']: {
256
+ en: 'No internet connection <br> verify your network',
257
+ es: 'Sin conexión a internet <br> verifica tu red',
258
+ },
259
+ ['page-not-found']: {
260
+ en: 'Page not found',
261
+ es: 'Página no encontrada',
262
+ },
263
+ ['page-broken']: {
264
+ es: 'Algo salio mal',
265
+ en: 'Something went wrong',
266
+ },
267
+ ['back']: {
268
+ en: 'Back to <br> homepage',
269
+ es: 'Volver a <br> la pagina principal',
270
+ },
255
271
  },
256
272
  };
257
273
  Translate.Data['warning-upload-no-selects-file'] = {
@@ -428,7 +428,10 @@ const isDevInstance = () => location.origin.match('localhost') && location.port;
428
428
 
429
429
  const getDataFromInputFile = async (file) => Array.from(new Uint8Array(await file.arrayBuffer()));
430
430
 
431
- const getLang = () => navigator.language || navigator.userLanguage;
431
+ const getLang = () =>
432
+ (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang)
433
+ .slice(0, 2)
434
+ .toLowerCase();
432
435
 
433
436
  export {
434
437
  s,
@@ -13,6 +13,15 @@ const Worker = {
13
13
  devMode: () => location.origin.match('localhost') || location.origin.match('127.0.0.1'),
14
14
  instance: async function ({ router, render }) {
15
15
  logger.warn('Init');
16
+ window.ononline = async () => {
17
+ logger.warn('ononline');
18
+ };
19
+ window.onoffline = async () => {
20
+ logger.warn('onoffline');
21
+ };
22
+ setTimeout(() => {
23
+ if ('onLine' in navigator && navigator.onLine) window.ononline();
24
+ });
16
25
  navigator.serviceWorker.addEventListener('controllerchange', () => {
17
26
  logger.info('The controller of current browsing context has changed.');
18
27
  });
@@ -48,12 +57,9 @@ const Worker = {
48
57
  // channel.postMessage({ title: 'Hello from Client broadcast message' });
49
58
  // channel.close();
50
59
  });
60
+ this.RouterInstance = router();
51
61
  const isInstall = await this.status();
52
62
  if (!isInstall) await this.install();
53
- else await this.update();
54
- await this.updateOfflineSrc();
55
- // else if (location.hostname === 'localhost') await this.update();
56
- this.RouterInstance = router();
57
63
  await render();
58
64
  LoadRouter(this.RouterInstance);
59
65
  LoadingAnimation.removeSplashScreen();
@@ -212,13 +218,6 @@ const Worker = {
212
218
  }
213
219
  });
214
220
  },
215
- updateOfflineSrc: async function () {
216
- try {
217
- await fetch(`${getProxyPath()}offline.html`);
218
- } catch (error) {
219
- logger.error('error');
220
- }
221
- },
222
221
  // TODO: GPS management
223
222
  RenderSetting: async function () {
224
223
  setTimeout(() => {
@@ -17,6 +17,8 @@ import { Badge } from '../core/Badge.js';
17
17
  import { Docs } from '../core/Docs.js';
18
18
  import { Recover } from '../core/Recover.js';
19
19
  import { DefaultManagement } from '../../services/default/default.management.js';
20
+ import { Page500 } from '../core/500.js';
21
+ import { Page404 } from '../core/404.js';
20
22
 
21
23
  const MenuDefault = {
22
24
  Data: {},
@@ -136,6 +138,28 @@ const MenuDefault = {
136
138
  handleContainerClass: 'handle-btn-container',
137
139
  tooltipHtml: await Badge.Render(buildBadgeToolTipMenuOption('default-management')),
138
140
  })}
141
+ ${await BtnIcon.Render({
142
+ class: 'in wfa main-btn-menu main-btn-404 hide',
143
+ label: renderMenuLabel({
144
+ icon: html`<i class="fa-solid fa-triangle-exclamation"></i>`,
145
+ text: html`<span class="menu-label-text">${Translate.Render('404')}</span>`,
146
+ }),
147
+ attrs: `data-id="404"`,
148
+ tabHref: `${getProxyPath()}404`,
149
+ handleContainerClass: 'handle-btn-container',
150
+ tooltipHtml: await Badge.Render(buildBadgeToolTipMenuOption('404')),
151
+ })}
152
+ ${await BtnIcon.Render({
153
+ class: 'in wfa main-btn-menu main-btn-500 hide',
154
+ label: renderMenuLabel({
155
+ icon: html`<i class="fa-solid fa-circle-exclamation"></i>`,
156
+ text: html`<span class="menu-label-text">${Translate.Render('500')}</span>`,
157
+ }),
158
+ attrs: `data-id="500"`,
159
+ tabHref: `${getProxyPath()}500`,
160
+ handleContainerClass: 'handle-btn-container',
161
+ tooltipHtml: await Badge.Render(buildBadgeToolTipMenuOption('500')),
162
+ })}
139
163
  </div>
140
164
  `,
141
165
  barConfig: newInstance(barConfig),
@@ -148,6 +172,7 @@ const MenuDefault = {
148
172
  return '';
149
173
  },
150
174
  mode: 'slide-menu',
175
+ RouterInstance,
151
176
  heightTopBar,
152
177
  heightBottomBar,
153
178
  htmlMainBody: options?.htmlMainBody ? options.htmlMainBody : undefined,
@@ -383,6 +408,50 @@ const MenuDefault = {
383
408
  heightBottomBar,
384
409
  });
385
410
  });
411
+
412
+ EventsUI.onClick(`.main-btn-404`, async () => {
413
+ const { barConfig } = await Themes[Css.currentTheme]();
414
+ await Modal.Render({
415
+ id: 'modal-404',
416
+ route: '404',
417
+ barConfig,
418
+ title: renderViewTitle({
419
+ icon: html`<i class="fa-solid fa-triangle-exclamation"></i>`,
420
+ text: Translate.Render('404'),
421
+ }),
422
+ html: async () => await Page404.Render({ idModal: 'modal-404' }),
423
+ handleType: 'bar',
424
+ maximize: true,
425
+ mode: 'view',
426
+ slideMenu: 'modal-menu',
427
+ RouterInstance,
428
+ heightTopBar,
429
+ heightBottomBar,
430
+ observer: true,
431
+ });
432
+ });
433
+
434
+ EventsUI.onClick(`.main-btn-500`, async () => {
435
+ const { barConfig } = await Themes[Css.currentTheme]();
436
+ await Modal.Render({
437
+ id: 'modal-500',
438
+ route: '500',
439
+ barConfig,
440
+ title: renderViewTitle({
441
+ icon: html`<i class="fa-solid fa-circle-exclamation"></i>`,
442
+ text: Translate.Render('500'),
443
+ }),
444
+ html: async () => await Page500.Render({ idModal: 'modal-500' }),
445
+ handleType: 'bar',
446
+ maximize: true,
447
+ mode: 'view',
448
+ slideMenu: 'modal-menu',
449
+ RouterInstance,
450
+ heightTopBar,
451
+ heightBottomBar,
452
+ observer: true,
453
+ });
454
+ });
386
455
  },
387
456
  };
388
457
 
@@ -36,6 +36,8 @@ const RoutesDefault = () => {
36
36
  render: () => s(`.main-btn-default-management`).click(),
37
37
  translateTitle: true,
38
38
  },
39
+ '/404': { title: '404 Not Found', render: () => s(`.main-btn-404`).click() },
40
+ '/500': { title: '500 Server Error', render: () => s(`.main-btn-500`).click() },
39
41
  };
40
42
  };
41
43