underpost 2.8.0 → 2.8.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/.dockerignore +1 -0
  2. package/.github/workflows/ghpkg.yml +4 -4
  3. package/.vscode/extensions.json +8 -71
  4. package/.vscode/settings.json +2 -1
  5. package/CHANGELOG.md +55 -3
  6. package/Dockerfile +22 -36
  7. package/README.md +0 -27
  8. package/bin/deploy.js +54 -28
  9. package/bin/file.js +30 -2
  10. package/bin/index.js +6 -18
  11. package/bin/ssl.js +19 -11
  12. package/bin/util.js +18 -0
  13. package/bin/vs.js +3 -2
  14. package/conf.js +17 -1
  15. package/docker-compose.yml +1 -1
  16. package/manifests/mariadb/config.yaml +10 -0
  17. package/manifests/mariadb/kustomization.yaml +9 -0
  18. package/manifests/mariadb/pv.yaml +12 -0
  19. package/manifests/mariadb/pvc.yaml +10 -0
  20. package/manifests/mariadb/secret.yaml +8 -0
  21. package/manifests/mariadb/service.yaml +10 -0
  22. package/manifests/mariadb/statefulset.yaml +55 -0
  23. package/manifests/test/mongo-express.yaml +60 -0
  24. package/manifests/test/phpmyadmin.yaml +54 -0
  25. package/manifests/test/underpost-engine-mongodb-configmap.yaml +26 -0
  26. package/manifests/test/underpost-engine-pod.yaml +108 -0
  27. package/manifests/underpost-engine-backup-access.yaml +16 -0
  28. package/manifests/underpost-engine-backup-pv-pvc.yaml +22 -0
  29. package/manifests/underpost-engine-headless-service.yaml +10 -0
  30. package/manifests/underpost-engine-mongodb-backup-cronjob.yaml +40 -0
  31. package/manifests/underpost-engine-pv-pvc.yaml +23 -0
  32. package/manifests/underpost-engine-statefulset.yaml +91 -0
  33. package/manifests/valkey/kustomization.yaml +7 -0
  34. package/manifests/valkey/underpost-engine-valkey-service.yaml +17 -0
  35. package/manifests/valkey/underpost-engine-valkey-statefulset.yaml +39 -0
  36. package/package.json +144 -134
  37. package/src/api/user/user.model.js +9 -1
  38. package/src/api/user/user.service.js +1 -1
  39. package/src/client/components/core/Account.js +4 -2
  40. package/src/client/components/core/Auth.js +2 -2
  41. package/src/client/components/core/CalendarCore.js +112 -49
  42. package/src/client/components/core/CommonJs.js +125 -19
  43. package/src/client/components/core/Css.js +1 -1
  44. package/src/client/components/core/CssCore.js +6 -0
  45. package/src/client/components/core/Docs.js +2 -1
  46. package/src/client/components/core/DropDown.js +5 -1
  47. package/src/client/components/core/Input.js +17 -3
  48. package/src/client/components/core/JoyStick.js +8 -5
  49. package/src/client/components/core/Modal.js +12 -6
  50. package/src/client/components/core/Panel.js +82 -24
  51. package/src/client/components/core/PanelForm.js +11 -19
  52. package/src/client/components/core/SignUp.js +4 -1
  53. package/src/client/components/core/Translate.js +44 -8
  54. package/src/client/public/default/plantuml/client-conf.svg +1 -1
  55. package/src/client/public/default/plantuml/server-conf.svg +1 -1
  56. package/src/client/public/default/plantuml/server-schema.svg +1 -1
  57. package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
  58. package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
  59. package/src/client/services/core/core.service.js +2 -0
  60. package/src/client/ssr/body/CacheControl.js +2 -1
  61. package/src/client/ssr/body/DefaultSplashScreen.js +3 -3
  62. package/src/client/ssr/offline/Maintenance.js +63 -0
  63. package/src/client/sw/default.sw.js +23 -3
  64. package/src/db/mongo/MongooseDB.js +13 -1
  65. package/src/index.js +8 -0
  66. package/src/server/client-build.js +5 -4
  67. package/src/server/client-icons.js +1 -1
  68. package/src/server/conf.js +5 -5
  69. package/src/server/logger.js +8 -6
  70. package/src/server/process.js +25 -2
  71. package/src/server/ssl.js +1 -1
  72. package/src/server/valkey.js +3 -0
  73. package/startup.cjs +12 -0
  74. package/startup.js +0 -11
