underpost 2.8.871 → 2.8.873

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 (81) hide show
  1. package/.env.development +2 -1
  2. package/.env.production +2 -1
  3. package/.env.test +2 -1
  4. package/.github/workflows/ghpkg.ci.yml +1 -1
  5. package/.github/workflows/npmpkg.ci.yml +1 -1
  6. package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -1
  7. package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
  8. package/.github/workflows/release.cd.yml +2 -2
  9. package/README.md +66 -36
  10. package/bin/build.js +4 -0
  11. package/bin/deploy.js +4 -0
  12. package/cli.md +88 -87
  13. package/conf.js +2 -1
  14. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  15. package/manifests/deployment/dd-test-development/deployment.yaml +138 -0
  16. package/manifests/deployment/dd-test-development/proxy.yaml +26 -0
  17. package/package.json +6 -3
  18. package/src/api/core/core.router.js +2 -1
  19. package/src/api/default/default.controller.js +6 -1
  20. package/src/api/default/default.router.js +6 -2
  21. package/src/api/default/default.service.js +10 -1
  22. package/src/api/file/file.router.js +2 -1
  23. package/src/api/test/test.router.js +1 -1
  24. package/src/api/user/postman_collection.json +216 -0
  25. package/src/api/user/user.controller.js +25 -60
  26. package/src/api/user/user.model.js +29 -7
  27. package/src/api/user/user.router.js +6 -3
  28. package/src/api/user/user.service.js +80 -32
  29. package/src/cli/baremetal.js +33 -3
  30. package/src/cli/cloud-init.js +11 -0
  31. package/src/cli/deploy.js +5 -2
  32. package/src/cli/index.js +1 -0
  33. package/src/cli/lxd.js +7 -0
  34. package/src/cli/repository.js +1 -0
  35. package/src/cli/run.js +18 -5
  36. package/src/cli/ssh.js +20 -6
  37. package/src/client/components/core/Account.js +2 -1
  38. package/src/client/components/core/AgGrid.js +30 -8
  39. package/src/client/components/core/Auth.js +98 -55
  40. package/src/client/components/core/CalendarCore.js +3 -4
  41. package/src/client/components/core/CommonJs.js +1 -2
  42. package/src/client/components/core/Content.js +2 -1
  43. package/src/client/components/core/Css.js +2 -1
  44. package/src/client/components/core/CssCore.js +2 -1
  45. package/src/client/components/core/Docs.js +4 -4
  46. package/src/client/components/core/FileExplorer.js +3 -3
  47. package/src/client/components/core/JoyStick.js +2 -2
  48. package/src/client/components/core/LoadingAnimation.js +2 -2
  49. package/src/client/components/core/LogIn.js +16 -23
  50. package/src/client/components/core/LogOut.js +5 -1
  51. package/src/client/components/core/Logger.js +4 -1
  52. package/src/client/components/core/Modal.js +17 -27
  53. package/src/client/components/core/ObjectLayerEngineModal.js +2 -1
  54. package/src/client/components/core/Pagination.js +207 -0
  55. package/src/client/components/core/Panel.js +3 -11
  56. package/src/client/components/core/PanelForm.js +6 -15
  57. package/src/client/components/core/Recover.js +2 -2
  58. package/src/client/components/core/Router.js +205 -33
  59. package/src/client/components/core/SignUp.js +1 -2
  60. package/src/client/components/core/Stream.js +1 -1
  61. package/src/client/components/core/VanillaJs.js +0 -83
  62. package/src/client/components/core/Worker.js +2 -2
  63. package/src/client/components/default/LogInDefault.js +0 -6
  64. package/src/client/components/default/LogOutDefault.js +0 -16
  65. package/src/client/components/default/MenuDefault.js +4 -3
  66. package/src/client/components/default/RoutesDefault.js +3 -2
  67. package/src/client/services/core/core.service.js +6 -2
  68. package/src/client/services/default/default.management.js +115 -18
  69. package/src/client/services/default/default.service.js +9 -4
  70. package/src/client/services/user/user.management.js +6 -0
  71. package/src/client/services/user/user.service.js +11 -4
  72. package/src/client/ssr/head/DefaultScripts.js +1 -0
  73. package/src/index.js +24 -2
  74. package/src/runtime/lampp/Lampp.js +89 -2
  75. package/src/runtime/xampp/Xampp.js +48 -1
  76. package/src/server/auth.js +518 -155
  77. package/src/server/conf.js +19 -1
  78. package/src/server/runtime.js +62 -221
  79. package/src/server/ssl.js +1 -2
  80. package/src/server/ssr.js +85 -0
  81. package/src/server/valkey.js +2 -1
