underpost 2.7.93 → 2.8.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.
Files changed (34) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/bin/deploy.js +39 -0
  3. package/bin/index.js +1 -1
  4. package/docker-compose.yml +1 -1
  5. package/package.json +4 -3
  6. package/src/api/core/core.service.js +3 -5
  7. package/src/api/user/user.model.js +1 -1
  8. package/src/api/user/user.service.js +22 -21
  9. package/src/client/components/core/Account.js +142 -124
  10. package/src/client/components/core/Auth.js +94 -1
  11. package/src/client/components/core/Css.js +1 -1
  12. package/src/client/components/core/Docs.js +1 -1
  13. package/src/client/components/core/LogIn.js +8 -1
  14. package/src/client/components/core/LogOut.js +3 -2
  15. package/src/client/components/core/Modal.js +11 -7
  16. package/src/client/components/core/Panel.js +16 -3
  17. package/src/client/components/core/PanelForm.js +1 -0
  18. package/src/client/components/core/Scroll.js +35 -3
  19. package/src/client/components/core/SignUp.js +2 -5
  20. package/src/client/components/core/SocketIo.js +2 -0
  21. package/src/client/components/core/Translate.js +4 -0
  22. package/src/client/components/core/Validator.js +9 -2
  23. package/src/client/components/core/VanillaJs.js +4 -1
  24. package/src/client/components/default/LogInDefault.js +2 -23
  25. package/src/client/components/default/LogOutDefault.js +3 -5
  26. package/src/client/services/user/user.service.js +9 -1
  27. package/src/client/ssr/body/CacheControl.js +1 -1
  28. package/src/client/sw/default.sw.js +10 -4
  29. package/src/server/client-build.js +22 -21
  30. package/src/server/client-icons.js +12 -2
  31. package/src/server/conf.js +2 -1
  32. package/src/server/network.js +5 -1
  33. package/src/server/ssl.js +2 -2
  34. package/src/server/valkey.js +125 -0
@@ -79,7 +79,7 @@ const Docs = {
79
79
  icon: html`<i class="fa-brands fa-osi"></i>`,
80
80
  text: 'Source Docs',
81
81
  url: function () {
82
- return `${getProxyPath()}docs/engine/2.7.93`;
82
+ return `${getProxyPath()}docs/engine/2.8.0`;
83
83
  },
84
84
  },
