@underpostnet/underpost 2.7.94 → 2.8.1
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/.vscode/settings.json +5 -1
- package/bin/deploy.js +41 -16
- package/bin/index.js +4 -5
- package/bin/util.js +18 -0
- package/conf.js +8 -1
- package/docker-compose.yml +1 -1
- package/package.json +11 -8
- package/src/api/user/user.model.js +1 -1
- package/src/api/user/user.service.js +22 -21
- package/src/client/components/core/Account.js +144 -124
- package/src/client/components/core/Auth.js +94 -1
- package/src/client/components/core/Docs.js +2 -1
- package/src/client/components/core/JoyStick.js +8 -5
- package/src/client/components/core/LogIn.js +8 -1
- package/src/client/components/core/LogOut.js +3 -2
- package/src/client/components/core/Modal.js +14 -9
- package/src/client/components/core/Panel.js +17 -3
- package/src/client/components/core/PanelForm.js +8 -1
- package/src/client/components/core/SignUp.js +3 -3
- package/src/client/components/core/SocketIo.js +2 -0
- package/src/client/components/core/Translate.js +14 -0
- package/src/client/components/core/Validator.js +9 -2
- package/src/client/components/core/VanillaJs.js +4 -1
- package/src/client/components/default/LogInDefault.js +2 -23
- package/src/client/components/default/LogOutDefault.js +3 -5
- package/src/client/public/default/plantuml/client-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-schema.svg +1 -1
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
- package/src/client/services/core/core.service.js +2 -0
- package/src/client/services/user/user.service.js +9 -1
- package/src/client/ssr/body/CacheControl.js +2 -1
- package/src/client/ssr/body/DefaultSplashScreen.js +3 -3
- package/src/client/ssr/offline/Maintenance.js +63 -0
- package/src/client/sw/default.sw.js +31 -5
- package/src/index.js +8 -0
- package/src/server/client-build.js +27 -25
- package/src/server/client-icons.js +13 -3
- package/src/server/conf.js +5 -4
- package/src/server/logger.js +8 -6
- package/src/server/network.js +4 -0
- package/src/server/ssl.js +2 -2
- package/src/server/valkey.js +126 -0
|
@@ -1,11 +1,11 @@
|
|
|
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 { newInstance, s4 } from './CommonJs.js';
|
|
4
5
|
import { renderStatus, renderWave } from './Css.js';
|
|
5
6
|
import { EventsUI } from './EventsUI.js';
|
|
6
7
|
import { fileFormDataFactory, Input } from './Input.js';
|
|
7
8
|
import { LogIn } from './LogIn.js';
|
|
8
|
-
import { LogOut } from './LogOut.js';
|
|
9
9
|
import { Modal } from './Modal.js';
|
|
10
10
|
import { NotificationManager } from './NotificationManager.js';
|
|
11
11
|
import { Translate } from './Translate.js';
|
|
@@ -21,19 +21,19 @@ const Account = {
|
|
|
21
21
|
const waveAnimationId = 'account-wave';
|
|
22
22
|
const profileFileAccept = ['image/png', 'image/jpeg'];
|
|
23
23
|
setTimeout(async () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
src="${LogIn.Scope.user.main.model.user.profileImage.imageSrc}"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
append(
|
|
25
|
+
`.wave-animation-container-${waveAnimationId}`,
|
|
26
|
+
html` <div class="abs center account-profile-image-container">
|
|
27
|
+
<img
|
|
28
|
+
class="abs center account-profile-image"
|
|
29
|
+
style="opacity: 1"
|
|
30
|
+
${LogIn.Scope.user.main.model.user.profileImage
|
|
31
|
+
? `src="${LogIn.Scope.user.main.model.user.profileImage.imageSrc}"`
|
|
32
|
+
: ''}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="abs center account-profile-image-loading" style="color: white"></div>`,
|
|
36
|
+
);
|
|
37
37
|
|
|
38
38
|
const formData = [
|
|
39
39
|
{
|
|
@@ -49,133 +49,141 @@ const Account = {
|
|
|
49
49
|
rules: [{ type: 'isStrongPassword' }],
|
|
50
50
|
},
|
|
51
51
|
];
|
|
52
|
-
const validators = await Validator.instance(formData);
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const submit = async () => {
|
|
60
|
-
lastUser = newInstance(user);
|
|
61
|
-
const { errorMessage } = await validators();
|
|
62
|
-
if (errorMessage) return;
|
|
63
|
-
const body = {};
|
|
53
|
+
this.formData = formData;
|
|
54
|
+
|
|
55
|
+
this.instanceModalUiEvents = async ({ user }) => {
|
|
56
|
+
const validators = await Validator.instance(formData);
|
|
57
|
+
|
|
64
58
|
for (const inputData of formData) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
body[inputData.model] = s(`.${inputData.id}`).value;
|
|
68
|
-
user[inputData.model] = s(`.${inputData.id}`).value;
|
|
69
|
-
}
|
|
59
|
+
s(`.${inputData.id}`).value =
|
|
60
|
+
!user[inputData.model] && inputData.defaultValue ? inputData.defaultValue : user[inputData.model];
|
|
70
61
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
html:
|
|
74
|
-
result.status === 'error' && result.message
|
|
75
|
-
? result.message
|
|
76
|
-
: Translate.Render(`${result.status}-update-user`),
|
|
77
|
-
status: result.status,
|
|
78
|
-
});
|
|
79
|
-
if (result.status === 'success') {
|
|
80
|
-
user = result.data;
|
|
81
|
-
this.triggerUpdateEvent({ user });
|
|
82
|
-
if (lastUser.emailConfirmed !== user.emailConfirmed) {
|
|
83
|
-
this.renderVerifyEmailStatus(user);
|
|
84
|
-
}
|
|
62
|
+
let lastUser;
|
|
63
|
+
const submit = async () => {
|
|
85
64
|
lastUser = newInstance(user);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (s(`.btn-confirm-email`))
|
|
98
|
-
EventsUI.onClick(`.btn-confirm-email`, async (e) => {
|
|
99
|
-
e.preventDefault();
|
|
100
|
-
const result = await UserService.post({
|
|
101
|
-
id: 'mailer/verify-email',
|
|
102
|
-
body: { email: s(`.account-email`).value },
|
|
103
|
-
});
|
|
65
|
+
const { successKeys } = await validators();
|
|
66
|
+
if (successKeys.length === 0) return;
|
|
67
|
+
const body = {};
|
|
68
|
+
for (const inputData of formData) {
|
|
69
|
+
if (!s(`.${inputData.id}`).value || s(`.${inputData.id}`).value === 'undefined') continue;
|
|
70
|
+
if ('model' in inputData && successKeys.includes(inputData.id)) {
|
|
71
|
+
body[inputData.model] = s(`.${inputData.id}`).value;
|
|
72
|
+
user[inputData.model] = s(`.${inputData.id}`).value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const result = await UserService.put({ id: user._id, body });
|
|
104
76
|
NotificationManager.Push({
|
|
105
|
-
html:
|
|
77
|
+
html:
|
|
78
|
+
result.status === 'error' && result.message
|
|
79
|
+
? result.message
|
|
80
|
+
: Translate.Render(`${result.status}-update-user`),
|
|
106
81
|
status: result.status,
|
|
107
82
|
});
|
|
83
|
+
if (result.status === 'success') {
|
|
84
|
+
user = result.data;
|
|
85
|
+
this.triggerUpdateEvent({ user });
|
|
86
|
+
if (lastUser.emailConfirmed !== user.emailConfirmed) {
|
|
87
|
+
this.renderVerifyEmailStatus(user);
|
|
88
|
+
}
|
|
89
|
+
lastUser = newInstance(user);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
EventsUI.onClick(`.btn-account`, async (e) => {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
await submit();
|
|
108
95
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
s(`.${waveAnimationId}`).style.cursor = 'pointer';
|
|
112
|
-
s(`.${waveAnimationId}`).onclick = async (e) => {
|
|
113
|
-
e.preventDefault();
|
|
114
|
-
s(`.account-profile-image-input`).click();
|
|
115
|
-
};
|
|
116
|
-
EventsUI.onChange(
|
|
117
|
-
`.account-profile-image-input`,
|
|
118
|
-
async (e) => {
|
|
96
|
+
EventsUI.onClick(`.btn-account-update-username`, async (e) => {
|
|
119
97
|
e.preventDefault();
|
|
120
|
-
|
|
121
|
-
|
|
98
|
+
await submit();
|
|
99
|
+
});
|
|
122
100
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
101
|
+
if (s(`.btn-confirm-email`))
|
|
102
|
+
EventsUI.onClick(`.btn-confirm-email`, async (e) => {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
const result = await UserService.post({
|
|
105
|
+
id: 'mailer/verify-email',
|
|
106
|
+
body: { email: s(`.account-email`).value },
|
|
107
|
+
});
|
|
108
|
+
NotificationManager.Push({
|
|
109
|
+
html: result.status === 'error' ? result.message : Translate.Render(`email send`),
|
|
110
|
+
status: result.status,
|
|
111
|
+
});
|
|
127
112
|
});
|
|
113
|
+
this.renderVerifyEmailStatus(user);
|
|
128
114
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
115
|
+
s(`.${waveAnimationId}`).style.cursor = 'pointer';
|
|
116
|
+
s(`.${waveAnimationId}`).onclick = async (e) => {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
s(`.account-profile-image-input`).click();
|
|
119
|
+
};
|
|
120
|
+
EventsUI.onChange(
|
|
121
|
+
`.account-profile-image-input`,
|
|
122
|
+
async (e) => {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
s(`.account-profile-image`).style.opacity = 0;
|
|
125
|
+
const formFile = fileFormDataFactory(e, profileFileAccept);
|
|
126
|
+
|
|
127
|
+
const { status, data } = await UserService.put({
|
|
128
|
+
id: `profile-image/${user._id}`,
|
|
129
|
+
body: formFile,
|
|
130
|
+
headerId: 'file',
|
|
138
131
|
});
|
|
139
|
-
}
|
|
140
132
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return html`
|
|
155
|
-
<div class="in section-mp" style="text-align: center">${Translate.Render('confirm-delete-account')}</div>
|
|
156
|
-
`;
|
|
133
|
+
if (status === 'success') {
|
|
134
|
+
user.profileImageId = data.profileImageId;
|
|
135
|
+
delete LogIn.Scope.user.main.model.user.profileImage;
|
|
136
|
+
await LogIn.Trigger({ user });
|
|
137
|
+
s(`.account-profile-image`).src = LogIn.Scope.user.main.model.user.profileImage.imageSrc;
|
|
138
|
+
} else {
|
|
139
|
+
NotificationManager.Push({
|
|
140
|
+
html: Translate.Render('file-upload-failed'),
|
|
141
|
+
status: 'error',
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
s(`.account-profile-image`).style.opacity = 1;
|
|
157
146
|
},
|
|
158
|
-
|
|
147
|
+
{ loadingContainer: `.account-profile-image-loading` },
|
|
148
|
+
);
|
|
149
|
+
s(`.btn-account-change-password`).onclick = (e) => {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
// s(`.btn-close-modal-account`).click();
|
|
152
|
+
s(`.main-btn-recover`).click();
|
|
153
|
+
};
|
|
154
|
+
s(`.btn-account-delete-confirm`).onclick = async (e) => {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
const confirmResult = await Modal.RenderConfirm({
|
|
157
|
+
html: async () => {
|
|
158
|
+
return html`
|
|
159
|
+
<div class="in section-mp" style="text-align: center">
|
|
160
|
+
${Translate.Render('confirm-delete-account')}
|
|
161
|
+
</div>
|
|
162
|
+
`;
|
|
163
|
+
},
|
|
164
|
+
id: 'delete-account-modal',
|
|
165
|
+
});
|
|
166
|
+
if (confirmResult.status === 'cancelled') return;
|
|
167
|
+
s(`.btn-account-delete-confirm`).classList.add('hide');
|
|
168
|
+
s(`.btn-account-delete`).classList.remove('hide');
|
|
169
|
+
s(`.btn-account-delete`).click();
|
|
170
|
+
};
|
|
171
|
+
EventsUI.onClick(`.btn-account-delete`, async (e) => {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
const result = await UserService.delete({ id: user._id });
|
|
174
|
+
NotificationManager.Push({
|
|
175
|
+
html: result.status === 'error' ? result.message : Translate.Render(`success-delete-account`),
|
|
176
|
+
status: result.status,
|
|
177
|
+
});
|
|
178
|
+
s(`.btn-account-delete-confirm`).classList.remove('hide');
|
|
179
|
+
s(`.btn-account-delete`).classList.add('hide');
|
|
180
|
+
if (result.status === 'success') {
|
|
181
|
+
s(`.main-btn-home`).click();
|
|
182
|
+
await Auth.sessionOut();
|
|
183
|
+
}
|
|
159
184
|
});
|
|
160
|
-
if (confirmResult.status === 'cancelled') return;
|
|
161
|
-
s(`.btn-account-delete-confirm`).classList.add('hide');
|
|
162
|
-
s(`.btn-account-delete`).classList.remove('hide');
|
|
163
|
-
s(`.btn-account-delete`).click();
|
|
164
185
|
};
|
|
165
|
-
|
|
166
|
-
e.preventDefault();
|
|
167
|
-
const result = await UserService.delete({ id: user._id });
|
|
168
|
-
NotificationManager.Push({
|
|
169
|
-
html: result.status === 'error' ? result.message : Translate.Render(`success-delete-account`),
|
|
170
|
-
status: result.status,
|
|
171
|
-
});
|
|
172
|
-
s(`.btn-account-delete-confirm`).classList.remove('hide');
|
|
173
|
-
s(`.btn-account-delete`).classList.add('hide');
|
|
174
|
-
if (result.status === 'success') {
|
|
175
|
-
LogOut.Trigger();
|
|
176
|
-
s(`.main-btn-home`).click();
|
|
177
|
-
}
|
|
178
|
-
});
|
|
186
|
+
await this.instanceModalUiEvents({ user });
|
|
179
187
|
});
|
|
180
188
|
return html`
|
|
181
189
|
<input type="file" accept="${profileFileAccept.join(', ')}" class="account-profile-image-input hide" />
|
|
@@ -285,6 +293,18 @@ const Account = {
|
|
|
285
293
|
if (user.emailConfirmed === true) s(`.account-email`).setAttribute('disabled', '');
|
|
286
294
|
}
|
|
287
295
|
},
|
|
296
|
+
instanceModalUiEvents: async (user) => null,
|
|
297
|
+
updateForm: async function (user) {
|
|
298
|
+
if (!s(`.modal-account`)) return;
|
|
299
|
+
await this.instanceModalUiEvents({ user });
|
|
300
|
+
s(`.account-profile-image`).style.opacity = 0;
|
|
301
|
+
for (const inputData of this.formData)
|
|
302
|
+
if (s(`.${inputData.id}`)) s(`.${inputData.id}`).value = user[inputData.model];
|
|
303
|
+
if (LogIn.Scope.user.main.model.user.profileImage) {
|
|
304
|
+
s(`.account-profile-image`).src = LogIn.Scope.user.main.model.user.profileImage.imageSrc;
|
|
305
|
+
s(`.account-profile-image`).style.opacity = 1;
|
|
306
|
+
}
|
|
307
|
+
},
|
|
288
308
|
};
|
|
289
309
|
|
|
290
310
|
export { Account };
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
import { UserMock, UserService } from '../../services/user/user.service.js';
|
|
2
|
+
import { Account } from './Account.js';
|
|
3
|
+
import { loggerFactory } from './Logger.js';
|
|
4
|
+
import { LogIn } from './LogIn.js';
|
|
5
|
+
import { LogOut } from './LogOut.js';
|
|
6
|
+
import { SignUp } from './SignUp.js';
|
|
7
|
+
|
|
8
|
+
const logger = loggerFactory(import.meta);
|
|
9
|
+
|
|
1
10
|
const token = Symbol('token');
|
|
2
11
|
|
|
12
|
+
const guestToken = Symbol('guestToken');
|
|
13
|
+
|
|
3
14
|
const Auth = {
|
|
4
15
|
[token]: '',
|
|
16
|
+
[guestToken]: '',
|
|
5
17
|
setToken: function (value = '') {
|
|
6
18
|
return (this[token] = value);
|
|
7
19
|
},
|
|
@@ -11,8 +23,89 @@ const Auth = {
|
|
|
11
23
|
getToken: function () {
|
|
12
24
|
return this[token];
|
|
13
25
|
},
|
|
26
|
+
setGuestToken: function (value = '') {
|
|
27
|
+
return (this[guestToken] = value);
|
|
28
|
+
},
|
|
29
|
+
deleteGuestToken: function () {
|
|
30
|
+
return (this[guestToken] = '');
|
|
31
|
+
},
|
|
32
|
+
getGuestToken: function () {
|
|
33
|
+
return this[guestToken];
|
|
34
|
+
},
|
|
35
|
+
// jwt
|
|
14
36
|
getJWT: function () {
|
|
15
|
-
return `Bearer ${this.getToken()}`;
|
|
37
|
+
return `Bearer ${this.getToken() ? this.getToken() : this.getGuestToken()}`;
|
|
38
|
+
},
|
|
39
|
+
signUpToken: async function (
|
|
40
|
+
result = {
|
|
41
|
+
data: {
|
|
42
|
+
token: '',
|
|
43
|
+
user: null,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
) {
|
|
47
|
+
try {
|
|
48
|
+
localStorage.setItem('jwt', result.data.token);
|
|
49
|
+
await SignUp.Trigger(result.data);
|
|
50
|
+
await Auth.sessionIn();
|
|
51
|
+
} catch (error) {
|
|
52
|
+
logger.error(error);
|
|
53
|
+
localStorage.removeItem('jwt');
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
sessionIn: async function (userServicePayload) {
|
|
57
|
+
try {
|
|
58
|
+
const token = userServicePayload?.data?.token ? userServicePayload.data.token : localStorage.getItem('jwt');
|
|
59
|
+
|
|
60
|
+
if (token) {
|
|
61
|
+
this.setToken(token);
|
|
62
|
+
const result = userServicePayload
|
|
63
|
+
? userServicePayload
|
|
64
|
+
: await (async () => {
|
|
65
|
+
const _result = await UserService.get({ id: 'auth' });
|
|
66
|
+
return {
|
|
67
|
+
status: _result.status,
|
|
68
|
+
data: {
|
|
69
|
+
user: _result.data,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
})();
|
|
73
|
+
const { status, data, message } = result;
|
|
74
|
+
if (status === 'success') {
|
|
75
|
+
localStorage.setItem('jwt', token);
|
|
76
|
+
await LogIn.Trigger({ user: data.user });
|
|
77
|
+
await Account.updateForm(data.user);
|
|
78
|
+
return { user: data.user };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// anon guest session
|
|
83
|
+
this.deleteToken();
|
|
84
|
+
localStorage.removeItem('jwt');
|
|
85
|
+
let guestToken = localStorage.getItem('jwt.g');
|
|
86
|
+
|
|
87
|
+
if (!guestToken) {
|
|
88
|
+
const result = await UserService.post({ id: 'guest' });
|
|
89
|
+
localStorage.setItem('jwt.g', result.data.token);
|
|
90
|
+
guestToken = result.data.token;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.setGuestToken(guestToken);
|
|
94
|
+
let { data, status, message } = await UserService.get({ id: 'auth' });
|
|
95
|
+
if (status === 'error') throw new Error(message);
|
|
96
|
+
await Account.updateForm(data);
|
|
97
|
+
return { user: data };
|
|
98
|
+
} catch (error) {
|
|
99
|
+
logger.error(error);
|
|
100
|
+
localStorage.removeItem('jwt');
|
|
101
|
+
localStorage.removeItem('jwt.g');
|
|
102
|
+
return { user: UserMock.default };
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
sessionOut: async function () {
|
|
106
|
+
this.deleteToken();
|
|
107
|
+
localStorage.removeItem('jwt');
|
|
108
|
+
await LogOut.Trigger(await this.sessionIn());
|
|
16
109
|
},
|
|
17
110
|
};
|
|
18
111
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _VERSION, CoreService } from '../../services/core/core.service.js';
|
|
1
2
|
import { Badge } from './Badge.js';
|
|
2
3
|
import { BtnIcon } from './BtnIcon.js';
|
|
3
4
|
import { rgbToHex } from './CommonJs.js';
|
|
@@ -79,7 +80,7 @@ const Docs = {
|
|
|
79
80
|
icon: html`<i class="fa-brands fa-osi"></i>`,
|
|
80
81
|
text: 'Source Docs',
|
|
81
82
|
url: function () {
|
|
82
|
-
return `${getProxyPath()}docs/engine
|
|
83
|
+
return `${getProxyPath()}docs/engine/${_VERSION}`;
|
|
83
84
|
},
|
|
84
85
|
},
|
|
85
86
|
{
|
|
@@ -24,13 +24,16 @@ const JoyStick = {
|
|
|
24
24
|
z-index: 3;
|
|
25
25
|
}
|
|
26
26
|
.joy-img-background-${id} {
|
|
27
|
-
width:
|
|
28
|
-
height:
|
|
27
|
+
width: 50%;
|
|
28
|
+
height: 50%;
|
|
29
29
|
opacity: 0.8;
|
|
30
|
+
transition: 0.1;
|
|
30
31
|
}
|
|
31
|
-
.dynamic-joystick-container-${id}:hover
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
.dynamic-joystick-container-${id}:hover {
|
|
33
|
+
}
|
|
34
|
+
.joy-img-background-${id}:hover {
|
|
35
|
+
width: 54%;
|
|
36
|
+
height: 54%;
|
|
34
37
|
opacity: 1;
|
|
35
38
|
}
|
|
36
39
|
</style>
|
|
@@ -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')
|
|
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
|
-
|
|
43
|
+
await Auth.sessionOut();
|
|
43
44
|
};
|
|
44
45
|
});
|
|
45
46
|
// Translate.Render('confirm-logout')
|
|
@@ -65,12 +65,6 @@ const Modal = {
|
|
|
65
65
|
options.heightTopBar = options.heightTopBar + options.heightBottomBar;
|
|
66
66
|
options.heightBottomBar = 0;
|
|
67
67
|
}
|
|
68
|
-
const setCenterRestore = () => {
|
|
69
|
-
const ResponsiveData = Responsive.getResponsiveData();
|
|
70
|
-
top = `${ResponsiveData.height / 2 - height / 2}px`;
|
|
71
|
-
left = `${ResponsiveData.width / 2 - width / 2}px`;
|
|
72
|
-
};
|
|
73
|
-
setCenterRestore();
|
|
74
68
|
let transition = `opacity 0.3s, box-shadow 0.3s, bottom 0.3s`;
|
|
75
69
|
const originSlideMenuWidth = 320;
|
|
76
70
|
const collapseSlideMenuWidth = 50;
|
|
@@ -87,8 +81,16 @@ const Modal = {
|
|
|
87
81
|
onObserverListener: {},
|
|
88
82
|
onClickListener: {},
|
|
89
83
|
onExpandUiListener: {},
|
|
84
|
+
onBarUiOpen: {},
|
|
85
|
+
onBarUiClose: {},
|
|
90
86
|
query: options.query ? `${window.location.search}` : undefined,
|
|
91
87
|
};
|
|
88
|
+
const setCenterRestore = () => {
|
|
89
|
+
const ResponsiveData = Responsive.getResponsiveData();
|
|
90
|
+
top = `${ResponsiveData.height / 2 - height / 2}px`;
|
|
91
|
+
left = `${ResponsiveData.width / 2 - width / 2}px`;
|
|
92
|
+
};
|
|
93
|
+
if (idModal !== 'main-body') setCenterRestore();
|
|
92
94
|
if (options && 'mode' in options) {
|
|
93
95
|
this.Data[idModal][options.mode] = {};
|
|
94
96
|
switch (options.mode) {
|
|
@@ -263,6 +265,7 @@ const Modal = {
|
|
|
263
265
|
<i class="fas fa-caret-up main-body-btn-ui-close"></i>
|
|
264
266
|
</div>
|
|
265
267
|
</div>
|
|
268
|
+
<div class="main-body-btn-container-custom"></div>
|
|
266
269
|
</div>
|
|
267
270
|
`,
|
|
268
271
|
);
|
|
@@ -286,6 +289,8 @@ const Modal = {
|
|
|
286
289
|
s(`.modal-menu`).style.top = '0px';
|
|
287
290
|
s(`.main-body-btn-container`).style.top = '50px';
|
|
288
291
|
s(`.main-body`).style.top = '0px';
|
|
292
|
+
for (const event of Object.keys(Modal.Data[idModal].onBarUiClose))
|
|
293
|
+
Modal.Data[idModal].onBarUiClose[event]();
|
|
289
294
|
} else {
|
|
290
295
|
s(`.main-body-btn-ui-close`).classList.remove('hide');
|
|
291
296
|
s(`.main-body-btn-ui-open`).classList.add('hide');
|
|
@@ -296,6 +301,8 @@ const Modal = {
|
|
|
296
301
|
s(`.slide-menu-top-bar`).classList.remove('hide');
|
|
297
302
|
s(`.bottom-bar`).classList.remove('hide');
|
|
298
303
|
s(`.main-body`).style.top = `${options.heightTopBar}px`;
|
|
304
|
+
for (const event of Object.keys(Modal.Data[idModal].onBarUiOpen))
|
|
305
|
+
Modal.Data[idModal].onBarUiOpen[event]();
|
|
299
306
|
}
|
|
300
307
|
Responsive.Event[`slide-menu-modal-menu`]();
|
|
301
308
|
Object.keys(this.Data).map((_idModal) => {
|
|
@@ -1321,7 +1328,6 @@ const Modal = {
|
|
|
1321
1328
|
case 'slide-menu-right':
|
|
1322
1329
|
case 'slide-menu-left':
|
|
1323
1330
|
const backMenuButtonEvent = async () => {
|
|
1324
|
-
if (location.pathname !== getProxyPath()) setPath(getProxyPath());
|
|
1325
1331
|
if (s(`.menu-btn-container-children`)) htmls(`.menu-btn-container-children`, '');
|
|
1326
1332
|
// htmls(`.nav-title-display-${'modal-menu'}`, html`<i class="fas fa-home"></i> ${Translate.Render('home')}`);
|
|
1327
1333
|
htmls(`.nav-title-display-${'modal-menu'}`, html``);
|
|
@@ -1340,8 +1346,7 @@ const Modal = {
|
|
|
1340
1346
|
backMenuButtonEvent();
|
|
1341
1347
|
}
|
|
1342
1348
|
s(`.btn-close-modal-menu`).click();
|
|
1343
|
-
|
|
1344
|
-
setPath(getProxyPath());
|
|
1349
|
+
setPath(getProxyPath());
|
|
1345
1350
|
setDocTitle({ ...options.RouterInstance, route: '' });
|
|
1346
1351
|
};
|
|
1347
1352
|
EventsUI.onClick(`.btn-icon-menu-back`, backMenuButtonEvent);
|
|
@@ -77,6 +77,7 @@ const Panel = {
|
|
|
77
77
|
const { id } = obj;
|
|
78
78
|
|
|
79
79
|
setTimeout(async () => {
|
|
80
|
+
if (!s(`.${idPanel}`)) return;
|
|
80
81
|
LoadingAnimation.spinner.play(`.${idPanel}-img-spinner-${id}`, 'dual-ring');
|
|
81
82
|
if (options && options.callBackPanelRender)
|
|
82
83
|
await options.callBackPanelRender({
|
|
@@ -372,13 +373,26 @@ const Panel = {
|
|
|
372
373
|
} else {
|
|
373
374
|
Responsive.Event[`${idPanel}-responsive`] = () => {
|
|
374
375
|
if (s(`.${idPanel}-form-container`))
|
|
375
|
-
s(`.${idPanel}-form-container`).style.maxHeight =
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
s(`.${idPanel}-form-container`).style.maxHeight =
|
|
377
|
+
options.route === 'home' &&
|
|
378
|
+
s(`.${idPanel}-form-body`) &&
|
|
379
|
+
!s(`.${idPanel}-form-body`).classList.contains('hide') &&
|
|
380
|
+
!s(`.main-body-btn-ui-open`).classList.contains('hide')
|
|
381
|
+
? `${window.innerHeight}px`
|
|
382
|
+
: `${window.innerHeight - heightTopBar - heightBottomBar}px`;
|
|
378
383
|
};
|
|
379
384
|
Responsive.Event[`${idPanel}-responsive`]();
|
|
380
385
|
}
|
|
381
386
|
};
|
|
387
|
+
if (options.route === 'home') {
|
|
388
|
+
Modal.Data['modal-menu'].onBarUiClose[`${idPanel}-responsive`] = () => {
|
|
389
|
+
resizeParentModal();
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
Modal.Data['modal-menu'].onBarUiOpen[`${idPanel}-responsive`] = () => {
|
|
393
|
+
resizeParentModal();
|
|
394
|
+
};
|
|
395
|
+
}
|
|
382
396
|
setTimeout(resizeParentModal);
|
|
383
397
|
if (options.route) {
|
|
384
398
|
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) {
|
|
@@ -455,7 +456,13 @@ const PanelForm = {
|
|
|
455
456
|
});
|
|
456
457
|
|
|
457
458
|
// if (options.route === 'home') setTimeout(this.Data[idPanel].updatePanel);
|
|
458
|
-
|
|
459
|
+
setTimeout(() => {
|
|
460
|
+
if (
|
|
461
|
+
options.route !== 'home' &&
|
|
462
|
+
(!PanelForm.Data[idPanel].originData || PanelForm.Data[idPanel].originData.length === 0)
|
|
463
|
+
)
|
|
464
|
+
this.Data[idPanel].updatePanel();
|
|
465
|
+
});
|
|
459
466
|
|
|
460
467
|
if (options.parentIdModal) {
|
|
461
468
|
htmls(`.html-${options.parentIdModal}`, await renderSrrPanelData());
|
|
@@ -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';
|
|
@@ -53,8 +53,8 @@ const SignUp = {
|
|
|
53
53
|
status: result.status,
|
|
54
54
|
});
|
|
55
55
|
if (result.status === 'success') {
|
|
56
|
-
await
|
|
57
|
-
|
|
56
|
+
await Auth.signUpToken(result);
|
|
57
|
+
s(`.btn-close-${options.idModal}`).click();
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
s(`.btn-sign-up-i-have-account`).onclick = () => {
|