@@ -2,8 +2,9 @@
2
2
  // https://www.ag-grid.com/javascript-data-grid/themes/
3
3
 
4
4
  import { ThemeEvents, darkTheme } from './Css.js';
5
- import { append, getProxyPath, htmls, s } from './VanillaJs.js';
6
- import * as agGrid from 'ag-grid-community';
5
+ import { append, htmls, s } from './VanillaJs.js';
6
+ import { getProxyPath } from './Router.js';
7
+ import './Pagination.js';
7
8
 
8
9
  const AgGrid = {
9
10
  grids: {},
@@ -14,6 +15,9 @@ const AgGrid = {
14
15
  // Grid Options: Contains all of the grid configurations
15
16
  const gridOptions = {
16
17
  // Row Data: The data to be displayed.
18
+ pagination: false, // Disabled by default, will be handled by the management view
19
+ // paginationPageSize: 100,
20
+ // suppressPaginationPanel: true, // We are using our own custom pagination component
17
21
  // rowHeight: 60,
18
22
  enableCellChangeFlash: true,
19
23
  defaultColDef: {
@@ -23,6 +27,12 @@ const AgGrid = {
23
27
  filter: true,
24
28
  autoHeight: true,
25
29
  },
30
+ rowClassRules: {
31
+ 'row-new-highlight': (params) => {
32
+ // a temporary flag we can set on new rows to highlight them
33
+ return params.data && params.data._new;
34
+ },
35
+ },
26
36
  // domLayout: 'autoHeight', || 'normal'
27
37
  // Column Definitions: Defines & controls grid columns.
28
38
  columnDefs: options?.gridOptions?.rowData?.[0]
@@ -48,13 +58,17 @@ const AgGrid = {
48
58
  }
49
59
  };
50
60
  });
61
+ const usePagination = options?.usePagination;
51
62
  return html`
52
- <div
53
- class="${id} ${this.theme}${options?.darkTheme ? `-dark` : ''}"
54
- style="${options?.style
55
- ? Object.keys(options.style).map((styleKey) => `${styleKey}: ${options.style[styleKey]}; `)
56
- : 'height: 500px'}"
57
- ></div>
63
+ <div>
64
+ <div
65
+ class="${id} ${this.theme}${options?.darkTheme ? `-dark` : ''}"
66
+ style="${options?.style
67
+ ? Object.keys(options.style).map((styleKey) => `${styleKey}: ${options.style[styleKey]}; `)
68
+ : 'height: 500px'}"
69
+ ></div>
70
+ ${usePagination ? `<ag-pagination id="ag-pagination-${id}"></ag-pagination>` : ''}
71
+ </div>
58
72
  `;
59
73
  },
