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
package/.vscode/settings.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"cSpell.words": [
|
|
13
13
|
"ANAME",
|
|
14
14
|
"browserconfig",
|
|
15
|
+
"Bymyelectrics",
|
|
15
16
|
"certbot",
|
|
16
17
|
"certonly",
|
|
17
18
|
"changefreq",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"lampp",
|
|
44
45
|
"loadingio",
|
|
45
46
|
"Longname",
|
|
47
|
+
"metanarrative",
|
|
46
48
|
"Microdata",
|
|
47
49
|
"minami",
|
|
48
50
|
"MMORPG",
|
|
@@ -60,6 +62,8 @@
|
|
|
60
62
|
"Tokenomics",
|
|
61
63
|
"underpost",
|
|
62
64
|
"Unequip",
|
|
65
|
+
"uuidv",
|
|
66
|
+
"Valkey",
|
|
63
67
|
"webroot",
|
|
64
68
|
"xampp",
|
|
65
69
|
"xfwd",
|
|
@@ -74,7 +78,7 @@
|
|
|
74
78
|
"[xml]": {
|
|
75
79
|
"editor.defaultFormatter": "redhat.vscode-xml"
|
|
76
80
|
},
|
|
77
|
-
"docwriter.style": "
|
|
81
|
+
"docwriter.style": "Auto-detect",
|
|
78
82
|
"docwriter.progress.trackFunctions": false,
|
|
79
83
|
"docwriter.progress.trackMethods": false,
|
|
80
84
|
"files.exclude": {
|
package/bin/deploy.js
CHANGED
|
@@ -35,6 +35,7 @@ import { Lampp } from '../src/runtime/lampp/Lampp.js';
|
|
|
35
35
|
import { DefaultConf } from '../conf.js';
|
|
36
36
|
import { JSONweb } from '../src/server/client-formatted.js';
|
|
37
37
|
import ejs from 'easy-json-schema';
|
|
38
|
+
import { Xampp } from '../src/runtime/xampp/Xampp.js';
|
|
38
39
|
|
|
39
40
|
const logger = loggerFactory(import.meta);
|
|
40
41
|
|
|
@@ -283,6 +284,28 @@ try {
|
|
|
283
284
|
}
|
|
284
285
|
break;
|
|
285
286
|
|
|
287
|
+
case 'xampp': {
|
|
288
|
+
const directory = 'c:/xampp/htdocs';
|
|
289
|
+
const host = 'localhost';
|
|
290
|
+
const port = 80;
|
|
291
|
+
Xampp.removeRouter();
|
|
292
|
+
Xampp.appendRouter(` Listen ${port}
|
|
293
|
+
<VirtualHost *:${port}>
|
|
294
|
+
DocumentRoot "${directory}"
|
|
295
|
+
ServerName ${host}:${port}
|
|
296
|
+
|
|
297
|
+
<Directory "${directory}">
|
|
298
|
+
Options Indexes FollowSymLinks MultiViews
|
|
299
|
+
AllowOverride All
|
|
300
|
+
Require all granted
|
|
301
|
+
</Directory>
|
|
302
|
+
|
|
303
|
+
</VirtualHost>
|
|
304
|
+
`);
|
|
305
|
+
if (Xampp.enabled() && Xampp.router) Xampp.initService({ daemon: true });
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
|
|
286
309
|
case 'adminer': {
|
|
287
310
|
const directory = '/dd/engine/public/adminer';
|
|
288
311
|
// const host = '127.0.0.1';
|
|
@@ -729,22 +752,8 @@ try {
|
|
|
729
752
|
);
|
|
730
753
|
|
|
731
754
|
fs.writeFileSync(
|
|
732
|
-
`./src/
|
|
733
|
-
fs
|
|
734
|
-
.readFileSync(`./src/client/components/core/Docs.js`, 'utf8')
|
|
735
|
-
.replaceAll(`/engine/${version}`, `/engine/${newVersion}`),
|
|
736
|
-
'utf8',
|
|
737
|
-
);
|
|
738
|
-
|
|
739
|
-
fs.writeFileSync(
|
|
740
|
-
`./src/client/ssr/body/CacheControl.js`,
|
|
741
|
-
fs.readFileSync(`./src/client/ssr/body/CacheControl.js`, 'utf8').replaceAll(`v${version}`, `v${newVersion}`),
|
|
742
|
-
'utf8',
|
|
743
|
-
);
|
|
744
|
-
|
|
745
|
-
fs.writeFileSync(
|
|
746
|
-
`./bin/index.js`,
|
|
747
|
-
fs.readFileSync(`./bin/index.js`, 'utf8').replaceAll(`${version}`, `${newVersion}`),
|
|
755
|
+
`./src/index.js`,
|
|
756
|
+
fs.readFileSync(`./src/index.js`, 'utf8').replaceAll(`${version}`, `${newVersion}`),
|
|
748
757
|
'utf8',
|
|
749
758
|
);
|
|
750
759
|
|
|
@@ -998,6 +1007,22 @@ ${uniqueArray(logs.all.map((log) => `- ${log.author_name} ([${log.author_email}]
|
|
|
998
1007
|
break;
|
|
999
1008
|
}
|
|
1000
1009
|
|
|
1010
|
+
case 'valkey': {
|
|
1011
|
+
if (!process.argv.includes('server')) {
|
|
1012
|
+
shellExec(`cd /dd && git clone https://github.com/valkey-io/valkey.git`);
|
|
1013
|
+
shellExec(`cd /dd/valkey && make`);
|
|
1014
|
+
shellExec(`apt install valkey-tools`); // valkey-cli
|
|
1015
|
+
}
|
|
1016
|
+
shellExec(`cd /dd/valkey && ./src/valkey-server`);
|
|
1017
|
+
|
|
1018
|
+
break;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
case 'valkey-service': {
|
|
1022
|
+
shellExec(`pm2 start bin/deploy.js --node-args=\"--max-old-space-size=8192\" --name valkey -- valkey server`);
|
|
1023
|
+
break;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1001
1026
|
default:
|
|
1002
1027
|
break;
|
|
1003
1028
|
}
|
package/bin/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import fs from 'fs-extra';
|
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import { MongooseDB } from '../src/db/mongo/MongooseDB.js';
|
|
8
8
|
import { loggerFactory, underpostASCI } from '../src/server/logger.js';
|
|
9
|
+
import Underpost from '../src/index.js';
|
|
9
10
|
|
|
10
11
|
dotenv.config();
|
|
11
12
|
|
|
@@ -19,9 +20,7 @@ const globalBinFolder = `${shellExec(`npm root -g`, {
|
|
|
19
20
|
|
|
20
21
|
const program = new Command();
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
program.name('underpost').description(`underpost.net ci/cd cli ${version}`).version(version);
|
|
23
|
+
program.name('underpost').description(`underpost.net ci/cd cli ${Underpost.version}`).version(Underpost.version);
|
|
25
24
|
|
|
26
25
|
program
|
|
27
26
|
.command('new <app-name>')
|
|
@@ -30,7 +29,7 @@ program
|
|
|
30
29
|
console.log(
|
|
31
30
|
underpostASCI() +
|
|
32
31
|
`
|
|
33
|
-
|
|
32
|
+
${Underpost.version} https://www.nexodev.org/docs
|
|
34
33
|
`,
|
|
35
34
|
);
|
|
36
35
|
await logger.setUpInfo();
|
|
@@ -65,7 +64,7 @@ program
|
|
|
65
64
|
console.log(
|
|
66
65
|
underpostASCI() +
|
|
67
66
|
`
|
|
68
|
-
|
|
67
|
+
${Underpost.version} https://www.nexodev.org/docs
|
|
69
68
|
`,
|
|
70
69
|
);
|
|
71
70
|
shellCd(`${globalBinFolder}`);
|
package/bin/util.js
CHANGED
|
@@ -13,6 +13,7 @@ import { network } from '../src/server/network.js';
|
|
|
13
13
|
import { Config } from '../src/server/conf.js';
|
|
14
14
|
import { FileFactory } from '../src/api/file/file.service.js';
|
|
15
15
|
import { buildTextImg, faBase64Png, getBufferPngText } from '../src/server/client-icons.js';
|
|
16
|
+
import keyword_extractor from 'keyword-extractor';
|
|
16
17
|
|
|
17
18
|
const httpsAgent = new https.Agent({
|
|
18
19
|
rejectUnauthorized: false,
|
|
@@ -203,7 +204,24 @@ try {
|
|
|
203
204
|
shellExec(`git checkout jsdoc.json`);
|
|
204
205
|
break;
|
|
205
206
|
}
|
|
207
|
+
case 'get-keys': {
|
|
208
|
+
const sentence = fs.existsSync('./_')
|
|
209
|
+
? fs.readFileSync('./_', 'utf8')
|
|
210
|
+
: process.argv[3]
|
|
211
|
+
? process.argv[3]
|
|
212
|
+
: 'President Obama woke up Monday facing a Congressional defeat that many in both parties believed could hobble his presidency.';
|
|
213
|
+
|
|
214
|
+
// Extract the keywords
|
|
215
|
+
const extraction_result = keyword_extractor.extract(sentence, {
|
|
216
|
+
language: 'english',
|
|
217
|
+
remove_digits: true,
|
|
218
|
+
// return_changed_case: true,
|
|
219
|
+
// remove_duplicates: false,
|
|
220
|
+
});
|
|
206
221
|
|
|
222
|
+
console.log(extraction_result.join(', '));
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
207
225
|
default:
|
|
208
226
|
break;
|
|
209
227
|
}
|
package/conf.js
CHANGED
|
@@ -3,7 +3,7 @@ const DefaultConf = {
|
|
|
3
3
|
default: {
|
|
4
4
|
metadata: {
|
|
5
5
|
title: 'Demo App',
|
|
6
|
-
backgroundImage: '
|
|
6
|
+
backgroundImage: 'assets/background/white0-min.jpg',
|
|
7
7
|
description: 'Web application',
|
|
8
8
|
keywords: ['web', 'app', 'spa', 'demo', 'github-pages'],
|
|
9
9
|
author: 'https://github.com/underpostnet',
|
|
@@ -193,6 +193,13 @@ const DefaultConf = {
|
|
|
193
193
|
head: [],
|
|
194
194
|
body: [],
|
|
195
195
|
},
|
|
196
|
+
{
|
|
197
|
+
path: '/maintenance',
|
|
198
|
+
title: 'Server Maintenance',
|
|
199
|
+
client: 'Maintenance',
|
|
200
|
+
head: [],
|
|
201
|
+
body: [],
|
|
202
|
+
},
|
|
196
203
|
],
|
|
197
204
|
pages: [
|
|
198
205
|
{
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.8.1",
|
|
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",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"pm2-delete": "pm2 delete engine",
|
|
12
12
|
"build": "node bin/deploy build-full-client",
|
|
13
13
|
"build-production": "env-cmd -f .env.production node bin/deploy build-full-client",
|
|
14
|
-
"dev": "env-cmd -f .env.development node src/client.dev
|
|
14
|
+
"dev": "env-cmd -f .env.development node src/client.dev",
|
|
15
15
|
"dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
|
|
16
16
|
"docs": "jsdoc -c jsdoc.json",
|
|
17
17
|
"backup": "node bin/db default.net/ export",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"@fortawesome/fontawesome-free": "^6.4.2",
|
|
56
56
|
"@loadingio/css-spinner": "^2.0.2",
|
|
57
57
|
"@neodrag/vanilla": "^2.0.3",
|
|
58
|
-
"@xenova/transformers": "^2.17.2",
|
|
59
58
|
"adm-zip": "^0.5.10",
|
|
60
59
|
"ag-grid-community": "31.0.0",
|
|
61
60
|
"axios": "^1.5.1",
|
|
@@ -84,24 +83,26 @@
|
|
|
84
83
|
"html-minifier-terser": "^7.2.0",
|
|
85
84
|
"http-proxy-middleware": "^2.0.6",
|
|
86
85
|
"ignore-walk": "^6.0.4",
|
|
86
|
+
"iovalkey": "^0.2.1",
|
|
87
87
|
"is-admin": "^4.0.0",
|
|
88
88
|
"is-ip": "^5.0.1",
|
|
89
89
|
"jimp": "^0.22.12",
|
|
90
90
|
"joystick-controller": "^1.0.15",
|
|
91
91
|
"json-colorizer": "^2.2.2",
|
|
92
92
|
"jsonwebtoken": "^9.0.2",
|
|
93
|
+
"keyword-extractor": "^0.0.28",
|
|
93
94
|
"kill-port-process": "^3.2.0",
|
|
94
95
|
"log-update": "^6.0.0",
|
|
95
96
|
"mariadb": "^3.2.2",
|
|
96
97
|
"marked": "^12.0.2",
|
|
97
|
-
"mongoose": "^8.
|
|
98
|
+
"mongoose": "^8.9.5",
|
|
98
99
|
"morgan": "^1.10.0",
|
|
99
100
|
"nodemailer": "^6.9.9",
|
|
100
101
|
"nodemon": "^3.0.1",
|
|
101
102
|
"pathfinding": "^0.4.18",
|
|
102
103
|
"peer": "^1.0.2",
|
|
103
104
|
"peerjs": "^1.5.2",
|
|
104
|
-
"pixi.js": "7.4.
|
|
105
|
+
"pixi.js": "7.4.2",
|
|
105
106
|
"prom-client": "^15.1.2",
|
|
106
107
|
"public-ip": "^6.0.1",
|
|
107
108
|
"read": "^2.1.0",
|
|
@@ -114,17 +115,19 @@
|
|
|
114
115
|
"sortablejs": "^1.15.0",
|
|
115
116
|
"split-file": "^2.3.0",
|
|
116
117
|
"swagger-ui-express": "^5.0.0",
|
|
117
|
-
"systeminformation": "^5.
|
|
118
|
+
"systeminformation": "^5.23.7",
|
|
118
119
|
"uglify-js": "^3.17.4",
|
|
119
120
|
"validator": "^13.11.0",
|
|
121
|
+
"vanilla-jsoneditor": "^2.3.2",
|
|
122
|
+
"web3": "^4.13.0",
|
|
120
123
|
"winston": "^3.11.0"
|
|
121
124
|
},
|
|
122
125
|
"devDependencies": {
|
|
123
126
|
"clean-jsdoc-theme": "^4.3.0",
|
|
127
|
+
"easy-json-schema": "^0.0.2-beta",
|
|
124
128
|
"mocha": "^10.4.0",
|
|
125
129
|
"plantuml": "^0.0.2",
|
|
126
|
-
"swagger-autogen": "^2.23.7"
|
|
127
|
-
"easy-json-schema": "^0.0.2-beta"
|
|
130
|
+
"swagger-autogen": "^2.23.7"
|
|
128
131
|
},
|
|
129
132
|
"publishConfig": {
|
|
130
133
|
"provenance": true,
|
|
@@ -6,24 +6,13 @@ import { CoreWsEmit } from '../../ws/core/core.ws.emit.js';
|
|
|
6
6
|
import { CoreWsMailerChannel } from '../../ws/core/channels/core.ws.mailer.js';
|
|
7
7
|
import validator from 'validator';
|
|
8
8
|
import { DataBaseProvider } from '../../db/DataBaseProvider.js';
|
|
9
|
-
import { s4 } from '../../client/components/core/CommonJs.js';
|
|
10
9
|
import { FileFactory } from '../file/file.service.js';
|
|
11
|
-
import fs from 'fs-extra';
|
|
12
|
-
import { svg, png, png3x } from 'font-awesome-assets';
|
|
13
10
|
import { UserDto } from './user.model.js';
|
|
14
|
-
import
|
|
11
|
+
import { selectDtoFactory, ValkeyAPI } from '../../server/valkey.js';
|
|
12
|
+
import { getDefaultProfileImageId } from '../../server/client-icons.js';
|
|
15
13
|
|
|
16
14
|
const logger = loggerFactory(import.meta);
|
|
17
15
|
|
|
18
|
-
const getDefaultProfileImageId = async (File) => {
|
|
19
|
-
const faId = 'user';
|
|
20
|
-
const tmpFilePath = `./tmp/${faId}-${s4() + s4()}.svg`;
|
|
21
|
-
fs.writeFileSync(tmpFilePath, svg(faId, '#f5f5f5d1'), 'utf8');
|
|
22
|
-
const file = await new File(FileFactory.svg(fs.readFileSync(tmpFilePath), `${faId}.svg`)).save();
|
|
23
|
-
fs.removeSync(tmpFilePath);
|
|
24
|
-
return file._id;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
16
|
const UserService = {
|
|
28
17
|
post: async (req, res, options) => {
|
|
29
18
|
/** @type {import('./user.model.js').UserModel} */
|
|
@@ -235,6 +224,15 @@ const UserService = {
|
|
|
235
224
|
}
|
|
236
225
|
} else throw new Error('invalid email or password');
|
|
237
226
|
|
|
227
|
+
case 'guest': {
|
|
228
|
+
const user = await ValkeyAPI.valkeyObjectFactory('user', options);
|
|
229
|
+
await ValkeyAPI.setValkeyObject(user.email, user);
|
|
230
|
+
return {
|
|
231
|
+
token: hashJWT({ user: UserDto.auth.payload(user) }),
|
|
232
|
+
user: selectDtoFactory(user, UserDto.select.get()),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
238
236
|
default: {
|
|
239
237
|
const validatePassword = validatePasswordMiddleware(req.body.password);
|
|
240
238
|
if (validatePassword.status === 'error') throw new Error(validatePassword.message);
|
|
@@ -327,13 +325,15 @@ const UserService = {
|
|
|
327
325
|
return await User.find().select(UserDto.select.getAll());
|
|
328
326
|
|
|
329
327
|
case 'auth': {
|
|
330
|
-
const user = await
|
|
331
|
-
|
|
332
|
-
|
|
328
|
+
const user = (await ValkeyAPI.getValkeyObject(req.auth.user.email))
|
|
329
|
+
? await ValkeyAPI.getValkeyObject(req.auth.user.email)
|
|
330
|
+
: await User.findOne({
|
|
331
|
+
_id: req.auth.user._id,
|
|
332
|
+
});
|
|
333
333
|
|
|
334
334
|
const file = await File.findOne({ _id: user.profileImageId });
|
|
335
335
|
|
|
336
|
-
if (!file) {
|
|
336
|
+
if (!file && !(await ValkeyAPI.getValkeyObject(req.auth.user.email))) {
|
|
337
337
|
await User.findByIdAndUpdate(
|
|
338
338
|
user._id,
|
|
339
339
|
{ profileImageId: await getDefaultProfileImageId(File) },
|
|
@@ -342,10 +342,11 @@ const UserService = {
|
|
|
342
342
|
},
|
|
343
343
|
);
|
|
344
344
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
return (await ValkeyAPI.getValkeyObject(req.auth.user.email))
|
|
346
|
+
? selectDtoFactory(await ValkeyAPI.getValkeyObject(req.auth.user.email), UserDto.select.get())
|
|
347
|
+
: await User.findOne({
|
|
348
|
+
_id: req.auth.user._id,
|
|
349
|
+
}).select(UserDto.select.get());
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
default: {
|