@@ -0,0 +1,39 @@
1
+ ---
2
+ apiVersion: apps/v1
3
+ kind: StatefulSet
4
+ metadata:
5
+ name: service-valkey
6
+ namespace: default
7
+ spec:
8
+ serviceName: service-valkey
9
+ replicas: 1
10
+ selector:
11
+ matchLabels:
12
+ app: service-valkey
13
+ template:
14
+ metadata:
15
+ labels:
16
+ app: service-valkey
17
+ spec:
18
+ containers:
19
+ - name: service-valkey
20
+ image: docker.io/valkey/valkey:latest
21
+ env:
22
+ - name: TZ
23
+ value: Europe/Zurich
24
+ ports:
25
+ - containerPort: 6379
26
+ startupProbe:
27
+ tcpSocket:
28
+ port: 6379
29
+ failureThreshold: 30
30
+ periodSeconds: 5
31
+ timeoutSeconds: 5
32
+ livenessProbe:
33
+ tcpSocket:
34
+ port: 6379
35
+ failureThreshold: 2
36
+ periodSeconds: 30
37
+ timeoutSeconds: 5
38
+ restartPolicy: Always
39
+ automountServiceAccountToken: false
package/package.json CHANGED
@@ -1,135 +1,145 @@
1
1
  {
2
- "type": "module",
3
- "main": "src/index.js",
4
- "name": "underpost",
5
- "version": "2.8.0",
6
- "description": "pwa api rest template",
7
- "scripts": {
8
- "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
9
- "pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine && pm2 logs",
10
- "ssl": "env-cmd -f .env.production node bin/ssl",
11
- "pm2-delete": "pm2 delete engine",
12
- "build": "node bin/deploy build-full-client",
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",
15
- "dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
16
- "docs": "jsdoc -c jsdoc.json",
17
- "backup": "node bin/db default.net/ export",
18
- "install-template": "npm install && npm run build",
19
- "install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd && npm install -g yarn && npm install -g auto-changelog",
20
- "install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
21
- "install-vs-extensions": "node bin/vs import",
22
- "preinstall": "npm config set audit false && npm config set loglevel error",
23
- "restore-preinstall": "npm config set audit true && npm config set loglevel notice",
24
- "install": "npm run install-global && npm run install-test && npm run restore-preinstall --no-audit --no-warnings",
25
- "docker:start": "docker-compose up",
26
- "prettier": "prettier --write .",
27
- "coveralls": "nyc npm run test --reporter=text-lcov | coveralls -v",
28
- "test": "env-cmd -f .env.test c8 mocha",
29
- "update": "npm update -g && npm update && npm audit fix --force && npm audit fix --force",
30
- "underpost-publish": "npm publish --provenance --access public",
31
- "underpost-unpublish": "npm unpublish underpost@2.5.x",
32
- "login": "npm adduser",
33
- "bin": "npm link --force"
34
- },
35
- "bin": {
36
- "underpost": "bin/index.js"
37
- },
38
- "repository": {
39
- "type": "git",
40
- "url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
41
- },
42
- "keywords": [
43
- "engine",
44
- "server",
45
- "proxy",
46
- "client"
47
- ],
48
- "author": "https://github.com/underpostnet",
49
- "license": "MIT",
50
- "bugs": {
51
- "url": "https://github.com/underpostnet/pwa-microservices-template/issues"
52
- },
53
- "homepage": "https://github.com/underpostnet/pwa-microservices-template#readme",
54
- "dependencies": {
55
- "@fortawesome/fontawesome-free": "^6.4.2",
56
- "@loadingio/css-spinner": "^2.0.2",
57
- "@neodrag/vanilla": "^2.0.3",
58
- "@xenova/transformers": "^2.17.2",
59
- "adm-zip": "^0.5.10",
60
- "ag-grid-community": "31.0.0",
61
- "axios": "^1.5.1",
62
- "chai": "^5.1.0",
63
- "cli-progress": "^3.12.0",
64
- "cli-spinners": "^3.0.0",
65
- "color": "^4.2.3",
66
- "colors": "^1.4.0",
67
- "commander": "^12.1.0",
68
- "compression": "^1.7.4",
69
- "copy-paste": "^1.5.3",
70
- "cors": "^2.8.5",
71
- "d3": "^7.9.0",
72
- "deepmerge": "^4.3.1",
73
- "detect-port": "^1.5.1",
74
- "dotenv": "^16.3.1",
75
- "easymde": "^2.18.0",
76
- "env-cmd": "^10.1.0",
77
- "eventemitter3": "^5.0.1",
78
- "express": "^4.18.2",
79
- "express-fileupload": "^1.4.3",
80
- "favicons": "^7.2.0",
81
- "font-awesome-assets": "^0.0.9",
82
- "fs-extra": "^11.1.1",
83
- "fullcalendar": "^6.1.15",
84
- "html-minifier-terser": "^7.2.0",
85
- "http-proxy-middleware": "^2.0.6",
86
- "ignore-walk": "^6.0.4",
87
- "is-admin": "^4.0.0",
88
- "is-ip": "^5.0.1",
89
- "jimp": "^0.22.12",
90
- "joystick-controller": "^1.0.15",
91
- "json-colorizer": "^2.2.2",
92
- "jsonwebtoken": "^9.0.2",
93
- "kill-port-process": "^3.2.0",
94
- "log-update": "^6.0.0",
95
- "mariadb": "^3.2.2",
96
- "marked": "^12.0.2",
97
- "mongoose": "^8.0.1",
98
- "morgan": "^1.10.0",
99
- "nodemailer": "^6.9.9",
100
- "nodemon": "^3.0.1",
101
- "pathfinding": "^0.4.18",
102
- "peer": "^1.0.2",
103
- "peerjs": "^1.5.2",
104
- "pixi.js": "7.4.0",
105
- "prom-client": "^15.1.2",
106
- "public-ip": "^6.0.1",
107
- "read": "^2.1.0",
108
- "sharp": "^0.32.5",
109
- "shelljs": "^0.8.5",
110
- "simple-git": "^3.26.0",
111
- "simple-icons": "^13.9.0",
112
- "sitemap": "^7.1.1",
113
- "socket.io": "^4.8.0",
114
- "sortablejs": "^1.15.0",
115
- "split-file": "^2.3.0",
116
- "swagger-ui-express": "^5.0.0",
117
- "systeminformation": "^5.21.17",
118
- "uglify-js": "^3.17.4",
119
- "validator": "^13.11.0",
120
- "winston": "^3.11.0",
121
- "iovalkey": "^0.2.1"
122
- },
123
- "devDependencies": {
124
- "clean-jsdoc-theme": "^4.3.0",
125
- "mocha": "^10.4.0",
126
- "plantuml": "^0.0.2",
127
- "swagger-autogen": "^2.23.7",
128
- "easy-json-schema": "^0.0.2-beta"
129
- },
130
- "publishConfig": {
131
- "provenance": true,
132
- "access": "public",
133
- "registry": "https://registry.npmjs.org/"
134
- }
135
- }
2
+ "type": "module",
3
+ "main": "src/index.js",
4
+ "name": "underpost",
5
+ "version": "2.8.31",
6
+ "description": "pwa api rest template",
7
+ "scripts": {
8
+ "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
9
+ "pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine && pm2 logs",
10
+ "ssl": "env-cmd -f .env.production node bin/ssl",
11
+ "pm2-delete": "pm2 delete engine",
12
+ "build": "node bin/deploy build-full-client && node bin/deploy fix-deps",
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 default",
15
+ "dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
16
+ "docs": "jsdoc -c jsdoc.json",
17
+ "backup": "node bin/db default.net/ export",
18
+ "install-template": "npm install && npm run build",
19
+ "install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd && npm install -g yarn && npm install -g auto-changelog",
20
+ "install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
21
+ "install-vs-extensions": "node bin/vs import",
22
+ "preinstall": "npm config set audit false && npm config set loglevel error",
23
+ "restore-preinstall": "npm config set audit true && npm config set loglevel notice",
24
+ "install": "npm run install-global && npm run install-test && npm run restore-preinstall --no-audit --no-warnings",
25
+ "docker:start": "docker-compose up",
26
+ "prettier": "prettier --write .",
27
+ "coveralls": "nyc npm run test --reporter=text-lcov | coveralls -v",
28
+ "test": "env-cmd -f .env.test c8 mocha",
29
+ "update": "npm update -g && npm update && npm audit fix --force && npm audit fix --force",
30
+ "underpost-publish": "npm publish --provenance --access public",
31
+ "underpost-unpublish": "npm unpublish underpost@2.5.x",
32
+ "login": "npm adduser",
33
+ "bin": "npm link --force"
34
+ },
35
+ "bin": {
36
+ "underpost": "bin/index.js"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
41
+ },
42
+ "keywords": [
43
+ "engine",
44
+ "server",
45
+ "proxy",
46
+ "client"
47
+ ],
48
+ "author": "https://github.com/underpostnet",
49
+ "license": "MIT",
50
+ "bugs": {
51
+ "url": "https://github.com/underpostnet/pwa-microservices-template/issues"
52
+ },
53
+ "homepage": "https://github.com/underpostnet/pwa-microservices-template#readme",
54
+ "dependencies": {
55
+ "@fortawesome/fontawesome-free": "^6.4.2",
56
+ "@fullcalendar/rrule": "^6.1.15",
57
+ "@google/generative-ai": "^0.21.0",
58
+ "@loadingio/css-spinner": "^2.0.2",
59
+ "@neodrag/vanilla": "^2.0.3",
60
+ "@nomiclabs/hardhat-ethers": "^2.2.3",
61
+ "@nomiclabs/hardhat-etherscan": "^3.1.8",
62
+ "@nomiclabs/hardhat-waffle": "^2.0.6",
63
+ "@openzeppelin/contracts": "^5.0.2",
64
+ "adm-zip": "^0.5.10",
65
+ "ag-grid-community": "31.0.0",
66
+ "axios": "^1.5.1",
67
+ "chai": "^5.1.0",
68
+ "cli-progress": "^3.12.0",
69
+ "cli-spinners": "^3.0.0",
70
+ "clipboardy": "^4.0.0",
71
+ "color": "^4.2.3",
72
+ "colors": "^1.4.0",
73
+ "commander": "^12.1.0",
74
+ "compression": "^1.7.4",
75
+ "cors": "^2.8.5",
76
+ "d3": "^7.9.0",
77
+ "deepmerge": "^4.3.1",
78
+ "detect-port": "^1.5.1",
79
+ "dotenv": "^16.3.1",
80
+ "easymde": "^2.18.0",
81
+ "env-cmd": "^10.1.0",
82
+ "eventemitter3": "^5.0.1",
83
+ "express": "^4.18.2",
84
+ "express-fileupload": "^1.4.3",
85
+ "favicons": "^7.2.0",
86
+ "font-awesome-assets": "^0.0.9",
87
+ "fs-extra": "^11.1.1",
88
+ "fullcalendar": "^6.1.15",
89
+ "html-minifier-terser": "^7.2.0",
90
+ "http-proxy-middleware": "^2.0.6",
91
+ "ignore-walk": "^6.0.4",
92
+ "iovalkey": "^0.2.1",
93
+ "is-admin": "^4.0.0",
94
+ "is-ip": "^5.0.1",
95
+ "jimp": "^0.22.12",
96
+ "joystick-controller": "^1.0.15",
97
+ "json-colorizer": "^2.2.2",
98
+ "jsonwebtoken": "^9.0.2",
99
+ "keyword-extractor": "^0.0.28",
100
+ "kill-port-process": "^3.2.0",
101
+ "log-update": "^6.0.0",
102
+ "mariadb": "^3.2.2",
103
+ "marked": "^12.0.2",
104
+ "mongoose": "^8.9.5",
105
+ "morgan": "^1.10.0",
106
+ "nodemailer": "^6.9.9",
107
+ "nodemon": "^3.0.1",
108
+ "pathfinding": "^0.4.18",
109
+ "peer": "^1.0.2",
110
+ "peerjs": "^1.5.2",
111
+ "pixi.js": "7.4.2",
112
+ "prom-client": "^15.1.2",
113
+ "public-ip": "^6.0.1",
114
+ "read": "^2.1.0",
115
+ "rrule": "^2.8.1",
116
+ "sharp": "^0.32.5",
117
+ "shelljs": "^0.8.5",
118
+ "simple-git": "^3.26.0",
119
+ "simple-icons": "^13.9.0",
120
+ "sitemap": "^7.1.1",
121
+ "socket.io": "^4.8.0",
122
+ "sortablejs": "^1.15.0",
123
+ "split-file": "^2.3.0",
124
+ "swagger-ui-express": "^5.0.0",
125
+ "systeminformation": "^5.23.7",
126
+ "uglify-js": "^3.17.4",
127
+ "validator": "^13.11.0",
128
+ "vanilla-jsoneditor": "^2.3.2",
129
+ "web3": "^4.13.0",
130
+ "winston": "^3.11.0"
131
+ },
132
+ "devDependencies": {
133
+ "clean-jsdoc-theme": "^4.3.0",
134
+ "easy-json-schema": "^0.0.2-beta",
135
+ "hardhat": "^2.22.13",
136
+ "mocha": "^10.4.0",
137
+ "plantuml": "^0.0.2",
138
+ "swagger-autogen": "^2.23.7"
139
+ },
140
+ "publishConfig": {
141
+ "provenance": true,
142
+ "access": "public",
143
+ "registry": "https://registry.npmjs.org/"
144
+ }
145
+ }
@@ -26,7 +26,11 @@ const UserSchema = new Schema(
26
26
  profileImageId: { type: Schema.Types.ObjectId, ref: 'File' },
27
27
  phoneNumbers: [
28
28
  {
29
- type: { type: String, enum: ['office', 'home', 'private'], number: { type: String } },
29
+ type: {
30
+ type: String,
31
+ enum: ['office', 'home', 'private'],
32
+ },
33
+ number: { type: String },
30
34
  },
31
35
  ],
32
36
  publicKey: {
@@ -58,6 +62,10 @@ const UserDto = {
58
62
  },
59
63
  },
60
64
  auth: {
65
+ // TODO: -> set login device, location, ip, fingerprint
66
+ // and validate on authorization middleware
67
+ // -> dynamic refresh 100 tokens per session with 12h interval
68
+ // -> back secret per user, registrarion user model -> secret: { type: String }
61
69
  payload: (user) => ({ _id: user._id.toString(), role: user.role, email: user.email }),
62
70
  },
63
71
  };