60
74
  RenderStyle: async function (
@@ -136,6 +150,10 @@ const AgGrid = {
136
150
  ${darkTheme
137
151
  ? html`
138
152
  <style>
153
+ .ag-row.row-new-highlight {
154
+ background-color: #6d68ff !important;
155
+ transition: background-color 1s ease-out;
156
+ }
139
157
  .ag-cell-data-changed,
140
158
  .ag-cell-data-changed-animation {
141
159
  background-color: #6d68ff !important;
@@ -145,6 +163,10 @@ const AgGrid = {
145
163
  </style>
146
164
  `
147
165
  : html`<style>
166
+ .ag-row.row-new-highlight {
167
+ background-color: #d0eaf8 !important;
168
+ transition: background-color 1s ease-out;
169
+ }
148
170
  .ag-cell-data-changed,
149
171
  .ag-cell-data-changed-animation {
150
172
  background-color: #d1d1d1 !important;
@@ -8,12 +8,14 @@ import { SignUp } from './SignUp.js';
8
8
  import { Translate } from './Translate.js';
9
9
  import { s } from './VanillaJs.js';
10
10
 
11
- const logger = loggerFactory(import.meta);
11
+ const logger = loggerFactory(import.meta, { trace: true });
12
12
 
13
13
  const token = Symbol('token');
14
14
 
15
15
  const guestToken = Symbol('guestToken');
16
16
 
17
+ const refreshTimeout = Symbol('refreshTimeout');
18
+
17
19
  const Auth = {
18
20
  [token]: '',
19
21
  [guestToken]: '',
@@ -35,50 +37,65 @@ const Auth = {
35
37
  getGuestToken: function () {
36
38
  return this[guestToken];
37
39
  },
38
- // jwt
39
40
  getJWT: function () {
40
- return `Bearer ${this.getToken() ? this.getToken() : this.getGuestToken()}`;
41
+ if (Auth.getToken()) return `Bearer ${Auth.getToken()}`;
42
+ if (Auth.getGuestToken()) return `Bearer ${Auth.getGuestToken()}`;
43
+ return '';
41
44
  },
42
- signUpToken: async function (
43
- result = {
44
- data: {
45
- token: '',
46
- user: null,
47
- },
48
- },
49
- ) {
45
+ decodeJwt: function (token) {
50
46
  try {
51
- localStorage.setItem('jwt', result.data.token);
52
- await SignUp.Trigger(result.data);
53
- await Auth.sessionIn();
54
- } catch (error) {
55
- logger.error(error);
56
- localStorage.removeItem('jwt');
47
+ return JSON.parse(atob(token.split('.')[1]));
48
+ } catch (e) {
49
+ return null;
57
50
  }
58
51
  },
52
+ scheduleTokenRefresh: function () {
53
+ if (this[refreshTimeout]) {
54
+ clearTimeout(this[refreshTimeout]);
55
+ }
56
+
57
+ const currentToken = Auth.getToken();
58
+ if (!currentToken) return;
59
+
60
+ const payload = Auth.decodeJwt(currentToken);
61
+ if (!payload || !payload.refreshExpiresAt) return;
62
+
63
+ const expiresIn = payload.refreshExpiresAt - Date.now();
64
+ const refreshBuffer = 2 * 60 * 1000; // 2 minutes
65
+ const refreshIn = expiresIn - refreshBuffer;
66
+
67
+ logger.info(`Token refresh in ${refreshIn / (1000 * 60)} minutes`);
68
+
69
+ if (refreshIn <= 0) return; // Already expired or close to it
70
+
71
+ this[refreshTimeout] = setTimeout(async () => {
72
+ const { data, status } = await UserService.get({ id: 'auth' });
73
+ if (status === 'success') {
74
+ logger.info('Refreshed access token.');
75
+ Auth.setToken(data.token);
76
+ localStorage.setItem('jwt', data.token);
77
+ Auth.scheduleTokenRefresh();
78
+ } else Auth.sessionOut();
79
+ }, refreshIn);
80
+ },
59
81
  sessionIn: async function (userServicePayload) {
60
82
  try {
61
83
  const token = userServicePayload?.data?.token ? userServicePayload.data.token : localStorage.getItem('jwt');
62
-
63
84
  if (token) {
64
- this.setToken(token);
85
+ Auth.setToken(token);
86
+
65
87
  const result = userServicePayload
66
- ? userServicePayload
67
- : await (async () => {
68
- const _result = await UserService.get({ id: 'auth' });
69
- return {
70
- status: _result.status,
71
- message: _result.message,
72
- data: {
73
- user: _result.data,
74
- },
75
- };
76
- })();
88
+ ? userServicePayload // From login/signup
89
+ : await UserService.get({ id: 'auth' });
90
+
77
91
  const { status, data, message } = result;
78
92
  if (status === 'success') {
93
+ Auth.setToken(data.token);
79
94
  localStorage.setItem('jwt', token);
95
+ Auth.renderSessionUI();
80
96
  await LogIn.Trigger({ user: data.user });
81
97
  await Account.updateForm(data.user);
98
+ Auth.scheduleTokenRefresh();
82
99
  return { user: data.user };
83
100
  }
84
101
  if (message && message.match('expired'))
@@ -89,41 +106,67 @@ const Auth = {
89
106
  status: 'warning',
90
107
  });
91
108
  });
92
- return await Auth.sessionOut();
93
109
  }
94
-
95
- // anon guest session
96
- this.deleteToken();
110
+ Auth.deleteToken();
97
111
  localStorage.removeItem('jwt');
98
- let guestToken = localStorage.getItem('jwt.g');
99
112
 
100
- if (!guestToken) {
101
- const result = await UserService.post({ id: 'guest' });
102
- localStorage.setItem('jwt.g', result.data.token);
103
- guestToken = result.data.token;
104
- }
105
-
106
- this.setGuestToken(guestToken);
107
- let { data, status, message } = await UserService.get({ id: 'auth' });
108
- if (status === 'error') {
109
- if (message && message.match('expired')) {
110
- localStorage.removeItem('jwt.g');
111
- return await Auth.sessionOut();
112
- } else throw new Error(message);
113
+ // Anon guest session
114
+ let guestToken = localStorage.getItem('jwt.g');
115
+ if (guestToken) {
116
+ Auth.setGuestToken(guestToken);
117
+ let { data, status, message } = await UserService.get({ id: 'auth' });
118
+ if (status === 'success') {
119
+ await LogIn.Trigger(data);
120
+ await Account.updateForm(data.user);
121
+ return data;
122
+ } else logger.error(message);
113
123
  }
114
- await Account.updateForm(data);
115
- return { user: data };
124
+ return await Auth.sessionOut();
116
125
  } catch (error) {
117
126
  logger.error(error);
118
127
  return { user: UserMock.default };
119
128
  }
120
129
  },
121
130
  sessionOut: async function () {
122
- this.deleteToken();
123
- localStorage.removeItem('jwt');
124
- const result = await this.sessionIn();
125
- await LogOut.Trigger(result);
126
- return result;
131
+ {
132
+ const result = await UserService.delete({ id: 'logout' });
133
+ localStorage.removeItem('jwt');
134
+ Auth.deleteToken();
135
+ if (this[refreshTimeout]) {
136
+ clearTimeout(this[refreshTimeout]);
137
+ }
138
+ Auth.renderGuestUi();
139
+ LogIn.Scope.user.main.model.user = {};
140
+ await LogOut.Trigger(result);
141
+ }
142
+ {
143
+ localStorage.removeItem('jwt.g');
144
+ Auth.deleteGuestToken();
145
+ const result = await UserService.post({ id: 'guest' });
146
+ localStorage.setItem('jwt.g', result.data.token);
147
+ Auth.setGuestToken(result.data.token);
148
+ return await Auth.sessionIn();
149
+ }
150
+ },
151
+ renderSessionUI: function () {
152
+ s(`.main-btn-log-in`).style.display = 'none';
153
+ s(`.main-btn-sign-up`).style.display = 'none';
154
+ s(`.main-btn-log-out`).style.display = null;
155
+ s(`.main-btn-account`).style.display = null;
156
+ setTimeout(() => {
157
+ if (s(`.modal-log-in`)) s(`.btn-close-modal-log-in`).click();
158
+ if (s(`.modal-sign-up`)) s(`.btn-close-modal-sign-up`).click();
159
+ });
160
+ },
161
+ renderGuestUi: function () {
162
+ s(`.main-btn-log-in`).style.display = null;
163
+ s(`.main-btn-sign-up`).style.display = null;
164
+ s(`.main-btn-log-out`).style.display = 'none';
165
+ s(`.main-btn-account`).style.display = 'none';
166
+ setTimeout(() => {
167
+ if (s(`.modal-log-out`)) s(`.btn-close-modal-log-out`).click();
168
+ if (s(`.modal-account`)) s(`.btn-close-modal-account`).click();
169
+ });
127
170
  },
128
171
  };
129
172
 
@@ -7,9 +7,9 @@ import { Modal } from './Modal.js';
7
7
  import { NotificationManager } from './NotificationManager.js';
8
8
  import { Panel } from './Panel.js';
9
9
  import { Responsive } from './Responsive.js';
10
- import { listenQueryPathInstance, RouterEvents, setQueryPath } from './Router.js';
10
+ import { listenQueryPathInstance, RouterEvents, setQueryPath, getQueryParams } from './Router.js';
11
11
  import { Translate } from './Translate.js';
12
- import { append, getQueryParams, getTimeZone, htmls, s, sa } from './VanillaJs.js';
12
+ import { append, getTimeZone, htmls, s, sa } from './VanillaJs.js';
13
13
 
14
14
  // https://fullcalendar.io/docs/event-object
15
15
 
@@ -346,7 +346,7 @@ const CalendarCore = {
346
346
  status,
347
347
  });
348
348
 
349
- setQueryPath({ path: options.route, queryPath: '', replace: true });
349
+ setQueryPath({ path: options.route, queryPath: '' });
350
350
  await CalendarCore.Data[options.idModal].updatePanel();
351
351
 
352
352
  return { status };
@@ -363,7 +363,6 @@ const CalendarCore = {
363
363
  const cid = getQueryParams().cid ? getQueryParams().cid : '';
364
364
  if (lastCid === cid) return;
365
365
  lastCid = cid;
366
- if (options.route === 'home') Modal.homeCid = newInstance(cid);
367
366
  if (s(`.main-body-calendar-${options.idModal}`)) {
368
367
  // if (Auth.getToken())
369
368
  // else getSrrData();
@@ -577,8 +577,7 @@ const getCurrentTrace = () => {
577
577
  try {
578
578
  _stack;
579
579
  } catch (error) {
580
- console.error(error);
581
- return error;
580
+ return error.stack;
582
581
  }
583
582
  };
584
583
 
@@ -1,6 +1,6 @@
1
1
  import { marked } from 'marked';
2
2
  import { FileService } from '../../services/file/file.service.js';
3
- import { append, getBlobFromUint8ArrayFile, getQueryParams, getRawContentFile, htmls, s } from './VanillaJs.js';
3
+ import { append, getBlobFromUint8ArrayFile, getRawContentFile, htmls, s } from './VanillaJs.js';
4
4
  import { titleFormatted } from './CommonJs.js';
5
5
  import { Translate } from './Translate.js';
6
6
  import { Modal, renderViewTitle } from './Modal.js';
@@ -8,6 +8,7 @@ import { DocumentService } from '../../services/document/document.service.js';
8
8
  import { CoreService, getApiBaseUrl } from '../../services/core/core.service.js';
9
9
  import { loggerFactory } from './Logger.js';
10
10
  import { imageShimmer, renderChessPattern, renderCssAttr, styleFactory } from './Css.js';
11
+ import { getQueryParams } from './Router.js';
11
12
 
12
13
  const logger = loggerFactory(import.meta);
13
14
 
@@ -3,7 +3,8 @@ import { CssCoreDark, CssCoreLight } from './CssCore.js';
3
3
  import { DropDown } from './DropDown.js';
4
4
  import { Modal } from './Modal.js';
5
5
  import { Translate } from './Translate.js';
6
- import { append, getProxyPath, htmls, s, sa } from './VanillaJs.js';
6
+ import { append, htmls, s, sa } from './VanillaJs.js';
7
+ import { getProxyPath } from './Router.js';
7
8
 
8
9
  let ThemesScope = [];
9
10
 
@@ -1,7 +1,8 @@
1
1
  import { AgGrid } from './AgGrid.js';
2
2
  import { borderChar, boxShadow, scrollBarDarkRender, scrollBarLightRender } from './Css.js';
3
3
  import { LoadingAnimation } from './LoadingAnimation.js';
4
- import { append, getProxyPath, s } from './VanillaJs.js';
4
+ import { append, s } from './VanillaJs.js';
5
+ import { getProxyPath } from './Router.js';
5
6
 
6
7
  const CssCommonCore = async () => {
7
8
  if (!s(`.fa-link`))
@@ -1,12 +1,11 @@
1
1
  import { Badge } from './Badge.js';
2
2
  import { BtnIcon } from './BtnIcon.js';
3
- import { rgbToHex } from './CommonJs.js';
4
- import { Css, darkTheme, dynamicCol, renderCssAttr, simpleIconsRender, ThemeEvents, Themes } from './Css.js';
3
+ import { Css, renderCssAttr, simpleIconsRender, ThemeEvents, Themes } from './Css.js';
5
4
  import { DropDown } from './DropDown.js';
6
5
  import { buildBadgeToolTipMenuOption, Modal, renderMenuLabel, renderViewTitle } from './Modal.js';
7
- import { listenQueryPathInstance, setQueryPath, closeModalRouteChangeEvent } from './Router.js';
6
+ import { listenQueryPathInstance, setQueryPath, closeModalRouteChangeEvent, getProxyPath } from './Router.js';
8
7
  import { Translate } from './Translate.js';
9
- import { getProxyPath, getQueryParams, htmls, s, sa } from './VanillaJs.js';
8
+ import { htmls, s } from './VanillaJs.js';
10
9
  import Sortable from 'sortablejs';
11
10
 
12
11
  // https://mintlify.com/docs/quickstart
@@ -34,6 +33,7 @@ const Docs = {
34
33
  },
35
34
  maximize: true,
36
35
  mode: 'view',
36
+ route: 'docs',
37
37
  slideMenu: 'modal-menu',
38
38
  observer: true,
39
39
  barMode: 'top-bottom-bar',
@@ -4,8 +4,7 @@ import { FileService } from '../../services/file/file.service.js';
4
4
  import { AgGrid } from './AgGrid.js';
5
5
  import { Auth } from './Auth.js';
6
6
  import { BtnIcon } from './BtnIcon.js';
7
- import { getSubpaths, timer, uniqueArray } from './CommonJs.js';
8
- import { Content } from './Content.js';
7
+ import { getSubpaths, uniqueArray } from './CommonJs.js';
9
8
  import { darkTheme, renderCssAttr } from './Css.js';
10
9
  import { EventsUI } from './EventsUI.js';
11
10
  import { fileFormDataFactory, Input, InputFile } from './Input.js';
@@ -15,7 +14,8 @@ import { NotificationManager } from './NotificationManager.js';
15
14
  import { RouterEvents } from './Router.js';
16
15
  import { Translate } from './Translate.js';
17
16
  import { Validator } from './Validator.js';
18
- import { copyData, downloadFile, getProxyPath, getQueryParams, s, setPath } from './VanillaJs.js';
17
+ import { copyData, downloadFile, s } from './VanillaJs.js';
18
+ import { getProxyPath, getQueryParams, setPath } from './Router.js';
19
19
 
20
20
  const logger = loggerFactory(import.meta);
21
21
 
@@ -1,7 +1,7 @@
1
1
  import JoystickController from 'joystick-controller';
2
2
  import { getDirection, getId } from './CommonJs.js';
3
- import { loggerFactory } from './Logger.js';
4
- import { append, getProxyPath, s } from './VanillaJs.js';
3
+ import { append, s } from './VanillaJs.js';
4
+ import { getProxyPath } from './Router.js';
5
5
 
6
6
  const logger = loggerFactory(import.meta);
7
7
 
@@ -1,9 +1,9 @@
1
- import { CoreService } from '../../services/core/core.service.js';
2
1
  import { BtnIcon } from './BtnIcon.js';
3
2
  import { s4 } from './CommonJs.js';
4
3
  import { darkTheme, renderCssAttr, subThemeManager } from './Css.js';
5
4
  import { loggerFactory } from './Logger.js';
6
- import { append, getAllChildNodes, getProxyPath, htmls, s, sa } from './VanillaJs.js';
5
+ import { append, htmls, s } from './VanillaJs.js';
6
+ import { getProxyPath } from './Router.js';
7
7
 
8
8
  const logger = loggerFactory(import.meta);
9
9
 
@@ -24,8 +24,9 @@ const LogIn = {
24
24
  Event: {},
25
25
  Trigger: async function (options) {
26
26
  const { user } = options;
27
- await Webhook.register({ user });
28
27
  for (const eventKey of Object.keys(this.Event)) await this.Event[eventKey](options);
28
+ if (!user || user.role === 'guest') return;
29
+ await Webhook.register({ user });
29
30
  if (s(`.session`))
30
31
  htmls(
31
32
  `.session`,
@@ -72,19 +73,18 @@ const LogIn = {
72
73
  imageSrc,
73
74
  };
74
75
  }
76
+ htmls(
77
+ `.action-btn-profile-log-in-render`,
78
+ html`<div class="abs center top-box-profile-img-container">
79
+ <img
80
+ class="abs center top-box-profile-img"
81
+ ${this.Scope.user.main.model.user.profileImage
82
+ ? `src="${this.Scope.user.main.model.user.profileImage.imageSrc}"`
83
+ : ``}
84
+ />
85
+ </div>`,
86
+ );
75
87
  }
76
-
77
- htmls(
78
- `.action-btn-profile-log-in-render`,
79
- html`<div class="abs center top-box-profile-img-container">
80
- <img
81
- class="abs center top-box-profile-img"
82
- ${this.Scope.user.main.model.user.profileImage
83
- ? `src="${this.Scope.user.main.model.user.profileImage.imageSrc}"`
84
- : ``}
85
- />
86
- </div>`,
87
- );
88
88
  },
89
89
  Render: async function () {
90
90
  setTimeout(async () => {
@@ -103,13 +103,7 @@ const LogIn = {
103
103
  if ('model' in inputData) body[inputData.model] = s(`.${inputData.id}`).value;
104
104
  }
105
105
  const result = await UserService.post({ id: 'auth', body });
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
107
  if (result.status === 'error' && result.message.match('attempts')) {
114
108
  htmls(`.login-attempt-warn-value`, result.message.split(':')[1]);
115
109
  s(`.login-attempt-warn-container`).classList.remove('hide');
@@ -119,6 +113,8 @@ const LogIn = {
119
113
  htmls(`.login-attempt-warn-value0`, result.message.split(':')[1]);
120
114
  s(`.login-attempt-warn-container0`).classList.remove('hide');
121
115
  } else s(`.login-attempt-warn-container0`).classList.add('hide');
116
+
117
+ if (result.status === 'success') await Auth.sessionIn(result);
122
118
  NotificationManager.Push({
123
119
  html: result.status === 'success' ? Translate.Render(`${result.status}-user-log-in`) : result.message,
124
120
  status: result.status,
@@ -189,9 +185,6 @@ const LogIn = {
189
185
  </form>
190
186
  `;
191
187
  },
192
- cleanMainUser: () => {
193
- LogIn.Scope.user.main.model.user = {};
194
- },
195
188
  };
196
189
 
197
190
  export { LogIn };
@@ -4,11 +4,11 @@ import { LogIn } from './LogIn.js';
4
4
  import { Translate } from './Translate.js';
5
5
  import { htmls, s } from './VanillaJs.js';
6
6
  import { Webhook } from './Webhook.js';
7
+ import { NotificationManager } from './NotificationManager.js';
7
8
 
8
9
  const LogOut = {
9
10
  Event: {},
10
11
  Trigger: async function (options) {
11
- LogIn.cleanMainUser();
12
12
  await Webhook.unregister();
13
13
  for (const eventKey of Object.keys(this.Event)) await this.Event[eventKey](options);
14
14
  if (s(`.session`))
@@ -41,6 +41,10 @@ const LogOut = {
41
41
  s('.btn-log-out').onclick = async (e) => {
42
42
  e.preventDefault();
43
43
  await Auth.sessionOut();
44
+ NotificationManager.Push({
45
+ html: Translate.Render(`success-logout`),
46
+ status: 'success',
47
+ });
44
48
  };
45
49
  });
46
50
  // Translate.Render('confirm-logout')
@@ -1,4 +1,6 @@
1
- const loggerFactory = (meta) => {
1
+ import { getCurrentTrace } from './CommonJs.js';
2
+
3
+ const loggerFactory = (meta, options = { trace: false }) => {
2
4
  meta = meta.url.split('/').pop();
3
5
  const types = ['error', 'warn', 'info', 'debug'];
4
6
  const logger = {
@@ -9,6 +11,7 @@ const loggerFactory = (meta) => {
9
11
  console.info = () => null;
10
12
  console.warn = () => null;
11
13
  }
14
+ if (options.trace === true) args.push(getCurrentTrace().split('Logger.js:23')[1]);
12
15
  return location.hostname === 'localhost'
13
16
  ? console[type](`[${meta}] ${new Date().toISOString()} ${type}:`, ...args)
14
17
  : null;
@@ -1,16 +1,6 @@
1
- import { cap, getId, newInstance } from './CommonJs.js';
1
+ import { getId, newInstance } from './CommonJs.js';
2
2
  import { Draggable } from '@neodrag/vanilla';
3
- import {
4
- append,
5
- s,
6
- prepend,
7
- setPath,
8
- getProxyPath,
9
- htmls,
10
- sa,
11
- getAllChildNodes,
12
- isActiveElement,
13
- } from './VanillaJs.js';
3
+ import { append, s, prepend, htmls, sa, getAllChildNodes, isActiveElement } from './VanillaJs.js';
14
4
  import { BtnIcon } from './BtnIcon.js';
15
5
  import { Responsive } from './Responsive.js';
16
6
  import { loggerFactory } from './Logger.js';
@@ -24,12 +14,18 @@ import {
24
14
  renderStatus,
25
15
  renderCssAttr,
26
16
  } from './Css.js';
27
- import { setDocTitle, closeModalRouteChangeEvent, handleModalViewRoute } from './Router.js';
17
+ import {
18
+ setDocTitle,
19
+ closeModalRouteChangeEvent,
20
+ handleModalViewRoute,
21
+ getProxyPath,
22
+ setPath,
23
+ coreUI,
24
+ } from './Router.js';
28
25
  import { NotificationManager } from './NotificationManager.js';
29
26
  import { EventsUI } from './EventsUI.js';
30
27
  import { Translate } from './Translate.js';
31
28
  import { Input, isTextInputFocused } from './Input.js';
32
- import { Validator } from './Validator.js';
33
29
  import { DropDown } from './DropDown.js';
34
30
  import { Keyboard } from './Keyboard.js';
35
31
  import { Badge } from './Badge.js';
@@ -186,9 +182,7 @@ const Modal = {
186
182
  htmls(
187
183
  `.default-slide-menu-top-bar-fix-title-container`,
188
184
  html`
189
- <div class="inl default-slide-menu-top-bar-fix-title-container-text">
190
- ${options.RouterInstance.BannerAppTemplate}
191
- </div>
185
+ <div class="inl default-slide-menu-top-bar-fix-title-container-text">${options.title}</div>
192
186
  `,
193
187
  );
194
188
  } else
@@ -274,6 +268,7 @@ const Modal = {
274
268
  s(`.btn-menu-${idModal}`).classList.remove('hide');
275
269
  s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
276
270
  s(`.html-${idModal}`).style.display = 'none';
271
+ // s(`.title-modal-${idModal}`).style.display = 'none';
277
272
  setTimeout(() => {
278
273
  s(`.main-body-btn-ui-menu-close`).classList.add('hide');
279
274
  s(`.main-body-btn-ui-menu-menu`).classList.remove('hide');
@@ -281,9 +276,6 @@ const Modal = {
281
276
  s(`.btn-bar-center-icon-menu`).classList.remove('hide');
282
277
  s(`.btn-bar-center-icon-close`).classList.add('hide');
283
278
  }
284
- });
285
- // s(`.title-modal-${idModal}`).style.display = 'none';
286
- setTimeout(() => {
287
279
  s(`.main-body-btn-container`).style[
288
280
  true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
289
281
  ] = `${0}px`;
@@ -787,8 +779,7 @@ const Modal = {
787
779
  dragDisabled: true,
788
780
  maximize: true,
789
781
  heightBottomBar: 0,
790
- heightTopBar: originHeightTopBar,
791
- barMode: options.barMode,
782
+ heightTopBar: options.heightTopBar,
792
783
  });
793
784
 
794
785
  // Bind hover/focus and click-outside to dismiss
@@ -1755,9 +1746,8 @@ const Modal = {
1755
1746
  if (!s(`.${idModal}`)) return;
1756
1747
  this.removeModal(idModal);
1757
1748
  // Handle modal route change
1758
- if (options.route || options.query) {
1759
- closeModalRouteChangeEvent({ closedId: idModal, homeCid: Modal.homeCid });
1760
- }
1749
+ closeModalRouteChangeEvent({ closedId: idModal });
1750
+ // history.back();
1761
1751
  }, 300);
1762
1752
  };
1763
1753
  s(`.btn-close-${idModal}`).onclick = btnCloseEvent;
@@ -1957,7 +1947,7 @@ const Modal = {
1957
1947
  const modal = Modal.Data[idModal];
1958
1948
  if (!modal) return false;
1959
1949
  // Don't close the core UI elements
1960
- const coreUI = ['modal-menu', 'main-body', 'main-body-top', 'bottom-bar', 'board-notification'];
1950
+
1961
1951
  if (coreUI.find((id) => idModal.startsWith(id))) {
1962
1952
  return false;
1963
1953
  }
@@ -1970,7 +1960,7 @@ const Modal = {
1970
1960
  });
1971
1961
 
1972
1962
  // 2. Navigate to home first, creating a new history entry.
1973
- setPath(getProxyPath());
1963
+ setPath(`${getProxyPath()}${location.search ?? ''}${location.hash ?? ''}`);
1974
1964
  setDocTitle();
1975
1965
 
1976
1966
  // 3. Close the modals without them affecting the URL.
@@ -4,7 +4,8 @@ import { borderChar, dynamicCol } from './Css.js';
4
4
  import { DropDown } from './DropDown.js';
5
5
  import { EventsUI } from './EventsUI.js';
6
6
  import { Translate } from './Translate.js';
7
- import { getProxyPath, s, append, hexToRgbA } from './VanillaJs.js';
7
+ import { s, append, hexToRgbA } from './VanillaJs.js';
8
+ import { getProxyPath } from './Router.js';
8
9
  import { s4 } from './CommonJs.js';
9
10
  import { Input } from './Input.js';
10
11
  import { ToggleSwitch } from './ToggleSwitch.js';