@underpostnet/underpost 2.7.83 → 2.7.92
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/.github/workflows/ghpkg.yml +41 -1
- package/.github/workflows/pwa-microservices-template.page.yml +54 -0
- package/.vscode/settings.json +7 -0
- package/CHANGELOG.md +64 -16
- package/bin/cron.js +47 -0
- package/bin/db.js +60 -7
- package/bin/deploy.js +358 -26
- package/bin/file.js +18 -1
- package/bin/hwt.js +59 -0
- package/bin/index.js +1 -1
- package/bin/util.js +31 -1
- package/conf.js +46 -8
- package/docker-compose.yml +1 -1
- package/package.json +4 -4
- package/src/api/core/core.router.js +9 -9
- package/src/api/core/core.service.js +12 -4
- package/src/api/default/default.service.js +4 -4
- package/src/api/file/file.service.js +3 -3
- package/src/api/user/user.service.js +10 -8
- package/src/client/components/core/404.js +20 -0
- package/src/client/components/core/500.js +20 -0
- package/src/client/{ssr/common → components/core}/Alert.js +13 -11
- package/src/client/components/core/CommonJs.js +3 -0
- package/src/client/components/core/CssCore.js +30 -3
- package/src/client/components/core/Docs.js +110 -10
- package/src/client/components/core/LoadingAnimation.js +4 -2
- package/src/client/components/core/Modal.js +223 -22
- package/src/client/components/core/Panel.js +1 -1
- package/src/client/components/core/PanelForm.js +2 -1
- package/src/client/components/core/Responsive.js +34 -5
- package/src/client/components/core/RichText.js +4 -2
- package/src/client/components/core/Translate.js +21 -5
- package/src/client/components/core/VanillaJs.js +2 -1
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Worker.js +15 -18
- package/src/client/components/default/MenuDefault.js +68 -0
- package/src/client/components/default/RoutesDefault.js +2 -0
- package/src/client/public/default/plantuml/client-conf.svg +1 -1
- package/src/client/public/default/plantuml/client-schema.svg +1 -1
- package/src/client/public/default/plantuml/cron-conf.svg +1 -1
- package/src/client/public/default/plantuml/cron-schema.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/public/default/site.webmanifest +69 -0
- package/src/client/ssr/Render.js +1 -6
- package/src/client/ssr/{components/body → body}/CacheControl.js +1 -1
- package/src/client/ssr/head/Production.js +1 -0
- package/src/client/ssr/head/Pwa.js +146 -0
- package/src/client/ssr/head/Seo.js +14 -0
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +65 -0
- package/src/client/ssr/pages/Test.js +196 -0
- package/src/client/ssr/pages/maintenance.js +14 -0
- package/src/client/ssr/pages/offline.js +21 -0
- package/src/client/sw/default.sw.js +44 -165
- package/src/db/DataBaseProvider.js +12 -1
- package/src/db/mongo/MongooseDB.js +0 -1
- package/src/mailer/EmailRender.js +2 -4
- package/src/mailer/MailerProvider.js +4 -1
- package/src/runtime/lampp/Lampp.js +9 -9
- package/src/server/backup.js +82 -70
- package/src/server/client-build.js +133 -155
- package/src/server/client-formatted.js +2 -4
- package/src/server/conf.js +114 -23
- package/src/server/crypto.js +91 -0
- package/src/server/dns.js +48 -16
- package/src/server/network.js +94 -7
- package/src/server/proxy.js +26 -28
- package/src/server/runtime.js +42 -12
- package/src/server/ssl.js +2 -2
- package/src/client/ssr/common/SsrCore.js +0 -91
- package/src/client/ssr/common/Translate.js +0 -26
- package/src/client/ssr/common/Worker.js +0 -28
- package/src/client/ssr/components/head/PwaDefault.js +0 -60
- package/src/client/ssr/offline/default.index.js +0 -31
- package/src/cron.js +0 -30
- package/src/server/cron.js +0 -35
- /package/src/client/ssr/{components/body → body}/DefaultSplashScreen.js +0 -0
- /package/src/client/ssr/{components/email → email}/DefaultRecoverEmail.js +0 -0
- /package/src/client/ssr/{components/email → email}/DefaultVerifyEmail.js +0 -0
- /package/src/client/ssr/{components/head → head}/Css.js +0 -0
- /package/src/client/ssr/{components/head → head}/DefaultScripts.js +0 -0
package/conf.js
CHANGED
|
@@ -2,8 +2,14 @@ const DefaultConf = {
|
|
|
2
2
|
client: {
|
|
3
3
|
default: {
|
|
4
4
|
metadata: {
|
|
5
|
-
title: '
|
|
5
|
+
title: 'Demo App',
|
|
6
6
|
backgroundImage: './src/client/public/default/assets/background/white0-min.jpg',
|
|
7
|
+
description: 'Web application',
|
|
8
|
+
keywords: ['web', 'app', 'spa', 'demo', 'github-pages'],
|
|
9
|
+
author: 'https://github.com/underpostnet',
|
|
10
|
+
thumbnail: 'android-chrome-384x384.png',
|
|
11
|
+
themeColor: '#ececec',
|
|
12
|
+
pwaAssetsPath: '',
|
|
7
13
|
},
|
|
8
14
|
components: {
|
|
9
15
|
core: [
|
|
@@ -50,6 +56,9 @@ const DefaultConf = {
|
|
|
50
56
|
'Panel',
|
|
51
57
|
'PanelForm',
|
|
52
58
|
'Scroll',
|
|
59
|
+
'Alert',
|
|
60
|
+
'404',
|
|
61
|
+
'500',
|
|
53
62
|
],
|
|
54
63
|
default: [
|
|
55
64
|
'MenuDefault',
|
|
@@ -118,6 +127,8 @@ const DefaultConf = {
|
|
|
118
127
|
client: 'Default',
|
|
119
128
|
ssr: 'Default',
|
|
120
129
|
},
|
|
130
|
+
{ client: 'Default', ssr: 'Default', path: '/404', title: '404 Not Found' },
|
|
131
|
+
{ client: 'Default', ssr: 'Default', path: '/500', title: '500 Server Error' },
|
|
121
132
|
],
|
|
122
133
|
dists: [
|
|
123
134
|
{
|
|
@@ -168,8 +179,30 @@ const DefaultConf = {
|
|
|
168
179
|
},
|
|
169
180
|
ssr: {
|
|
170
181
|
Default: {
|
|
171
|
-
head: ['
|
|
182
|
+
head: ['Seo', 'Pwa', 'Css', 'DefaultScripts', 'Production'],
|
|
172
183
|
body: ['CacheControl', 'DefaultSplashScreen'],
|
|
184
|
+
mailer: {
|
|
185
|
+
userVerifyEmail: 'DefaultVerifyEmail',
|
|
186
|
+
userRecoverEmail: 'DefaultRecoverEmail',
|
|
187
|
+
},
|
|
188
|
+
offline: [
|
|
189
|
+
{
|
|
190
|
+
path: '/offline',
|
|
191
|
+
title: 'No Network Connection',
|
|
192
|
+
client: 'NoNetworkConnection',
|
|
193
|
+
head: [],
|
|
194
|
+
body: [],
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
pages: [
|
|
198
|
+
{
|
|
199
|
+
path: '/test',
|
|
200
|
+
title: 'Test',
|
|
201
|
+
client: 'Test',
|
|
202
|
+
head: [],
|
|
203
|
+
body: [],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
173
206
|
},
|
|
174
207
|
},
|
|
175
208
|
server: {
|
|
@@ -183,6 +216,7 @@ const DefaultConf = {
|
|
|
183
216
|
iconsBuild: true,
|
|
184
217
|
liteBuild: false,
|
|
185
218
|
docsBuild: false,
|
|
219
|
+
offlineBuild: false,
|
|
186
220
|
ws: 'core',
|
|
187
221
|
peer: true,
|
|
188
222
|
proxy: [80, 443],
|
|
@@ -205,10 +239,6 @@ const DefaultConf = {
|
|
|
205
239
|
pass: '',
|
|
206
240
|
},
|
|
207
241
|
},
|
|
208
|
-
templates: {
|
|
209
|
-
userVerifyEmail: 'DefaultVerifyEmail',
|
|
210
|
-
userRecoverEmail: 'DefaultRecoverEmail',
|
|
211
|
-
},
|
|
212
242
|
},
|
|
213
243
|
},
|
|
214
244
|
},
|
|
@@ -227,8 +257,6 @@ const DefaultConf = {
|
|
|
227
257
|
cron: {
|
|
228
258
|
ipDaemon: {
|
|
229
259
|
ip: null,
|
|
230
|
-
minutesTimeInterval: 3,
|
|
231
|
-
disabled: false,
|
|
232
260
|
},
|
|
233
261
|
records: {
|
|
234
262
|
A: [
|
|
@@ -245,6 +273,16 @@ const DefaultConf = {
|
|
|
245
273
|
deployGroupId: 'default-group',
|
|
246
274
|
},
|
|
247
275
|
],
|
|
276
|
+
jobs: {
|
|
277
|
+
dns: {
|
|
278
|
+
expression: '* * * * *',
|
|
279
|
+
enabled: true,
|
|
280
|
+
},
|
|
281
|
+
backups: {
|
|
282
|
+
expression: '0 1 * * *',
|
|
283
|
+
enabled: true,
|
|
284
|
+
},
|
|
285
|
+
},
|
|
248
286
|
},
|
|
249
287
|
};
|
|
250
288
|
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "@underpostnet/underpost",
|
|
5
|
-
"version": "2.7.
|
|
5
|
+
"version": "2.7.92",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
9
9
|
"pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine && pm2 logs",
|
|
10
10
|
"ssl": "env-cmd -f .env.production node bin/ssl",
|
|
11
11
|
"pm2-delete": "pm2 delete engine",
|
|
12
|
-
"build": "node bin/deploy build-full-client
|
|
12
|
+
"build": "node bin/deploy build-full-client",
|
|
13
|
+
"build-production": "env-cmd -f .env.production node bin/deploy build-full-client",
|
|
13
14
|
"dev": "env-cmd -f .env.development node src/client.dev --no-warnings",
|
|
14
15
|
"dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
|
|
15
16
|
"docs": "jsdoc -c jsdoc.json",
|
|
@@ -95,7 +96,6 @@
|
|
|
95
96
|
"marked": "^12.0.2",
|
|
96
97
|
"mongoose": "^8.0.1",
|
|
97
98
|
"morgan": "^1.10.0",
|
|
98
|
-
"node-cron": "^3.0.3",
|
|
99
99
|
"nodemailer": "^6.9.9",
|
|
100
100
|
"nodemon": "^3.0.1",
|
|
101
101
|
"pathfinding": "^0.4.18",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"mocha": "^10.4.0",
|
|
125
125
|
"plantuml": "^0.0.2",
|
|
126
126
|
"swagger-autogen": "^2.23.7",
|
|
127
|
-
"
|
|
127
|
+
"easy-json-schema": "^0.0.2-beta"
|
|
128
128
|
},
|
|
129
129
|
"publishConfig": {
|
|
130
130
|
"provenance": true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { authMiddleware } from '../../server/auth.js';
|
|
1
|
+
import { adminGuard, authMiddleware } from '../../server/auth.js';
|
|
2
2
|
import { loggerFactory } from '../../server/logger.js';
|
|
3
3
|
import { CoreController } from './core.controller.js';
|
|
4
4
|
import express from 'express';
|
|
@@ -7,14 +7,14 @@ const logger = loggerFactory(import.meta);
|
|
|
7
7
|
|
|
8
8
|
const CoreRouter = (options) => {
|
|
9
9
|
const router = express.Router();
|
|
10
|
-
router.post(`/:id`, async (req, res) => await CoreController.post(req, res, options));
|
|
11
|
-
router.post(`/`, async (req, res) => await CoreController.post(req, res, options));
|
|
12
|
-
router.get(`/:id`, async (req, res) => await CoreController.get(req, res, options));
|
|
13
|
-
router.get(`/`, async (req, res) => await CoreController.get(req, res, options));
|
|
14
|
-
router.put(`/:id`, async (req, res) => await CoreController.put(req, res, options));
|
|
15
|
-
router.put(`/`, async (req, res) => await CoreController.put(req, res, options));
|
|
16
|
-
router.delete(`/:id`, async (req, res) => await CoreController.delete(req, res, options));
|
|
17
|
-
router.delete(`/`, async (req, res) => await CoreController.delete(req, res, options));
|
|
10
|
+
router.post(`/:id`, authMiddleware, adminGuard, async (req, res) => await CoreController.post(req, res, options));
|
|
11
|
+
router.post(`/`, authMiddleware, adminGuard, async (req, res) => await CoreController.post(req, res, options));
|
|
12
|
+
router.get(`/:id`, authMiddleware, adminGuard, async (req, res) => await CoreController.get(req, res, options));
|
|
13
|
+
router.get(`/`, authMiddleware, adminGuard, async (req, res) => await CoreController.get(req, res, options));
|
|
14
|
+
router.put(`/:id`, authMiddleware, adminGuard, async (req, res) => await CoreController.put(req, res, options));
|
|
15
|
+
router.put(`/`, authMiddleware, adminGuard, async (req, res) => await CoreController.put(req, res, options));
|
|
16
|
+
router.delete(`/:id`, authMiddleware, adminGuard, async (req, res) => await CoreController.delete(req, res, options));
|
|
17
|
+
router.delete(`/`, authMiddleware, adminGuard, async (req, res) => await CoreController.delete(req, res, options));
|
|
18
18
|
return router;
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
import { DataBaseProvider } from '../../db/DataBaseProvider.js';
|
|
2
2
|
import { loggerFactory } from '../../server/logger.js';
|
|
3
|
+
import { shellExec } from '../../server/process.js';
|
|
3
4
|
|
|
4
5
|
const logger = loggerFactory(import.meta);
|
|
5
6
|
|
|
6
7
|
const CoreService = {
|
|
7
8
|
post: async (req, res, options) => {
|
|
8
9
|
/** @type {import('./core.model.js').CoreModel} */
|
|
9
|
-
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.Core;
|
|
10
|
+
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Core;
|
|
11
|
+
if (req.path.startsWith('/sh')) {
|
|
12
|
+
shellExec(req.body.sh, { stdout: true, async: true });
|
|
13
|
+
return {
|
|
14
|
+
status: 'success',
|
|
15
|
+
message: 'Command "' + req.body.sh + '" running',
|
|
16
|
+
};
|
|
17
|
+
}
|
|
10
18
|
return await new Core(req.body).save();
|
|
11
19
|
},
|
|
12
20
|
get: async (req, res, options) => {
|
|
13
21
|
/** @type {import('./core.model.js').CoreModel} */
|
|
14
|
-
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.Core;
|
|
22
|
+
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Core;
|
|
15
23
|
return await Core.findById(req.params.id);
|
|
16
24
|
},
|
|
17
25
|
put: async (req, res, options) => {
|
|
18
26
|
/** @type {import('./core.model.js').CoreModel} */
|
|
19
|
-
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.Core;
|
|
27
|
+
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Core;
|
|
20
28
|
return await Core.findByIdAndUpdate(req.params.id, req.body);
|
|
21
29
|
},
|
|
22
30
|
delete: async (req, res, options) => {
|
|
23
31
|
/** @type {import('./core.model.js').CoreModel} */
|
|
24
|
-
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.Core;
|
|
32
|
+
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Core;
|
|
25
33
|
return await Core.findByIdAndDelete(req.params.id);
|
|
26
34
|
},
|
|
27
35
|
};
|
|
@@ -6,23 +6,23 @@ const logger = loggerFactory(import.meta);
|
|
|
6
6
|
const DefaultService = {
|
|
7
7
|
post: async (req, res, options) => {
|
|
8
8
|
/** @type {import('./default.model.js').DefaultModel} */
|
|
9
|
-
const Default = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.Default;
|
|
9
|
+
const Default = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Default;
|
|
10
10
|
return await new Default(req.body).save();
|
|
11
11
|
},
|
|
12
12
|
get: async (req, res, options) => {
|
|
13
13
|
/** @type {import('./default.model.js').DefaultModel} */
|
|
14
|
-
const Default = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.Default;
|
|
14
|
+
const Default = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Default;
|
|
15
15
|
if (req.params.id) return await Default.findById(req.params.id);
|
|
16
16
|
return await Default.find();
|
|
17
17
|
},
|
|
18
18
|
put: async (req, res, options) => {
|
|
19
19
|
/** @type {import('./default.model.js').DefaultModel} */
|
|
20
|
-
const Default = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.Default;
|
|
20
|
+
const Default = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Default;
|
|
21
21
|
return await Default.findByIdAndUpdate(req.params.id, req.body);
|
|
22
22
|
},
|
|
23
23
|
delete: async (req, res, options) => {
|
|
24
24
|
/** @type {import('./default.model.js').DefaultModel} */
|
|
25
|
-
const Default = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.Default;
|
|
25
|
+
const Default = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Default;
|
|
26
26
|
if (req.params.id) return await Default.findByIdAndDelete(req.params.id);
|
|
27
27
|
else return await await Default.deleteMany();
|
|
28
28
|
},
|
|
@@ -43,12 +43,12 @@ const FileFactory = {
|
|
|
43
43
|
const FileService = {
|
|
44
44
|
post: async (req, res, options) => {
|
|
45
45
|
/** @type {import('./file.model.js').FileModel} */
|
|
46
|
-
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.File;
|
|
46
|
+
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.File;
|
|
47
47
|
return await FileFactory.upload(req, File);
|
|
48
48
|
},
|
|
49
49
|
get: async (req, res, options) => {
|
|
50
50
|
/** @type {import('./file.model.js').FileModel} */
|
|
51
|
-
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.File;
|
|
51
|
+
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.File;
|
|
52
52
|
|
|
53
53
|
if (req.path.startsWith('/blob') && req.params.id) {
|
|
54
54
|
const file = await File.findOne({ _id: req.params.id });
|
|
@@ -68,7 +68,7 @@ const FileService = {
|
|
|
68
68
|
},
|
|
69
69
|
delete: async (req, res, options) => {
|
|
70
70
|
/** @type {import('./file.model.js').FileModel} */
|
|
71
|
-
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.File;
|
|
71
|
+
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.File;
|
|
72
72
|
|
|
73
73
|
switch (req.params.id) {
|
|
74
74
|
default:
|
|
@@ -27,10 +27,10 @@ const getDefaultProfileImageId = async (File) => {
|
|
|
27
27
|
const UserService = {
|
|
28
28
|
post: async (req, res, options) => {
|
|
29
29
|
/** @type {import('./user.model.js').UserModel} */
|
|
30
|
-
const User = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.User;
|
|
30
|
+
const User = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.User;
|
|
31
31
|
|
|
32
32
|
/** @type {import('../file/file.model.js').FileModel} */
|
|
33
|
-
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.File;
|
|
33
|
+
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.File;
|
|
34
34
|
|
|
35
35
|
if (req.params.id === 'recover-verify-email') {
|
|
36
36
|
const user = await User.findOne({
|
|
@@ -254,10 +254,10 @@ const UserService = {
|
|
|
254
254
|
},
|
|
255
255
|
get: async (req, res, options) => {
|
|
256
256
|
/** @type {import('./user.model.js').UserModel} */
|
|
257
|
-
const User = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.User;
|
|
257
|
+
const User = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.User;
|
|
258
258
|
|
|
259
259
|
/** @type {import('../file/file.model.js').FileModel} */
|
|
260
|
-
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.File;
|
|
260
|
+
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.File;
|
|
261
261
|
|
|
262
262
|
if (req.path.startsWith('/email')) {
|
|
263
263
|
return await User.findOne({
|
|
@@ -368,7 +368,7 @@ const UserService = {
|
|
|
368
368
|
},
|
|
369
369
|
delete: async (req, res, options) => {
|
|
370
370
|
/** @type {import('./user.model.js').UserModel} */
|
|
371
|
-
const User = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.User;
|
|
371
|
+
const User = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.User;
|
|
372
372
|
switch (req.params.id) {
|
|
373
373
|
default: {
|
|
374
374
|
const user = await User.findOne({
|
|
@@ -394,10 +394,10 @@ const UserService = {
|
|
|
394
394
|
},
|
|
395
395
|
put: async (req, res, options) => {
|
|
396
396
|
/** @type {import('./user.model.js').UserModel} */
|
|
397
|
-
const User = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.User;
|
|
397
|
+
const User = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.User;
|
|
398
398
|
|
|
399
399
|
/** @type {import('../file/file.model.js').FileModel} */
|
|
400
|
-
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.File;
|
|
400
|
+
const File = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.File;
|
|
401
401
|
|
|
402
402
|
// req.path | req.baseUrl
|
|
403
403
|
|
|
@@ -449,7 +449,9 @@ const UserService = {
|
|
|
449
449
|
});
|
|
450
450
|
switch (user.role) {
|
|
451
451
|
case 'admin': {
|
|
452
|
-
if (req.body.password
|
|
452
|
+
if (req.body.password !== undefined && req.body.password !== user.password)
|
|
453
|
+
req.body.password = await hashPassword(req.body.password);
|
|
454
|
+
else delete req.body.password;
|
|
453
455
|
return await User.findByIdAndUpdate(req.params.id, req.body, {
|
|
454
456
|
runValidators: true,
|
|
455
457
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Alert } from './Alert.js';
|
|
2
|
+
import { Modal } from './Modal.js';
|
|
3
|
+
import { s } from './VanillaJs.js';
|
|
4
|
+
|
|
5
|
+
const Page404 = {
|
|
6
|
+
Render: async function (options = { idModal: '' }) {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
Modal.Data[options.idModal].onObserverListener['404'] = () => {
|
|
9
|
+
if (s(`.container-404-${options.idModal}`))
|
|
10
|
+
s(`.container-404-${options.idModal}`).style.height = `${
|
|
11
|
+
s(`.${options.idModal}`).offsetHeight - Modal.headerTitleHeight
|
|
12
|
+
}px`;
|
|
13
|
+
};
|
|
14
|
+
Modal.Data[options.idModal].onObserverListener['404']();
|
|
15
|
+
});
|
|
16
|
+
return html`<div class="in container-404-${options.idModal}">${await Alert.e404()}</div>`;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { Page404 };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Alert } from './Alert.js';
|
|
2
|
+
import { Modal } from './Modal.js';
|
|
3
|
+
import { s } from './VanillaJs.js';
|
|
4
|
+
|
|
5
|
+
const Page500 = {
|
|
6
|
+
Render: async function (options = { idModal: '' }) {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
Modal.Data[options.idModal].onObserverListener['500'] = () => {
|
|
9
|
+
if (s(`.container-500-${options.idModal}`))
|
|
10
|
+
s(`.container-500-${options.idModal}`).style.height = `${
|
|
11
|
+
s(`.${options.idModal}`).offsetHeight - Modal.headerTitleHeight
|
|
12
|
+
}px`;
|
|
13
|
+
};
|
|
14
|
+
Modal.Data[options.idModal].onObserverListener['500']();
|
|
15
|
+
});
|
|
16
|
+
return html`<div class="in container-500-${options.idModal}">${await Alert.e500()}</div>`;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { Page500 };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Translate } from './Translate.js';
|
|
2
|
+
|
|
3
|
+
const maintenance = async () => {
|
|
2
4
|
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24">
|
|
3
5
|
<path
|
|
4
6
|
fill="none"
|
|
@@ -12,11 +14,11 @@ const maintenance = async ({ Translate }) => {
|
|
|
12
14
|
return html` <div class="abs center" style="top: 45%">
|
|
13
15
|
${icon}
|
|
14
16
|
<br />
|
|
15
|
-
<br />${Translate('server-maintenance')}
|
|
17
|
+
<br />${Translate.Render('server-maintenance')}
|
|
16
18
|
</div>`;
|
|
17
19
|
};
|
|
18
20
|
|
|
19
|
-
const noInternet = async (
|
|
21
|
+
const noInternet = async () => {
|
|
20
22
|
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 20 20">
|
|
21
23
|
<path
|
|
22
24
|
fill="currentColor"
|
|
@@ -26,11 +28,11 @@ const noInternet = async ({ Translate }) => {
|
|
|
26
28
|
return html` <div class="abs center" style="top: 45%">
|
|
27
29
|
${icon}
|
|
28
30
|
<br />
|
|
29
|
-
<br />${Translate('no-internet-connection')}
|
|
31
|
+
<br />${Translate.Render('no-internet-connection')}
|
|
30
32
|
</div>`;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
const e404 = async (
|
|
35
|
+
const e404 = async () => {
|
|
34
36
|
const icon = html`
|
|
35
37
|
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24">
|
|
36
38
|
<path
|
|
@@ -45,13 +47,13 @@ const e404 = async ({ Translate }) => {
|
|
|
45
47
|
<br />
|
|
46
48
|
<span class="bold">404</span>
|
|
47
49
|
<br />
|
|
48
|
-
<br />${Translate('page-not-found')} <br />
|
|
50
|
+
<br />${Translate.Render('page-not-found')} <br />
|
|
49
51
|
<br />
|
|
50
|
-
<a href="${location.origin}">${Translate('back')}</a>
|
|
52
|
+
<a href="${location.origin}">${Translate.Render('back')}</a>
|
|
51
53
|
</div>`;
|
|
52
54
|
};
|
|
53
55
|
|
|
54
|
-
const e500 = async (
|
|
56
|
+
const e500 = async () => {
|
|
55
57
|
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 20 20">
|
|
56
58
|
<path
|
|
57
59
|
fill="currentColor"
|
|
@@ -64,12 +66,12 @@ const e500 = async ({ Translate }) => {
|
|
|
64
66
|
<br />
|
|
65
67
|
<span class="bold">500</span>
|
|
66
68
|
<br />
|
|
67
|
-
<br />${Translate('page-broken')} <br />
|
|
69
|
+
<br />${Translate.Render('page-broken')} <br />
|
|
68
70
|
<br />
|
|
69
|
-
<a href="${location.origin}">${Translate('back')}</a>
|
|
71
|
+
<a href="${location.origin}">${Translate.Render('back')}</a>
|
|
70
72
|
</div>`;
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
const Alert = { maintenance, noInternet, e404, e500 };
|
|
74
76
|
|
|
75
|
-
export { Alert
|
|
77
|
+
export { Alert };
|
|
@@ -683,6 +683,8 @@ const getCapVariableName = (value = 'default') => cap(value.replaceAll('-', ' ')
|
|
|
683
683
|
|
|
684
684
|
const hexToNumber = (hex = 0xdc) => Number(hex) || parseFloat(hex, 16);
|
|
685
685
|
|
|
686
|
+
const numberToHex = (number = 0) => number.toString(16);
|
|
687
|
+
|
|
686
688
|
// 0x = Hexadecimal
|
|
687
689
|
// 0b = Binary
|
|
688
690
|
// 0o = Octal
|
|
@@ -739,4 +741,5 @@ export {
|
|
|
739
741
|
rgbToHex,
|
|
740
742
|
getCapVariableName,
|
|
741
743
|
hexToNumber,
|
|
744
|
+
numberToHex,
|
|
742
745
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgGrid } from './AgGrid.js';
|
|
2
|
-
import { boxShadow, scrollBarDarkRender, scrollBarLightRender } from './Css.js';
|
|
2
|
+
import { borderChar, boxShadow, scrollBarDarkRender, scrollBarLightRender } from './Css.js';
|
|
3
3
|
import { LoadingAnimation } from './LoadingAnimation.js';
|
|
4
4
|
import { append, getProxyPath, s } from './VanillaJs.js';
|
|
5
5
|
|
|
@@ -135,6 +135,21 @@ const CssCommonCore = async () => {
|
|
|
135
135
|
width: 100%;
|
|
136
136
|
height: auto;
|
|
137
137
|
}
|
|
138
|
+
.down-arrow-submenu {
|
|
139
|
+
top: -20px;
|
|
140
|
+
text-align: right;
|
|
141
|
+
padding-right: 42px;
|
|
142
|
+
color: #5f5f5f;
|
|
143
|
+
}
|
|
144
|
+
.main-body-btn {
|
|
145
|
+
width: 50px;
|
|
146
|
+
height: 50px;
|
|
147
|
+
font-size: 18px;
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
}
|
|
150
|
+
.main-body-btn:hover {
|
|
151
|
+
font-size: 21px;
|
|
152
|
+
}
|
|
138
153
|
</style>
|
|
139
154
|
<style>
|
|
140
155
|
.lds-dual-ring,
|
|
@@ -484,6 +499,12 @@ const CssCoreDark = {
|
|
|
484
499
|
a:hover {
|
|
485
500
|
color: #cdcdcd;
|
|
486
501
|
}
|
|
502
|
+
.ac {
|
|
503
|
+
color: #b1a7a7 !important;
|
|
504
|
+
}
|
|
505
|
+
.ahc {
|
|
506
|
+
color: #cdcdcd !important;
|
|
507
|
+
}
|
|
487
508
|
.content-render {
|
|
488
509
|
font-size: 16px;
|
|
489
510
|
font-family: monospace;
|
|
@@ -499,7 +520,7 @@ const CssCoreDark = {
|
|
|
499
520
|
.btn-input-extension:hover {
|
|
500
521
|
}
|
|
501
522
|
</style>
|
|
502
|
-
${scrollBarDarkRender()}
|
|
523
|
+
${scrollBarDarkRender()} ${borderChar(1, 'black', ['.main-body-btn-container'])}
|
|
503
524
|
`,
|
|
504
525
|
};
|
|
505
526
|
|
|
@@ -795,6 +816,12 @@ const CssCoreLight = {
|
|
|
795
816
|
a:hover {
|
|
796
817
|
color: #e89f4c;
|
|
797
818
|
}
|
|
819
|
+
.ac {
|
|
820
|
+
color: #6d68ff !important;
|
|
821
|
+
}
|
|
822
|
+
.ahc {
|
|
823
|
+
color: #e89f4c !important;
|
|
824
|
+
}
|
|
798
825
|
.content-render {
|
|
799
826
|
font-size: 16px;
|
|
800
827
|
font-family: monospace;
|
|
@@ -810,7 +837,7 @@ const CssCoreLight = {
|
|
|
810
837
|
.btn-input-extension:hover {
|
|
811
838
|
}
|
|
812
839
|
</style>
|
|
813
|
-
${scrollBarLightRender()}
|
|
840
|
+
${scrollBarLightRender()} ${borderChar(1, 'white', ['.main-body-btn-container'])}
|
|
814
841
|
`,
|
|
815
842
|
};
|
|
816
843
|
|