@@ -237,7 +237,7 @@ const UserService = {
237
237
  const validatePassword = validatePasswordMiddleware(req.body.password);
238
238
  if (validatePassword.status === 'error') throw new Error(validatePassword.message);
239
239
  req.body.password = await hashPassword(req.body.password);
240
- req.body.role = 'user';
240
+ req.body.role = req.body.role === 'guest' ? 'guest' : 'user';
241
241
  req.body.profileImageId = await getDefaultProfileImageId(File);
242
242
  const { _id } = await new User(req.body).save();
243
243
  if (_id) {
@@ -300,8 +300,10 @@ const Account = {
300
300
  s(`.account-profile-image`).style.opacity = 0;
301
301
  for (const inputData of this.formData)
302
302
  if (s(`.${inputData.id}`)) s(`.${inputData.id}`).value = user[inputData.model];
303
- s(`.account-profile-image`).src = LogIn.Scope.user.main.model.user.profileImage.imageSrc;
304
- s(`.account-profile-image`).style.opacity = 1;
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
+ }
305
307
  },
306
308
  };
307
309
 
@@ -46,8 +46,8 @@ const Auth = {
46
46
  ) {
47
47
  try {
48
48
  localStorage.setItem('jwt', result.data.token);
49
- await Auth.sessionIn();
50
49
  await SignUp.Trigger(result.data);
50
+ await Auth.sessionIn();
51
51
  } catch (error) {
52
52
  logger.error(error);
53
53
  localStorage.removeItem('jwt');
@@ -76,7 +76,7 @@ const Auth = {
76
76
  await LogIn.Trigger({ user: data.user });
77
77
  await Account.updateForm(data.user);
78
78
  return { user: data.user };
79
- } else throw new Error(message);
79
+ }
80
80
  }
81
81
 
82
82
  // anon guest session