85
85
  {
@@ -1,6 +1,7 @@
1
1
  import { CoreService } from '../../services/core/core.service.js';
2
2
  import { FileService } from '../../services/file/file.service.js';
3
3
  import { UserService } from '../../services/user/user.service.js';
4
+ import { Auth } from './Auth.js';
4
5
  import { BtnIcon } from './BtnIcon.js';
5
6
  import { EventsUI } from './EventsUI.js';
6
7
  import { Input } from './Input.js';
@@ -102,7 +103,13 @@ const LogIn = {
102
103
  if ('model' in inputData) body[inputData.model] = s(`.${inputData.id}`).value;
103
104
  }
104
105
  const result = await UserService.post({ id: 'auth', body });
105
- if (result.status === 'success') this.Trigger(result.data);
106
+ if (result.status === 'success') {
107
+ await Auth.sessionIn(result);
108
+ setTimeout(() => {
109
+ if (s(`.modal-log-in`)) s(`.btn-close-modal-log-in`).click();
110
+ if (s(`.modal-sign-up`)) s(`.btn-close-modal-sign-up`).click();
111
+ });
112
+ }
106
113
  if (result.status === 'error' && result.message.match('attempts')) {
107
114
  htmls(`.login-attempt-warn-value`, result.message.split(':')[1]);
108
115
  s(`.login-attempt-warn-container`).classList.remove('hide');
@@ -1,3 +1,4 @@
1
+ import { Auth } from './Auth.js';
1
2
  import { BtnIcon } from './BtnIcon.js';
2
3
  import { LogIn } from './LogIn.js';
3
4
  import { Translate } from './Translate.js';
@@ -37,9 +38,9 @@ const LogOut = {
37
38
  },
38
39
  Render: async function () {
39
40
  setTimeout(() => {
40
- s('.btn-log-out').onclick = (e) => {
41
+ s('.btn-log-out').onclick = async (e) => {
41
42
  e.preventDefault();
42
- LogOut.Trigger();
43
+ await Auth.sessionOut();
43
44
  };
44
45
  });
45
46
  // Translate.Render('confirm-logout')
@@ -87,6 +87,8 @@ const Modal = {
87
87
  onObserverListener: {},
88
88
  onClickListener: {},
89
89
  onExpandUiListener: {},
90
+ onBarUiOpen: {},
91
+ onBarUiClose: {},
90
92
  query: options.query ? `${window.location.search}` : undefined,
91
93
  };
92
94
  if (options && 'mode' in options) {
@@ -286,6 +288,8 @@ const Modal = {
286
288
  s(`.modal-menu`).style.top = '0px';
287
289
  s(`.main-body-btn-container`).style.top = '50px';
288
290
  s(`.main-body`).style.top = '0px';
291
+ for (const event of Object.keys(Modal.Data[idModal].onBarUiClose))
292
+ Modal.Data[idModal].onBarUiClose[event]();
289
293
  } else {
290
294
  s(`.main-body-btn-ui-close`).classList.remove('hide');
291
295
  s(`.main-body-btn-ui-open`).classList.add('hide');
@@ -296,6 +300,8 @@ const Modal = {
296
300
  s(`.slide-menu-top-bar`).classList.remove('hide');
297
301
  s(`.bottom-bar`).classList.remove('hide');
298
302
  s(`.main-body`).style.top = `${options.heightTopBar}px`;
303
+ for (const event of Object.keys(Modal.Data[idModal].onBarUiOpen))
304
+ Modal.Data[idModal].onBarUiOpen[event]();
299
305
  }
300
306
  Responsive.Event[`slide-menu-modal-menu`]();
301
307
  Object.keys(this.Data).map((_idModal) => {
@@ -1321,7 +1327,6 @@ const Modal = {
1321
1327
  case 'slide-menu-right':
1322
1328
  case 'slide-menu-left':
1323
1329
  const backMenuButtonEvent = async () => {
1324
- if (location.pathname !== getProxyPath()) setPath(getProxyPath());
1325
1330
  if (s(`.menu-btn-container-children`)) htmls(`.menu-btn-container-children`, '');
1326
1331
  // htmls(`.nav-title-display-${'modal-menu'}`, html`<i class="fas fa-home"></i> ${Translate.Render('home')}`);
1327
1332
  htmls(`.nav-title-display-${'modal-menu'}`, html``);
@@ -1340,8 +1345,7 @@ const Modal = {
1340
1345
  backMenuButtonEvent();
1341
1346
  }
1342
1347
  s(`.btn-close-modal-menu`).click();
1343
- if (window.location.pathname !== (getProxyPath() === '/' ? getProxyPath() : `${getProxyPath()}/`))
1344
- setPath(getProxyPath());
1348
+ setPath(getProxyPath());
1345
1349
  setDocTitle({ ...options.RouterInstance, route: '' });
1346
1350
  };
1347
1351
  EventsUI.onClick(`.btn-icon-menu-back`, backMenuButtonEvent);
@@ -1535,7 +1539,7 @@ const Modal = {
1535
1539
  Responsive.Event['h-ui-hide-' + idModal] = () => {
1536
1540
  setTimeout(() => {
1537
1541
  if (!s(`.${idModal}`) || !s(`.main-body-btn-ui-close`)) return;
1538
- if (s(`.btn-restore-${idModal}`).style.display !== 'none') {
1542
+ if (s(`.btn-restore-${idModal}`) && s(`.btn-restore-${idModal}`).style.display !== 'none') {
1539
1543
  s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
1540
1544
  ? `${window.innerHeight}px`
1541
1545
  : `${
@@ -1543,10 +1547,10 @@ const Modal = {
1543
1547
  (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
1544
1548
  (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
1545
1549
  }px`;
1546
- s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
1547
- ? `0px`
1548
- : `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
1549
1550
  }
1551
+ s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
1552
+ ? `0px`
1553
+ : `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
1550
1554
  });
1551
1555
  };
1552
1556
  Responsive.Event['h-ui-hide-' + idModal]();
@@ -372,13 +372,26 @@ const Panel = {
372
372
  } else {
373
373
  Responsive.Event[`${idPanel}-responsive`] = () => {
374
374
  if (s(`.${idPanel}-form-container`))
375
- s(`.${idPanel}-form-container`).style.maxHeight = `${
376
- window.innerHeight - heightTopBar - heightBottomBar
377
- }px`;
375
+ s(`.${idPanel}-form-container`).style.maxHeight =
376
+ options.route === 'home' &&
377
+ s(`.${idPanel}-form-body`) &&
378
+ !s(`.${idPanel}-form-body`).classList.contains('hide') &&
379
+ !s(`.main-body-btn-ui-open`).classList.contains('hide')
380
+ ? `${window.innerHeight}px`
381
+ : `${window.innerHeight - heightTopBar - heightBottomBar}px`;
378
382
  };
379
383
  Responsive.Event[`${idPanel}-responsive`]();
380
384
  }
381
385
  };
386
+ if (options.route === 'home') {
387
+ Modal.Data['modal-menu'].onBarUiClose[`${idPanel}-responsive`] = () => {
388
+ resizeParentModal();
389
+ };
390
+
391
+ Modal.Data['modal-menu'].onBarUiOpen[`${idPanel}-responsive`] = () => {
392
+ resizeParentModal();
393
+ };
394
+ }
382
395
  setTimeout(resizeParentModal);
383
396
  if (options.route) {
384
397
  RouterEvents[options.parentIdModal] = ({ route }) => {
@@ -113,6 +113,7 @@ const PanelForm = {
113
113
  filesData: () => PanelForm.Data[idPanel].filesData,
114
114
  scrollClassContainer: options.scrollClassContainer ? options.scrollClassContainer : 'main-body',
115
115
  titleIcon,
116
+ route: options.route,
116
117
  formContainerClass: 'session-in-log-in',
117
118
  onClick: async function ({ payload }) {
118
119
  if (options.route) {
@@ -1,4 +1,5 @@
1
1
  import { borderChar } from './Css.js';
2
+ import { Modal } from './Modal.js';
2
3
  import { append, s } from './VanillaJs.js';
3
4
 
4
5
  const Scroll = {
@@ -17,7 +18,7 @@ const Scroll = {
17
18
  scrollHandler: async function () {
18
19
  for (const selector in Scroll.data) await Scroll.data[selector].callback(Scroll.getScrollPosition(selector));
19
20
  },
20
- addEvent: function (selector = '', callback = () => {}) {
21
+ addEvent: function (selector = '', callback = (position = 0) => {}) {
21
22
  Scroll.data[selector].callback = callback;
22
23
  },
23
24
  removeEvent: function (selector) {
@@ -30,6 +31,13 @@ const Scroll = {
30
31
  behavior: options.behavior || 'smooth',
31
32
  });
32
33
  },
34
+ topRefreshEvents: {},
35
+ addTopRefreshEvent: function (options = { id: '', callback: () => {}, condition: () => {} }) {
36
+ this.topRefreshEvents[options.id] = options;
37
+ },
38
+ removeTopRefreshEvent: function (id = '') {
39
+ delete this.topRefreshEvents[id];
40
+ },
33
41
  pullTopRefresh: function () {
34
42
  append(
35
43
  'body',
@@ -68,6 +76,15 @@ const Scroll = {
68
76
  });
69
77
 
70
78
  document.addEventListener('touchmove', (e) => {
79
+ if (
80
+ !Object.keys(Scroll.topRefreshEvents).find((event) => Scroll.topRefreshEvents[event].condition()) ||
81
+ (!s(`.btn-bar-center-icon-close`).classList.contains('hide') &&
82
+ !s(
83
+ `.btn-icon-menu-mode-${Modal.Data['modal-menu'].options.mode !== 'slide-menu-right' ? 'left' : 'right'}`,
84
+ ).classList.contains('hide'))
85
+ )
86
+ return;
87
+
71
88
  const touchY = e.touches[0].clientY;
72
89
  const touchDiff = touchY - touchstartY;
73
90
 
@@ -87,11 +104,26 @@ const Scroll = {
87
104
  // console.warn('touchend');
88
105
  s(`.pull-refresh-icon-container`).style.top = '-60px';
89
106
  if (reload) {
90
- location.reload();
91
- // console.warn('reload');
107
+ for (const event of Object.keys(Scroll.topRefreshEvents))
108
+ if (Scroll.topRefreshEvents[event].condition()) Scroll.topRefreshEvents[event].callback();
92
109
  }
93
110
  reload = false;
94
111
  });
112
+ Scroll.addTopRefreshEvent({
113
+ id: 'main-body',
114
+ callback: () => {
115
+ location.reload();
116
+ },
117
+ condition: () => {
118
+ return (
119
+ s('.main-body') &&
120
+ s('.main-body').scrollTop === 0 &&
121
+ !Object.keys(Modal.Data).find(
122
+ (idModal) => !['modal-menu', 'main-body', 'bottom-bar', 'main-body-top'].includes(idModal),
123
+ )
124
+ );
125
+ },
126
+ });
95
127
  },
96
128
  };
97
129
 
@@ -1,8 +1,8 @@
1
1
  import { UserService } from '../../services/user/user.service.js';
2
+ import { Auth } from './Auth.js';
2
3
  import { BtnIcon } from './BtnIcon.js';
3
4
  import { EventsUI } from './EventsUI.js';
4
5
  import { Input } from './Input.js';
5
- import { LogIn } from './LogIn.js';
6
6
  import { NotificationManager } from './NotificationManager.js';
7
7
  import { Translate } from './Translate.js';
8
8
  import { Validator } from './Validator.js';
@@ -52,10 +52,7 @@ const SignUp = {
52
52
  : Translate.Render(`no-valid-register`),
53
53
  status: result.status,
54
54
  });
55
- if (result.status === 'success') {
56
- await this.Trigger(result.data);
57
- await LogIn.Trigger(result.data);
58
- }
55
+ if (result.status === 'success') await Auth.signUpToken(result);
59
56
  });
60
57
  s(`.btn-sign-up-i-have-account`).onclick = () => {
61
58
  s(`.main-btn-log-in`).click();
@@ -35,6 +35,8 @@ const SocketIo = {
35
35
  // forceNew: true,
36
36
  // reconnectionAttempts: 'Infinity',
37
37
  // timeout: 10000,
38
+ // withCredentials: true,
39
+ // autoConnect: 5000,
38
40
  transports: ['websocket', 'polling', 'flashsocket'],
39
41
  };
40
42
  // logger.error(`connect options:`, JSON.stringify(connectOptions, null, 4));
@@ -106,6 +106,10 @@ const TranslateCore = {
106
106
  en: 'Enter your WhatsApp number, including your country code.',
107
107
  es: 'Número de WhatsApp, recuerda colocar el código de tu país',
108
108
  };
109
+ Translate.Data['¿'] = {
110
+ en: '',
111
+ es: '¿',
112
+ };
109
113
  Translate.Data['color-copy'] = { es: 'color copiado en el portapapeles', en: 'color copied to clipboard' };
110
114
  Translate.Data['pallet-colors'] = { en: 'pallet colors', es: 'paleta de colores' };
111
115
  Translate.Data['fullscreen'] = { en: 'Fullscreen', es: 'Pantalla completa' };
@@ -88,11 +88,18 @@ const Validator = {
88
88
 
89
89
  return async () => {
90
90
  let errorMessage = '';
91
+ const errorKeys = [];
92
+ const successKeys = [];
91
93
  for (const validatorKey of Object.keys(validatorFunction)) {
92
94
  const result = await validatorFunction[validatorKey]();
93
- if (result && result.errorMessage) errorMessage += result.errorMessage;
95
+ if (result && result.errorMessage) {
96
+ errorMessage += result.errorMessage;
97
+ errorKeys.push(validatorKey);
98
+ } else {
99
+ successKeys.push(validatorKey);
100
+ }
94
101
  }
95
- return { errorMessage };
102
+ return { errorMessage, errorKeys, successKeys };
96
103
  };
97
104
  },
98
105
  };
@@ -148,7 +148,10 @@ const pasteData = () => new Promise((resolve) => navigator.clipboard.readText().
148
148
  * history.
149
149
  * @memberof VanillaJS
150
150
  */
151
- const setPath = (path = '/', stateStorage = {}, title = '') => history.pushState(stateStorage, title, path);
151
+ const setPath = (path = '/', stateStorage = {}, title = '') => {
152
+ if (window.location.pathname === path || window.location.pathname === `${path}/`) return;
153
+ return history.pushState(stateStorage, title, path);
154
+ };
152
155
 
153
156
  /**
154
157
  * The function `getQueryParams` extracts query parameters from the current URL and returns them as an
@@ -7,35 +7,14 @@ import { ElementsDefault } from './ElementsDefault.js';
7
7
  const LogInDefault = async function () {
8
8
  LogIn.Event['LogInDefault'] = async (options) => {
9
9
  const { token, user } = options;
10
-
11
- if (token) {
12
- localStorage.setItem('jwt', token);
13
- Auth.setToken(token);
14
- }
15
10
  ElementsDefault.Data.user.main.model.user = user;
16
-
17
11
  s(`.main-btn-log-in`).style.display = 'none';
18
12
  s(`.main-btn-sign-up`).style.display = 'none';
19
13
  s(`.main-btn-log-out`).style.display = null;
20
14
  s(`.main-btn-account`).style.display = null;
21
-
22
- if (s(`.modal-log-in`)) s(`.btn-close-modal-log-in`).click();
23
- if (s(`.modal-sign-up`)) s(`.btn-close-modal-sign-up`).click();
24
15
  };
25
- const token = localStorage.getItem('jwt');
26
- if (token) {
27
- Auth.setToken(token);
28
- const result = await UserService.get({ id: 'auth' });
29
- if (result.status === 'success' && result.data) {
30
- const user = result.data;
31
- await LogIn.Trigger({
32
- token,
33
- user,
34
- });
35
- } else localStorage.removeItem('jwt');
36
- } else {
37
- // Anon
38
- }
16
+ const { user } = await Auth.sessionIn();
17
+ ElementsDefault.Data.user.main.model.user = user;
39
18
  };
40
19
 
41
20
  export { LogInDefault };
@@ -6,8 +6,9 @@ import { s } from '../core/VanillaJs.js';
6
6
  import { ElementsDefault } from './ElementsDefault.js';
7
7
 
8
8
  const LogOutDefault = async function () {
9
- LogOut.Event['LogOutDefault'] = async () => {
10
- localStorage.removeItem('jwt');
9
+ LogOut.Event['LogOutDefault'] = async (result = { user: { _id: '' } }) => {
10
+ ElementsDefault.Data.user.main.model.user = result.user;
11
+
11
12
  s(`.main-btn-log-out`).style.display = 'none';
12
13
  s(`.main-btn-account`).style.display = 'none';
13
14
  s(`.main-btn-log-in`).style.display = null;
@@ -15,9 +16,6 @@ const LogOutDefault = async function () {
15
16
  if (s(`.modal-log-out`)) s(`.btn-close-modal-log-out`).click();
16
17
  if (s(`.modal-account`)) s(`.btn-close-modal-account`).click();
17
18
 
18
- ElementsDefault.Data.user.main.model.user = { _id: '' };
19
- Auth.deleteToken();
20
-
21
19
  NotificationManager.Push({
22
20
  html: Translate.Render(`success-logout`),
23
21
  status: 'success',
@@ -8,6 +8,14 @@ logger.info('Load service');
8
8
 
9
9
  const endpoint = 'user';
10
10
 
11
+ const UserMock = {
12
+ default: {
13
+ username: 'guest',
14
+ email: `guest@${location.hostname}`,
15
+ role: 'guest',
16
+ },
17
+ };
18
+
11
19
  const UserService = {
12
20
  post: (options = { id: '', body: {} }) =>
13
21
  new Promise((resolve, reject) =>
@@ -86,4 +94,4 @@ const UserService = {
86
94
  ),
87
95
  };
88
96
 
89
- export { UserService };
97
+ export { UserService, UserMock };
@@ -109,6 +109,6 @@ SrrComponent = ({ ttiLoadTimeLimit }) => {
109
109
  const CacheControl = ${CacheControl};
110
110
  CacheControl({ ttiLoadTimeLimit: ${ttiLoadTimeLimit ? ttiLoadTimeLimit : 1000 * 70 * 1} });
111
111
  </script>
112
- <div class="clean-cache-container">v2.7.93</div>
112
+ <div class="clean-cache-container">v2.8.0</div>
113
113
  `;
114
114
  };
@@ -64,10 +64,16 @@ self.addEventListener('fetch', (event) => {
64
64
  } catch (error) {
65
65
  console.error('Error opening cache for pre cached page', event.request.url, error);
66
66
  try {
67
- const cache = await caches.open(CACHE_NAME);
68
- const preCachedResponse = await cache.match(`${PROXY_PATH === '/' ? '' : PROXY_PATH}/offline/index.html`);
69
- if (!preCachedResponse) throw new Error(error.message);
70
- return preCachedResponse;
67
+ if (event.request.method.toUpperCase() === 'GET') {
68
+ const cache = await caches.open(CACHE_NAME);
69
+ const preCachedResponse = await cache.match(`${PROXY_PATH === '/' ? '' : PROXY_PATH}/offline/index.html`);
70
+ if (!preCachedResponse) throw new Error(error.message);
71
+ return preCachedResponse;
72
+ }
73
+ const response = new Response(JSON.stringify({ status: 'error', message: 'offline test response' }));
74
+ // response.status = 200;
75
+ response.headers.set('Content-Type', 'application/json');
76
+ return response;
71
77
  } catch (error) {
72
78
  console.error('Error opening cache for offline page', event.request.url, error);
73
79
  const response = new Response(JSON.stringify({ status: 'error', message: error.message }));
@@ -700,28 +700,7 @@ root file where the route starts, such as index.js, app.js, routes.js, etc ... *
700
700
 
701
701
  await swaggerAutoGen({ openapi: '3.0.0' })(outputFile, routes, doc);
702
702
  }
703
- if (!enableLiveRebuild && process.argv.includes('zip')) {
704
- logger.warn('build zip', rootClientPath);
705
-
706
- if (!fs.existsSync('./build')) fs.mkdirSync('./build');
707
-
708
- const zip = new AdmZip();
709
- const files = await fs.readdir(rootClientPath, { recursive: true });
710
-
711
- for (const relativePath of files) {
712
- const filePath = dir.resolve(`${rootClientPath}/${relativePath}`);
713
- if (!fs.lstatSync(filePath).isDirectory()) {
714
- const folder = dir.relative(`public/${host}${path}`, dir.dirname(filePath));
715
- zip.addLocalFile(filePath, folder);
716
- }
717
- }
718
-
719
- const buildId = `${host}-${path.replaceAll('/', '')}`;
720
703
 
721
- logger.warn('write zip', `./build/${buildId}.zip`);
722
-
723
- zip.writeZip(`./build/${buildId}.zip`);
724
- }
725
704
  if (client) {
726
705
  let PRE_CACHED_RESOURCES = [];
727
706
 
@@ -792,6 +771,28 @@ root file where the route starts, such as index.js, app.js, routes.js, etc ... *
792
771
  );
793
772
  }
794
773
  }
774
+ if (!enableLiveRebuild && process.argv.includes('zip')) {
775
+ logger.warn('build zip', rootClientPath);
776
+
777
+ if (!fs.existsSync('./build')) fs.mkdirSync('./build');
778
+
779
+ const zip = new AdmZip();
780
+ const files = await fs.readdir(rootClientPath, { recursive: true });
781
+
782
+ for (const relativePath of files) {
783
+ const filePath = dir.resolve(`${rootClientPath}/${relativePath}`);
784
+ if (!fs.lstatSync(filePath).isDirectory()) {
785
+ const folder = dir.relative(`public/${host}${path}`, dir.dirname(filePath));
786
+ zip.addLocalFile(filePath, folder);
787
+ }
788
+ }
789
+
790
+ const buildId = `${host}-${path.replaceAll('/', '')}`;
791
+
792
+ logger.warn('write zip', `./build/${buildId}.zip`);
793
+
794
+ zip.writeZip(`./build/${buildId}.zip`);
795
+ }
795
796
  }
796
797
  }
797
798
  };
@@ -3,8 +3,9 @@ import { favicons } from 'favicons';
3
3
  // import textToImage from 'text-to-image';
4
4
  import { loggerFactory } from './logger.js';
5
5
  import fs from 'fs-extra';
6
- import { png3x } from 'font-awesome-assets';
7
6
  import { getCapVariableName, s4 } from '../client/components/core/CommonJs.js';
7
+ import { FileFactory } from '../api/file/file.service.js';
8
+ import { svg, png, png3x } from 'font-awesome-assets';
8
9
 
9
10
  const logger = loggerFactory(import.meta);
10
11
 
@@ -148,4 +149,13 @@ const buildIcons = async ({
148
149
  }
149
150
  };
150
151
 
151
- export { buildIcons, buildTextImg, defaultBaseTextImgOptions, faBase64Png, getBufferPngText };
152
+ const getDefaultProfileImageId = async (File) => {
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 };
@@ -583,7 +583,7 @@ const validateTemplatePath = (absolutePath = '') => {
583
583
  const confServer = DefaultConf.server[host][path];
584
584
  const confClient = DefaultConf.client[client];
585
585
  const confSsr = DefaultConf.ssr[ssr];
586
- const clients = Object.keys(confClient).concat(['core', 'test', 'default']);
586
+ const clients = Object.keys(confClient).concat(['core', 'test', 'default', 'user']);
587
587
 
588
588
  if (absolutePath.match('src/api') && !confServer.apis.find((p) => absolutePath.match(`src/api/${p}/`))) {
589
589
  return false;
@@ -935,6 +935,7 @@ const maintenanceMiddleware = (req, res, port, proxyRouter) => {
935
935
 
936
936
  const setUpProxyMaintenanceServer = ({ deployGroupId }) => {
937
937
  shellExec(`pm2 kill`);
938
+ shellExec(`node bin/deploy valkey-service`);
938
939
  const proxyDeployId = fs.readFileSync(`./engine-private/deploy/${deployGroupId}.proxy`, 'utf8').trim();
939
940
  shellExec(`node bin/deploy conf ${proxyDeployId} production`);
940
941
  shellExec(`node bin/deploy run ${proxyDeployId} maintenance`);
@@ -74,6 +74,10 @@ const saveRuntimeRouter = async () => {
74
74
  const host = process.env.DEFAULT_DEPLOY_HOST;
75
75
  const path = process.env.DEFAULT_DEPLOY_PATH;
76
76
  const confServerPath = `./engine-private/conf/${deployId}/conf.server.json`;
77
+ if (!deployId || !host || !path) {
78
+ logger.warn('default deploy instance not found');
79
+ return;
80
+ }
77
81
  const confServer = JSON.parse(fs.readFileSync(confServerPath, 'utf8'));
78
82
  const { db } = confServer[host][path];
79
83
 
@@ -97,7 +101,7 @@ const saveRuntimeRouter = async () => {
97
101
  port: networkRouter[_host][_path].port,
98
102
  apis: networkRouter[_host][_path].apis,
99
103
  };
100
- const instance = await Instance.findOne({ deployId: body.deployId, port: body.port });
104
+ const instance = await Instance.findOne({ deployId: body.deployId, host: _host, path: _path });
101
105
  if (instance) {
102
106
  await Instance.findByIdAndUpdate(instance._id, body);
103
107
  } else {
package/src/server/ssl.js CHANGED
@@ -50,8 +50,8 @@ const buildSSL = async (host) => {
50
50
 
51
51
  fs.writeFileSync(`./engine-private/ssl/${host}/_ca_bundle.crt`, ca, 'utf8');
52
52
  fs.writeFileSync(`./engine-private/ssl/${host}/_ca_full_bundle.crt`, caFull, 'utf8');
53
-
54
- fs.removeSync(`${sslPath}/${folderHost}`);
53
+ // TODO: no repeat folderHost match
54
+ // fs.removeSync(`${sslPath}/${folderHost}`);
55
55
  return true;
56
56
  }
57
57
  }