underpost 2.6.3 → 2.7.2
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/.dockerignore +13 -13
- package/.env.development +7 -7
- package/.env.production +7 -7
- package/.env.test +7 -7
- package/.github/workflows/publish.yml +26 -0
- package/.nycrc +9 -9
- package/.prettierignore +12 -12
- package/.prettierrc +9 -9
- package/.vscode/extensions.json +72 -72
- package/.vscode/settings.json +100 -99
- package/AUTHORS.md +10 -0
- package/CHANGELOG.md +91 -0
- package/Dockerfile +89 -89
- package/LICENSE +21 -21
- package/README.md +96 -96
- package/bin/db.js +172 -119
- package/bin/deploy.js +582 -626
- package/bin/dns.js +1 -1
- package/bin/file.js +92 -92
- package/bin/index.js +53 -34
- package/bin/install.js +398 -357
- package/bin/shortcut.js +44 -44
- package/bin/ssl.js +65 -61
- package/bin/util.js +182 -182
- package/bin/vs.js +35 -35
- package/conf.js +251 -249
- package/docker-compose.yml +67 -67
- package/jsconfig.json +7 -7
- package/jsdoc.json +32 -32
- package/nodemon.json +6 -6
- package/package.json +137 -128
- package/prometheus.yml +36 -36
- package/setup.sh +24 -24
- package/src/api/core/core.controller.js +69 -69
- package/src/api/core/core.model.js +11 -11
- package/src/api/core/core.router.js +23 -23
- package/src/api/core/core.service.js +29 -29
- package/src/api/crypto/crypto.controller.js +51 -51
- package/src/api/crypto/crypto.model.js +23 -23
- package/src/api/crypto/crypto.router.js +20 -20
- package/src/api/crypto/crypto.service.js +64 -64
- package/src/api/default/default.controller.js +69 -69
- package/src/api/default/default.model.js +20 -20
- package/src/api/default/default.router.js +23 -23
- package/src/api/default/default.service.js +31 -31
- package/src/api/file/file.controller.js +53 -51
- package/src/api/file/file.model.js +19 -19
- package/src/api/file/file.router.js +21 -20
- package/src/api/file/file.service.js +76 -70
- package/src/api/instance/instance.controller.js +69 -69
- package/src/api/instance/instance.model.js +36 -36
- package/src/api/instance/instance.router.js +33 -33
- package/src/api/instance/instance.service.js +48 -48
- package/src/api/test/test.controller.js +59 -59
- package/src/api/test/test.model.js +14 -14
- package/src/api/test/test.router.js +21 -21
- package/src/api/test/test.service.js +35 -35
- package/src/api/user/user.build.js +16 -0
- package/src/api/user/user.controller.js +70 -70
- package/src/api/user/user.model.js +65 -65
- package/src/api/user/user.router.js +345 -345
- package/src/api/user/user.service.js +479 -479
- package/src/api.js +23 -23
- package/src/client/Default.index.js +40 -40
- package/src/client/components/core/Account.js +290 -290
- package/src/client/components/core/AgGrid.js +160 -160
- package/src/client/components/core/Auth.js +19 -19
- package/src/client/components/core/Badge.js +32 -32
- package/src/client/components/core/BlockChain.js +41 -41
- package/src/client/components/core/Blog.js +9 -9
- package/src/client/components/core/BtnIcon.js +101 -94
- package/src/client/components/core/CalendarCore.js +458 -319
- package/src/client/components/core/Chat.js +64 -64
- package/src/client/components/core/ColorPalette.js +5267 -5267
- package/src/client/components/core/CommonJs.js +735 -732
- package/src/client/components/core/Content.js +193 -49
- package/src/client/components/core/Css.js +1064 -1027
- package/src/client/components/core/CssCore.js +817 -796
- package/src/client/components/core/D3Chart.js +44 -44
- package/src/client/components/core/Docs.js +229 -229
- package/src/client/components/core/DropDown.js +164 -164
- package/src/client/components/core/EventsUI.js +46 -54
- package/src/client/components/core/FileExplorer.js +699 -624
- package/src/client/components/core/FullScreen.js +45 -45
- package/src/client/components/core/Input.js +346 -259
- package/src/client/components/core/JoyStick.js +77 -77
- package/src/client/components/core/Keyboard.js +73 -73
- package/src/client/components/core/LoadingAnimation.js +179 -157
- package/src/client/components/core/LogIn.js +187 -181
- package/src/client/components/core/LogOut.js +58 -52
- package/src/client/components/core/Logger.js +26 -26
- package/src/client/components/core/Modal.js +1612 -1596
- package/src/client/components/core/NotificationManager.js +84 -84
- package/src/client/components/core/Panel.js +613 -413
- package/src/client/components/core/PanelForm.js +468 -0
- package/src/client/components/core/Polyhedron.js +162 -162
- package/src/client/components/core/Recover.js +204 -204
- package/src/client/components/core/Responsive.js +53 -53
- package/src/client/components/core/RichText.js +51 -27
- package/src/client/components/core/Router.js +76 -77
- package/src/client/components/core/Scroll.js +34 -0
- package/src/client/components/core/SignUp.js +125 -125
- package/src/client/components/core/SocketIo.js +72 -72
- package/src/client/components/core/Stream.js +113 -113
- package/src/client/components/core/ToggleSwitch.js +87 -87
- package/src/client/components/core/ToolTip.js +26 -26
- package/src/client/components/core/Translate.js +437 -408
- package/src/client/components/core/Validator.js +100 -100
- package/src/client/components/core/VanillaJs.js +460 -457
- package/src/client/components/core/Wallet.js +106 -106
- package/src/client/components/core/Webhook.js +25 -25
- package/src/client/components/core/Worker.js +272 -272
- package/src/client/components/default/CommonDefault.js +29 -29
- package/src/client/components/default/CssDefault.js +13 -13
- package/src/client/components/default/ElementsDefault.js +38 -38
- package/src/client/components/default/LogInDefault.js +41 -41
- package/src/client/components/default/LogOutDefault.js +28 -28
- package/src/client/components/default/MenuDefault.js +389 -389
- package/src/client/components/default/RoutesDefault.js +48 -48
- package/src/client/components/default/SettingsDefault.js +16 -16
- package/src/client/components/default/SignUpDefault.js +9 -9
- package/src/client/components/default/SocketIoDefault.js +54 -54
- package/src/client/components/default/TranslateDefault.js +7 -7
- package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
- package/src/client/public/default/browserconfig.xml +11 -11
- package/src/client/public/default/manifest.webmanifest +68 -68
- package/src/client/public/default/plantuml/client-conf.svg +1 -0
- package/src/client/public/default/plantuml/client-schema.svg +1 -0
- package/src/client/public/default/plantuml/cron-conf.svg +1 -0
- package/src/client/public/default/plantuml/cron-schema.svg +1 -0
- package/src/client/public/default/plantuml/server-conf.svg +1 -0
- package/src/client/public/default/plantuml/server-schema.svg +1 -0
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
- package/src/client/public/default/sitemap +147 -147
- package/src/client/public/default/yandex-browser-manifest.json +8 -8
- package/src/client/public/doc/sitemap +147 -147
- package/src/client/public/test/sitemap +147 -147
- package/src/client/services/core/core.service.js +170 -152
- package/src/client/services/crypto/crypto.service.js +70 -70
- package/src/client/services/default/default.management.js +345 -345
- package/src/client/services/default/default.service.js +89 -89
- package/src/client/services/file/file.service.js +70 -70
- package/src/client/services/instance/instance.management.js +74 -74
- package/src/client/services/instance/instance.service.js +89 -89
- package/src/client/services/test/test.service.js +70 -70
- package/src/client/services/user/user.management.js +50 -50
- package/src/client/services/user/user.service.js +89 -89
- package/src/client/ssr/Render.js +16 -16
- package/src/client/ssr/body-components/CacheControl.js +114 -113
- package/src/client/ssr/body-components/DefaultSplashScreen.js +79 -79
- package/src/client/ssr/email-components/DefaultRecoverEmail.js +21 -21
- package/src/client/ssr/email-components/DefaultVerifyEmail.js +17 -17
- package/src/client/ssr/head-components/Css.js +241 -241
- package/src/client/ssr/head-components/DefaultScripts.js +3 -3
- package/src/client/ssr/head-components/Microdata.js +11 -11
- package/src/client/ssr/head-components/Production.js +1 -1
- package/src/client/ssr/head-components/PwaDefault.js +59 -59
- package/src/client/ssr/head-components/Seo.js +14 -14
- package/src/client/sw/default.sw.js +201 -201
- package/src/client/sw/template.sw.js +84 -84
- package/src/client.build.js +22 -22
- package/src/client.dev.js +21 -21
- package/src/cron.js +25 -25
- package/src/db/DataBaseProvider.js +34 -34
- package/src/db/mariadb/MariaDB.js +33 -33
- package/src/db/mongo/MongooseDB.js +46 -46
- package/src/dns.js +22 -22
- package/src/index.js +42 -0
- package/src/mailer/EmailRender.js +69 -69
- package/src/mailer/MailerProvider.js +96 -96
- package/src/proxy.js +22 -22
- package/src/runtime/lampp/Lampp.js +69 -44
- package/src/runtime/nginx/Nginx.js +3 -3
- package/src/runtime/xampp/Xampp.js +49 -49
- package/src/server/auth.js +235 -204
- package/src/server/backup.js +101 -84
- package/src/server/client-build-live.js +72 -72
- package/src/server/client-build.js +705 -699
- package/src/server/client-dev-server.js +60 -58
- package/src/server/client-formatted.js +48 -48
- package/src/server/client-icons.js +149 -150
- package/src/server/conf.js +860 -611
- package/src/server/dns.js +98 -87
- package/src/server/downloader.js +42 -42
- package/src/server/logger.js +180 -135
- package/src/server/network.js +122 -122
- package/src/server/peer.js +33 -33
- package/src/server/process.js +66 -66
- package/src/server/prompt-optimizer.js +28 -0
- package/src/server/proxy.js +118 -118
- package/src/server/runtime.js +444 -393
- package/src/server/ssl.js +109 -107
- package/src/server.js +25 -25
- package/src/ws/IoInterface.js +45 -45
- package/src/ws/IoServer.js +39 -39
- package/src/ws/core/channels/core.ws.chat.js +23 -23
- package/src/ws/core/channels/core.ws.mailer.js +35 -35
- package/src/ws/core/channels/core.ws.stream.js +31 -31
- package/src/ws/core/core.ws.connection.js +28 -28
- package/src/ws/core/core.ws.emit.js +14 -14
- package/src/ws/core/core.ws.server.js +24 -24
- package/src/ws/core/management/core.ws.chat.js +8 -8
- package/src/ws/core/management/core.ws.mailer.js +16 -16
- package/src/ws/core/management/core.ws.stream.js +8 -8
- package/src/ws/default/channels/default.ws.main.js +16 -16
- package/src/ws/default/default.ws.connection.js +22 -22
- package/src/ws/default/default.ws.emit.js +14 -14
- package/src/ws/default/default.ws.server.js +20 -20
- package/src/ws/default/management/default.ws.main.js +8 -8
- package/startup.js +11 -11
- package/supervisord-openssh-server.conf +4 -4
- package/test/api.test.js +60 -60
- package/bin/help.js +0 -110
|
@@ -1,204 +1,204 @@
|
|
|
1
|
-
import { UserService } from '../../services/user/user.service.js';
|
|
2
|
-
import { Auth } from './Auth.js';
|
|
3
|
-
import { BtnIcon } from './BtnIcon.js';
|
|
4
|
-
import { EventsUI } from './EventsUI.js';
|
|
5
|
-
import { Input } from './Input.js';
|
|
6
|
-
import { LogIn } from './LogIn.js';
|
|
7
|
-
import { NotificationManager } from './NotificationManager.js';
|
|
8
|
-
import { Translate } from './Translate.js';
|
|
9
|
-
import { Validator } from './Validator.js';
|
|
10
|
-
import { getQueryParams, s } from './VanillaJs.js';
|
|
11
|
-
|
|
12
|
-
const Recover = {
|
|
13
|
-
Event: {},
|
|
14
|
-
Trigger: async function (options) {
|
|
15
|
-
for (const eventKey of Object.keys(this.Event)) await this.Event[eventKey](options);
|
|
16
|
-
},
|
|
17
|
-
Render: async function (options = { idModal: '', user: {}, bottomRender: async () => '' }) {
|
|
18
|
-
const { idModal, user } = options;
|
|
19
|
-
let mode = 'recover-verify-email';
|
|
20
|
-
const recoverToken = getQueryParams().payload;
|
|
21
|
-
const formData = {
|
|
22
|
-
'recover-username': {
|
|
23
|
-
model: 'username',
|
|
24
|
-
id: `recover-username`,
|
|
25
|
-
rules: [{ type: 'isEmpty' }, { type: 'isLength', options: { min: 2, max: 20 } }],
|
|
26
|
-
show: () => false,
|
|
27
|
-
disable: function () {
|
|
28
|
-
return !this.show();
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
'recover-email': {
|
|
32
|
-
model: 'email',
|
|
33
|
-
id: `recover-email`,
|
|
34
|
-
rules: [{ type: 'isEmpty' }, { type: 'isEmail' }],
|
|
35
|
-
show: () => mode === 'recover-verify-email',
|
|
36
|
-
disable: function () {
|
|
37
|
-
return !this.show();
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
'recover-password': {
|
|
41
|
-
model: 'password',
|
|
42
|
-
id: `recover-password`,
|
|
43
|
-
rules: [{ type: 'isStrongPassword' }],
|
|
44
|
-
show: () => mode === 'change-password',
|
|
45
|
-
disable: function () {
|
|
46
|
-
return !this.show();
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
'recover-repeat-password': {
|
|
50
|
-
id: `recover-repeat-password`,
|
|
51
|
-
rules: [{ type: 'isEmpty' }, { type: 'passwordMismatch', options: `recover-password` }],
|
|
52
|
-
show: () => mode === 'change-password',
|
|
53
|
-
disable: function () {
|
|
54
|
-
return !this.show();
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
if (recoverToken) {
|
|
60
|
-
mode = 'change-password';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
setTimeout(async () => {
|
|
64
|
-
if (user && user.email) {
|
|
65
|
-
s(`.recover-email`).value = user.email;
|
|
66
|
-
if (user.emailConfirmed) s(`.recover-email`).setAttribute('disabled', '');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const validators = await Validator.instance(formData);
|
|
70
|
-
|
|
71
|
-
EventsUI.onClick(`.btn-recover`, async (e) => {
|
|
72
|
-
e.preventDefault();
|
|
73
|
-
s(`.recover-resend-btn-container`).classList.add('hide');
|
|
74
|
-
s(`.recover-send-btn-container`).classList.remove('hide');
|
|
75
|
-
const { errorMessage } = await validators();
|
|
76
|
-
if (errorMessage) return;
|
|
77
|
-
const body = {};
|
|
78
|
-
for (const inputData of Object.values(formData)) {
|
|
79
|
-
if ('model' in inputData) body[inputData.model] = s(`.${inputData.id}`).value;
|
|
80
|
-
}
|
|
81
|
-
switch (mode) {
|
|
82
|
-
case 'recover-verify-email': {
|
|
83
|
-
const result = await UserService.post({ id: 'recover-verify-email', body });
|
|
84
|
-
NotificationManager.Push({
|
|
85
|
-
html:
|
|
86
|
-
result.status === 'error' ? result.message : Translate.Render(`${result.status}-recover-verify-email`),
|
|
87
|
-
status: result.status,
|
|
88
|
-
});
|
|
89
|
-
if (result.status === 'success') {
|
|
90
|
-
s(`.recover-send-btn-container`).classList.add('hide');
|
|
91
|
-
s(`.recover-resend-btn-container`).classList.remove('hide');
|
|
92
|
-
}
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
case 'change-password': {
|
|
96
|
-
const result = await UserService.put({ id: `recover/${recoverToken}`, body });
|
|
97
|
-
NotificationManager.Push({
|
|
98
|
-
html:
|
|
99
|
-
typeof result.data === 'string' ? result.data : Translate.Render(`${result.status}-recover-password`),
|
|
100
|
-
status: result.status,
|
|
101
|
-
});
|
|
102
|
-
if (result.status === 'success') {
|
|
103
|
-
if (Auth.getToken()) {
|
|
104
|
-
s(`.btn-close-modal-recover`).click();
|
|
105
|
-
s(`.main-btn-account`).click();
|
|
106
|
-
} else {
|
|
107
|
-
s(`.btn-recover`).classList.add('hide');
|
|
108
|
-
s(`.input-container-recover-password`).classList.add('hide');
|
|
109
|
-
s(`.input-container-recover-repeat-password`).classList.add('hide');
|
|
110
|
-
s(`.btn-recover-log-in`).classList.remove('hide');
|
|
111
|
-
}
|
|
112
|
-
this.Trigger({ user: result.data });
|
|
113
|
-
}
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
s(`.btn-recover-resend`).onclick = (e) => {
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
s(`.btn-recover`).click();
|
|
121
|
-
};
|
|
122
|
-
s(`.btn-recover-log-in`).onclick = () => {
|
|
123
|
-
s(`.btn-close-modal-recover`).click();
|
|
124
|
-
s(`.main-btn-log-in`).click();
|
|
125
|
-
};
|
|
126
|
-
});
|
|
127
|
-
return html`
|
|
128
|
-
${await BtnIcon.Render({
|
|
129
|
-
class: 'section-mp form-button btn-recover-log-in hide',
|
|
130
|
-
label: Translate.Render('log-in'),
|
|
131
|
-
type: 'button',
|
|
132
|
-
})}
|
|
133
|
-
<form class="in">
|
|
134
|
-
<div class="in">
|
|
135
|
-
${await Input.Render({
|
|
136
|
-
id: `recover-username`,
|
|
137
|
-
type: 'text',
|
|
138
|
-
label: html`<i class="fa-solid fa-pen-to-square"></i> ${Translate.Render('username')}`,
|
|
139
|
-
containerClass: `inl section-mp width-mini-box input-container ${
|
|
140
|
-
formData[`recover-username`].show() ? '' : 'hide'
|
|
141
|
-
}`,
|
|
142
|
-
placeholder: true,
|
|
143
|
-
})}
|
|
144
|
-
</div>
|
|
145
|
-
<div class="in">
|
|
146
|
-
${await Input.Render({
|
|
147
|
-
id: `recover-email`,
|
|
148
|
-
type: 'email',
|
|
149
|
-
label: html`<i class="fa-solid fa-envelope"></i> ${Translate.Render('email')}`,
|
|
150
|
-
containerClass: `inl section-mp width-mini-box input-container ${
|
|
151
|
-
formData[`recover-email`].show() ? '' : 'hide'
|
|
152
|
-
}`,
|
|
153
|
-
placeholder: true,
|
|
154
|
-
autocomplete: 'email',
|
|
155
|
-
})}
|
|
156
|
-
</div>
|
|
157
|
-
<div class="in">
|
|
158
|
-
${await Input.Render({
|
|
159
|
-
id: `recover-password`,
|
|
160
|
-
type: 'password',
|
|
161
|
-
autocomplete: 'new-password',
|
|
162
|
-
label: html`<i class="fa-solid fa-lock"></i> ${Translate.Render('password')}`,
|
|
163
|
-
containerClass: `inl section-mp width-mini-box input-container ${
|
|
164
|
-
formData[`recover-password`].show() ? '' : 'hide'
|
|
165
|
-
}`,
|
|
166
|
-
placeholder: true,
|
|
167
|
-
})}
|
|
168
|
-
</div>
|
|
169
|
-
<div class="in">
|
|
170
|
-
${await Input.Render({
|
|
171
|
-
id: `recover-repeat-password`,
|
|
172
|
-
type: 'password',
|
|
173
|
-
autocomplete: 'new-password',
|
|
174
|
-
label: html`<i class="fa-solid fa-lock"></i> ${Translate.Render('repeat')} ${Translate.Render('password')}`,
|
|
175
|
-
containerClass: `inl section-mp width-mini-box input-container ${
|
|
176
|
-
formData[`recover-repeat-password`].show() ? '' : 'hide'
|
|
177
|
-
}`,
|
|
178
|
-
placeholder: true,
|
|
179
|
-
})}
|
|
180
|
-
</div>
|
|
181
|
-
${options?.bottomRender ? await options.bottomRender() : ``}
|
|
182
|
-
<div class="in recover-send-btn-container">
|
|
183
|
-
${await BtnIcon.Render({
|
|
184
|
-
class: 'section-mp form-button btn-recover',
|
|
185
|
-
label: Translate.Render(mode === 'recover-verify-email' ? 'send-recover-verify-email' : 'change-password'),
|
|
186
|
-
type: 'button',
|
|
187
|
-
})}
|
|
188
|
-
</div>
|
|
189
|
-
<div class="in recover-resend-btn-container hide">
|
|
190
|
-
<div class="in section-mp form-button" style="color: #ed9d0f">
|
|
191
|
-
<i class="fa-solid fa-triangle-exclamation"></i> ${Translate.Render('15-min-valid-recover-email')}
|
|
192
|
-
</div>
|
|
193
|
-
${await BtnIcon.Render({
|
|
194
|
-
class: 'section-mp form-button btn-recover-resend',
|
|
195
|
-
label: html`${Translate.Render('resend')} ${Translate.Render('recover-verify-email')}`,
|
|
196
|
-
type: 'submit',
|
|
197
|
-
})}
|
|
198
|
-
</div>
|
|
199
|
-
</form>
|
|
200
|
-
`;
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
export { Recover };
|
|
1
|
+
import { UserService } from '../../services/user/user.service.js';
|
|
2
|
+
import { Auth } from './Auth.js';
|
|
3
|
+
import { BtnIcon } from './BtnIcon.js';
|
|
4
|
+
import { EventsUI } from './EventsUI.js';
|
|
5
|
+
import { Input } from './Input.js';
|
|
6
|
+
import { LogIn } from './LogIn.js';
|
|
7
|
+
import { NotificationManager } from './NotificationManager.js';
|
|
8
|
+
import { Translate } from './Translate.js';
|
|
9
|
+
import { Validator } from './Validator.js';
|
|
10
|
+
import { getQueryParams, s } from './VanillaJs.js';
|
|
11
|
+
|
|
12
|
+
const Recover = {
|
|
13
|
+
Event: {},
|
|
14
|
+
Trigger: async function (options) {
|
|
15
|
+
for (const eventKey of Object.keys(this.Event)) await this.Event[eventKey](options);
|
|
16
|
+
},
|
|
17
|
+
Render: async function (options = { idModal: '', user: {}, bottomRender: async () => '' }) {
|
|
18
|
+
const { idModal, user } = options;
|
|
19
|
+
let mode = 'recover-verify-email';
|
|
20
|
+
const recoverToken = getQueryParams().payload;
|
|
21
|
+
const formData = {
|
|
22
|
+
'recover-username': {
|
|
23
|
+
model: 'username',
|
|
24
|
+
id: `recover-username`,
|
|
25
|
+
rules: [{ type: 'isEmpty' }, { type: 'isLength', options: { min: 2, max: 20 } }],
|
|
26
|
+
show: () => false,
|
|
27
|
+
disable: function () {
|
|
28
|
+
return !this.show();
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
'recover-email': {
|
|
32
|
+
model: 'email',
|
|
33
|
+
id: `recover-email`,
|
|
34
|
+
rules: [{ type: 'isEmpty' }, { type: 'isEmail' }],
|
|
35
|
+
show: () => mode === 'recover-verify-email',
|
|
36
|
+
disable: function () {
|
|
37
|
+
return !this.show();
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
'recover-password': {
|
|
41
|
+
model: 'password',
|
|
42
|
+
id: `recover-password`,
|
|
43
|
+
rules: [{ type: 'isStrongPassword' }],
|
|
44
|
+
show: () => mode === 'change-password',
|
|
45
|
+
disable: function () {
|
|
46
|
+
return !this.show();
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
'recover-repeat-password': {
|
|
50
|
+
id: `recover-repeat-password`,
|
|
51
|
+
rules: [{ type: 'isEmpty' }, { type: 'passwordMismatch', options: `recover-password` }],
|
|
52
|
+
show: () => mode === 'change-password',
|
|
53
|
+
disable: function () {
|
|
54
|
+
return !this.show();
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (recoverToken) {
|
|
60
|
+
mode = 'change-password';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
setTimeout(async () => {
|
|
64
|
+
if (user && user.email) {
|
|
65
|
+
s(`.recover-email`).value = user.email;
|
|
66
|
+
if (user.emailConfirmed) s(`.recover-email`).setAttribute('disabled', '');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const validators = await Validator.instance(formData);
|
|
70
|
+
|
|
71
|
+
EventsUI.onClick(`.btn-recover`, async (e) => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
s(`.recover-resend-btn-container`).classList.add('hide');
|
|
74
|
+
s(`.recover-send-btn-container`).classList.remove('hide');
|
|
75
|
+
const { errorMessage } = await validators();
|
|
76
|
+
if (errorMessage) return;
|
|
77
|
+
const body = {};
|
|
78
|
+
for (const inputData of Object.values(formData)) {
|
|
79
|
+
if ('model' in inputData) body[inputData.model] = s(`.${inputData.id}`).value;
|
|
80
|
+
}
|
|
81
|
+
switch (mode) {
|
|
82
|
+
case 'recover-verify-email': {
|
|
83
|
+
const result = await UserService.post({ id: 'recover-verify-email', body });
|
|
84
|
+
NotificationManager.Push({
|
|
85
|
+
html:
|
|
86
|
+
result.status === 'error' ? result.message : Translate.Render(`${result.status}-recover-verify-email`),
|
|
87
|
+
status: result.status,
|
|
88
|
+
});
|
|
89
|
+
if (result.status === 'success') {
|
|
90
|
+
s(`.recover-send-btn-container`).classList.add('hide');
|
|
91
|
+
s(`.recover-resend-btn-container`).classList.remove('hide');
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
case 'change-password': {
|
|
96
|
+
const result = await UserService.put({ id: `recover/${recoverToken}`, body });
|
|
97
|
+
NotificationManager.Push({
|
|
98
|
+
html:
|
|
99
|
+
typeof result.data === 'string' ? result.data : Translate.Render(`${result.status}-recover-password`),
|
|
100
|
+
status: result.status,
|
|
101
|
+
});
|
|
102
|
+
if (result.status === 'success') {
|
|
103
|
+
if (Auth.getToken()) {
|
|
104
|
+
s(`.btn-close-modal-recover`).click();
|
|
105
|
+
s(`.main-btn-account`).click();
|
|
106
|
+
} else {
|
|
107
|
+
s(`.btn-recover`).classList.add('hide');
|
|
108
|
+
s(`.input-container-recover-password`).classList.add('hide');
|
|
109
|
+
s(`.input-container-recover-repeat-password`).classList.add('hide');
|
|
110
|
+
s(`.btn-recover-log-in`).classList.remove('hide');
|
|
111
|
+
}
|
|
112
|
+
this.Trigger({ user: result.data });
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
s(`.btn-recover-resend`).onclick = (e) => {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
s(`.btn-recover`).click();
|
|
121
|
+
};
|
|
122
|
+
s(`.btn-recover-log-in`).onclick = () => {
|
|
123
|
+
s(`.btn-close-modal-recover`).click();
|
|
124
|
+
s(`.main-btn-log-in`).click();
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
return html`
|
|
128
|
+
${await BtnIcon.Render({
|
|
129
|
+
class: 'section-mp form-button btn-recover-log-in hide',
|
|
130
|
+
label: Translate.Render('log-in'),
|
|
131
|
+
type: 'button',
|
|
132
|
+
})}
|
|
133
|
+
<form class="in">
|
|
134
|
+
<div class="in">
|
|
135
|
+
${await Input.Render({
|
|
136
|
+
id: `recover-username`,
|
|
137
|
+
type: 'text',
|
|
138
|
+
label: html`<i class="fa-solid fa-pen-to-square"></i> ${Translate.Render('username')}`,
|
|
139
|
+
containerClass: `inl section-mp width-mini-box input-container ${
|
|
140
|
+
formData[`recover-username`].show() ? '' : 'hide'
|
|
141
|
+
}`,
|
|
142
|
+
placeholder: true,
|
|
143
|
+
})}
|
|
144
|
+
</div>
|
|
145
|
+
<div class="in">
|
|
146
|
+
${await Input.Render({
|
|
147
|
+
id: `recover-email`,
|
|
148
|
+
type: 'email',
|
|
149
|
+
label: html`<i class="fa-solid fa-envelope"></i> ${Translate.Render('email')}`,
|
|
150
|
+
containerClass: `inl section-mp width-mini-box input-container ${
|
|
151
|
+
formData[`recover-email`].show() ? '' : 'hide'
|
|
152
|
+
}`,
|
|
153
|
+
placeholder: true,
|
|
154
|
+
autocomplete: 'email',
|
|
155
|
+
})}
|
|
156
|
+
</div>
|
|
157
|
+
<div class="in">
|
|
158
|
+
${await Input.Render({
|
|
159
|
+
id: `recover-password`,
|
|
160
|
+
type: 'password',
|
|
161
|
+
autocomplete: 'new-password',
|
|
162
|
+
label: html`<i class="fa-solid fa-lock"></i> ${Translate.Render('password')}`,
|
|
163
|
+
containerClass: `inl section-mp width-mini-box input-container ${
|
|
164
|
+
formData[`recover-password`].show() ? '' : 'hide'
|
|
165
|
+
}`,
|
|
166
|
+
placeholder: true,
|
|
167
|
+
})}
|
|
168
|
+
</div>
|
|
169
|
+
<div class="in">
|
|
170
|
+
${await Input.Render({
|
|
171
|
+
id: `recover-repeat-password`,
|
|
172
|
+
type: 'password',
|
|
173
|
+
autocomplete: 'new-password',
|
|
174
|
+
label: html`<i class="fa-solid fa-lock"></i> ${Translate.Render('repeat')} ${Translate.Render('password')}`,
|
|
175
|
+
containerClass: `inl section-mp width-mini-box input-container ${
|
|
176
|
+
formData[`recover-repeat-password`].show() ? '' : 'hide'
|
|
177
|
+
}`,
|
|
178
|
+
placeholder: true,
|
|
179
|
+
})}
|
|
180
|
+
</div>
|
|
181
|
+
${options?.bottomRender ? await options.bottomRender() : ``}
|
|
182
|
+
<div class="in recover-send-btn-container">
|
|
183
|
+
${await BtnIcon.Render({
|
|
184
|
+
class: 'section-mp form-button btn-recover',
|
|
185
|
+
label: Translate.Render(mode === 'recover-verify-email' ? 'send-recover-verify-email' : 'change-password'),
|
|
186
|
+
type: 'button',
|
|
187
|
+
})}
|
|
188
|
+
</div>
|
|
189
|
+
<div class="in recover-resend-btn-container hide">
|
|
190
|
+
<div class="in section-mp form-button" style="color: #ed9d0f">
|
|
191
|
+
<i class="fa-solid fa-triangle-exclamation"></i> ${Translate.Render('15-min-valid-recover-email')}
|
|
192
|
+
</div>
|
|
193
|
+
${await BtnIcon.Render({
|
|
194
|
+
class: 'section-mp form-button btn-recover-resend',
|
|
195
|
+
label: html`${Translate.Render('resend')} ${Translate.Render('recover-verify-email')}`,
|
|
196
|
+
type: 'submit',
|
|
197
|
+
})}
|
|
198
|
+
</div>
|
|
199
|
+
</form>
|
|
200
|
+
`;
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export { Recover };
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { newInstance } from './CommonJs.js';
|
|
2
|
-
import { getResponsiveData } from './VanillaJs.js';
|
|
3
|
-
|
|
4
|
-
const Responsive = {
|
|
5
|
-
Data: {},
|
|
6
|
-
Event: {},
|
|
7
|
-
DelayEvent: {},
|
|
8
|
-
Observer: ResizeObserver,
|
|
9
|
-
getResponsiveData: function () {
|
|
10
|
-
return newInstance(this.Data);
|
|
11
|
-
},
|
|
12
|
-
getResponsiveDataAmplitude: function (options) {
|
|
13
|
-
const { dimAmplitude } = options;
|
|
14
|
-
const ResponsiveDataAmplitude = newInstance(this.Data);
|
|
15
|
-
ResponsiveDataAmplitude.minValue = ResponsiveDataAmplitude.minValue * dimAmplitude;
|
|
16
|
-
ResponsiveDataAmplitude.maxValue = ResponsiveDataAmplitude.maxValue * dimAmplitude;
|
|
17
|
-
ResponsiveDataAmplitude.width = ResponsiveDataAmplitude.width * dimAmplitude;
|
|
18
|
-
ResponsiveDataAmplitude.height = ResponsiveDataAmplitude.height * dimAmplitude;
|
|
19
|
-
return ResponsiveDataAmplitude;
|
|
20
|
-
},
|
|
21
|
-
resizeCallback: function () {
|
|
22
|
-
const Data = getResponsiveData();
|
|
23
|
-
if (Data.minValue !== Responsive.Data.minValue || Data.maxValue !== Responsive.Data.maxValue) {
|
|
24
|
-
Responsive.Data = Data;
|
|
25
|
-
Responsive.triggerEvents();
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
resize: 0,
|
|
29
|
-
Init: async function () {
|
|
30
|
-
Responsive.resizeCallback();
|
|
31
|
-
window.onresize = () => {
|
|
32
|
-
Responsive.resize++;
|
|
33
|
-
const resize = Responsive.resize;
|
|
34
|
-
Responsive.resizeCallback();
|
|
35
|
-
setTimeout(() => {
|
|
36
|
-
if (resize === Responsive.resize) {
|
|
37
|
-
Responsive.resizeCallback();
|
|
38
|
-
Responsive.resize = 0;
|
|
39
|
-
for (const event of Object.keys(Responsive.DelayEvent)) Responsive.DelayEvent[event]();
|
|
40
|
-
}
|
|
41
|
-
}, 750);
|
|
42
|
-
};
|
|
43
|
-
// alternative option
|
|
44
|
-
// this.Observer = new ResizeObserver(this.resizeCallback);
|
|
45
|
-
// this.Observer.observe(document.documentElement);
|
|
46
|
-
},
|
|
47
|
-
triggerEvents: function (keyEvent) {
|
|
48
|
-
if (keyEvent) return this.Event[keyEvent]();
|
|
49
|
-
return Object.keys(this.Event).map((key) => this.Event[key]());
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export { Responsive };
|
|
1
|
+
import { newInstance } from './CommonJs.js';
|
|
2
|
+
import { getResponsiveData } from './VanillaJs.js';
|
|
3
|
+
|
|
4
|
+
const Responsive = {
|
|
5
|
+
Data: {},
|
|
6
|
+
Event: {},
|
|
7
|
+
DelayEvent: {},
|
|
8
|
+
Observer: ResizeObserver,
|
|
9
|
+
getResponsiveData: function () {
|
|
10
|
+
return newInstance(this.Data);
|
|
11
|
+
},
|
|
12
|
+
getResponsiveDataAmplitude: function (options) {
|
|
13
|
+
const { dimAmplitude } = options;
|
|
14
|
+
const ResponsiveDataAmplitude = newInstance(this.Data);
|
|
15
|
+
ResponsiveDataAmplitude.minValue = ResponsiveDataAmplitude.minValue * dimAmplitude;
|
|
16
|
+
ResponsiveDataAmplitude.maxValue = ResponsiveDataAmplitude.maxValue * dimAmplitude;
|
|
17
|
+
ResponsiveDataAmplitude.width = ResponsiveDataAmplitude.width * dimAmplitude;
|
|
18
|
+
ResponsiveDataAmplitude.height = ResponsiveDataAmplitude.height * dimAmplitude;
|
|
19
|
+
return ResponsiveDataAmplitude;
|
|
20
|
+
},
|
|
21
|
+
resizeCallback: function () {
|
|
22
|
+
const Data = getResponsiveData();
|
|
23
|
+
if (Data.minValue !== Responsive.Data.minValue || Data.maxValue !== Responsive.Data.maxValue) {
|
|
24
|
+
Responsive.Data = Data;
|
|
25
|
+
Responsive.triggerEvents();
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
resize: 0,
|
|
29
|
+
Init: async function () {
|
|
30
|
+
Responsive.resizeCallback();
|
|
31
|
+
window.onresize = () => {
|
|
32
|
+
Responsive.resize++;
|
|
33
|
+
const resize = Responsive.resize;
|
|
34
|
+
Responsive.resizeCallback();
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
if (resize === Responsive.resize) {
|
|
37
|
+
Responsive.resizeCallback();
|
|
38
|
+
Responsive.resize = 0;
|
|
39
|
+
for (const event of Object.keys(Responsive.DelayEvent)) Responsive.DelayEvent[event]();
|
|
40
|
+
}
|
|
41
|
+
}, 750);
|
|
42
|
+
};
|
|
43
|
+
// alternative option
|
|
44
|
+
// this.Observer = new ResizeObserver(this.resizeCallback);
|
|
45
|
+
// this.Observer.observe(document.documentElement);
|
|
46
|
+
},
|
|
47
|
+
triggerEvents: function (keyEvent) {
|
|
48
|
+
if (keyEvent) return this.Event[keyEvent]();
|
|
49
|
+
return Object.keys(this.Event).map((key) => this.Event[key]());
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { Responsive };
|
|
@@ -1,27 +1,51 @@
|
|
|
1
|
-
import { getId } from './CommonJs.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.Tokens
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { getId, newInstance } from './CommonJs.js';
|
|
2
|
+
import { Modal } from './Modal.js';
|
|
3
|
+
import { s } from './VanillaJs.js';
|
|
4
|
+
|
|
5
|
+
const RichText = {
|
|
6
|
+
Tokens: {},
|
|
7
|
+
Render: async function (options = { id: '', parentIdModal: '' }) {
|
|
8
|
+
const id = options?.id ? options.id : getId(this.Tokens, 'rich-text-');
|
|
9
|
+
this.Tokens[id] = {};
|
|
10
|
+
let top, height;
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
const easyMDE = new EasyMDE({
|
|
13
|
+
element: s(`.${id}`),
|
|
14
|
+
onToggleFullScreen: (onFs) => {
|
|
15
|
+
if (onFs) {
|
|
16
|
+
if (options.parentIdModal) {
|
|
17
|
+
s(`.btn-bar-modal-container-${options.parentIdModal}`).classList.add('hide');
|
|
18
|
+
top = newInstance(s(`.${options.parentIdModal}`).style.top);
|
|
19
|
+
height = newInstance(s(`.${options.parentIdModal}`).style.height);
|
|
20
|
+
s(`.${options.parentIdModal}`).style.top = '0px';
|
|
21
|
+
s(`.${options.parentIdModal}`).style.height = `${window.innerHeight}px`;
|
|
22
|
+
}
|
|
23
|
+
Modal.cleanUI();
|
|
24
|
+
} else {
|
|
25
|
+
if (options.parentIdModal) {
|
|
26
|
+
s(`.btn-bar-modal-container-${options.parentIdModal}`).classList.remove('hide');
|
|
27
|
+
s(`.${options.parentIdModal}`).style.top = top;
|
|
28
|
+
s(`.${options.parentIdModal}`).style.height = height;
|
|
29
|
+
}
|
|
30
|
+
Modal.restoreUI();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
this.Tokens[id].easyMDE = easyMDE;
|
|
35
|
+
// easyMDE.value();
|
|
36
|
+
// easyMDE.value(val);
|
|
37
|
+
});
|
|
38
|
+
return html` <style>
|
|
39
|
+
.md-container {
|
|
40
|
+
background: white;
|
|
41
|
+
color: black;
|
|
42
|
+
}
|
|
43
|
+
.md-container button {
|
|
44
|
+
color: black !important;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
47
|
+
<div class="in md-container"><textarea class="${id}"></textarea></div>`;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { RichText };
|