underpost 2.8.0 → 2.8.6
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 +1 -0
- package/.github/workflows/ghpkg.yml +19 -49
- package/.github/workflows/npmpkg.yml +67 -0
- package/.github/workflows/publish.yml +5 -5
- package/.github/workflows/pwa-microservices-template.page.yml +12 -4
- package/.github/workflows/pwa-microservices-template.test.yml +2 -2
- package/.vscode/extensions.json +17 -71
- package/.vscode/settings.json +20 -4
- package/AUTHORS.md +16 -5
- package/CHANGELOG.md +103 -3
- package/Dockerfile +24 -66
- package/README.md +1 -28
- package/bin/build.js +186 -0
- package/bin/db.js +2 -24
- package/bin/deploy.js +168 -157
- package/bin/file.js +59 -16
- package/bin/hwt.js +0 -10
- package/bin/index.js +201 -61
- package/bin/ssl.js +19 -11
- package/bin/util.js +24 -101
- package/bin/vs.js +26 -2
- package/conf.js +30 -132
- package/docker-compose.yml +1 -1
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/manifests/mariadb/config.yaml +10 -0
- package/manifests/mariadb/kustomization.yaml +9 -0
- package/manifests/mariadb/pv.yaml +12 -0
- package/manifests/mariadb/pvc.yaml +10 -0
- package/manifests/mariadb/secret.yaml +8 -0
- package/manifests/mariadb/service.yaml +10 -0
- package/manifests/mariadb/statefulset.yaml +55 -0
- package/manifests/mongodb/backup-access.yaml +16 -0
- package/manifests/mongodb/backup-cronjob.yaml +42 -0
- package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
- package/manifests/mongodb/configmap.yaml +26 -0
- package/manifests/mongodb/headless-service.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/mongodb/statefulset.yaml +125 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +17 -0
- package/manifests/valkey/statefulset.yaml +39 -0
- package/package.json +133 -134
- package/src/api/core/core.service.js +1 -1
- package/src/api/user/user.model.js +16 -3
- package/src/api/user/user.service.js +1 -1
- package/src/cli/cluster.js +202 -0
- package/src/cli/cron.js +90 -0
- package/src/cli/db.js +212 -0
- package/src/cli/deploy.js +318 -0
- package/src/cli/env.js +52 -0
- package/src/cli/fs.js +149 -0
- package/src/cli/image.js +148 -0
- package/src/cli/repository.js +125 -0
- package/src/cli/script.js +53 -0
- package/src/cli/secrets.js +37 -0
- package/src/cli/test.js +118 -0
- package/src/client/components/core/Account.js +4 -2
- package/src/client/components/core/Auth.js +24 -6
- package/src/client/components/core/CalendarCore.js +127 -50
- package/src/client/components/core/CommonJs.js +282 -19
- package/src/client/components/core/Css.js +2 -1
- package/src/client/components/core/CssCore.js +8 -4
- package/src/client/components/core/Docs.js +1 -1
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/Input.js +22 -6
- package/src/client/components/core/JoyStick.js +8 -5
- package/src/client/components/core/LoadingAnimation.js +8 -1
- package/src/client/components/core/Modal.js +47 -18
- package/src/client/components/core/Panel.js +93 -31
- package/src/client/components/core/PanelForm.js +27 -19
- package/src/client/components/core/Scroll.js +1 -0
- package/src/client/components/core/SignUp.js +4 -1
- package/src/client/components/core/Translate.js +61 -9
- package/src/client/components/core/Validator.js +9 -1
- package/src/client/components/core/VanillaJs.js +0 -9
- package/src/client/components/core/Worker.js +34 -31
- 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 +15 -8
- package/src/client/services/default/default.management.js +4 -2
- package/src/client/ssr/Render.js +4 -1
- package/src/client/ssr/body/CacheControl.js +2 -2
- 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 +26 -6
- package/src/db/mongo/MongooseDB.js +29 -1
- package/src/index.js +91 -17
- package/src/runtime/lampp/Lampp.js +1 -13
- package/src/runtime/xampp/Xampp.js +0 -13
- package/src/server/auth.js +3 -3
- package/src/server/backup.js +49 -93
- package/src/server/client-build.js +41 -50
- package/src/server/client-formatted.js +6 -3
- package/src/server/client-icons.js +1 -1
- package/src/server/conf.js +207 -57
- package/src/server/dns.js +30 -55
- package/src/server/downloader.js +0 -8
- package/src/server/logger.js +22 -15
- package/src/server/network.js +17 -43
- package/src/server/process.js +25 -2
- package/src/server/proxy.js +4 -26
- package/src/server/runtime.js +30 -30
- package/src/server/ssl.js +1 -1
- package/src/server/valkey.js +3 -0
- package/test/api.test.js +0 -8
- package/src/dns.js +0 -22
- package/src/server/prompt-optimizer.js +0 -28
- package/startup.js +0 -11
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: StatefulSet
|
|
3
|
+
metadata:
|
|
4
|
+
name: mongodb # Specifies the name of the statefulset
|
|
5
|
+
spec:
|
|
6
|
+
serviceName: 'mongodb-service' # Specifies the service to use
|
|
7
|
+
replicas: 2
|
|
8
|
+
selector:
|
|
9
|
+
matchLabels:
|
|
10
|
+
app: mongodb
|
|
11
|
+
template:
|
|
12
|
+
metadata:
|
|
13
|
+
labels:
|
|
14
|
+
app: mongodb
|
|
15
|
+
spec:
|
|
16
|
+
containers:
|
|
17
|
+
- name: mongodb
|
|
18
|
+
image: docker.io/library/mongo:latest
|
|
19
|
+
command:
|
|
20
|
+
- mongod
|
|
21
|
+
- '--replSet'
|
|
22
|
+
- 'rs0'
|
|
23
|
+
# - '--config'
|
|
24
|
+
# - '-f'
|
|
25
|
+
# - '/etc/mongod.conf'
|
|
26
|
+
# - '--auth'
|
|
27
|
+
# - '--clusterAuthMode'
|
|
28
|
+
# - 'keyFile'
|
|
29
|
+
# - '--keyFile'
|
|
30
|
+
# - '/etc/mongodb-keyfile'
|
|
31
|
+
# - '--interleave'
|
|
32
|
+
# - 'all'
|
|
33
|
+
# - '--wiredTigerCacheSizeGB'
|
|
34
|
+
# - '0.25'
|
|
35
|
+
# - '--setParameter'
|
|
36
|
+
# - 'authenticationMechanisms=SCRAM-SHA-1'
|
|
37
|
+
# - '--fork'
|
|
38
|
+
- '--logpath'
|
|
39
|
+
- '/var/log/mongodb/mongod.log'
|
|
40
|
+
- '--bind_ip_all'
|
|
41
|
+
# command: ['sh', '-c']
|
|
42
|
+
# args:
|
|
43
|
+
# - |
|
|
44
|
+
# mongod --replSet rs0 --bind_ip_all &
|
|
45
|
+
# sleep 1000
|
|
46
|
+
# if mongosh --host mongodb-0.mongodb-service:27017 --eval "rs.status()" | grep -q "not yet initialized"; then
|
|
47
|
+
# mongosh --host mongodb-0.mongodb-service:27017 <<EOF
|
|
48
|
+
# use admin;
|
|
49
|
+
# rs.initiate({
|
|
50
|
+
# _id: "rs0",
|
|
51
|
+
# members: [
|
|
52
|
+
# { _id: 0, host: "mongodb-0.mongodb-service:27017", priority: 1 },
|
|
53
|
+
# { _id: 1, host: "mongodb-1.mongodb-service:27017", priority: 1 }
|
|
54
|
+
# ]
|
|
55
|
+
# });
|
|
56
|
+
# db.getSiblingDB("admin").createUser({
|
|
57
|
+
# user: process.env.MONGO_INITDB_ROOT_USERNAME,
|
|
58
|
+
# pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
|
|
59
|
+
# roles: [{ role: "userAdminAnyDatabase", db: "admin" }]
|
|
60
|
+
# });
|
|
61
|
+
# use default;
|
|
62
|
+
# db.createUser(
|
|
63
|
+
# {
|
|
64
|
+
# user: process.env.MONGO_INITDB_ROOT_USERNAME,
|
|
65
|
+
# pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
|
|
66
|
+
# roles: [
|
|
67
|
+
# { role: "read", db: "test" },
|
|
68
|
+
# { role: "readWrite", db: "default" }
|
|
69
|
+
# ]
|
|
70
|
+
# }
|
|
71
|
+
# );
|
|
72
|
+
# EOF
|
|
73
|
+
# fi
|
|
74
|
+
# wait
|
|
75
|
+
ports:
|
|
76
|
+
- containerPort: 27017
|
|
77
|
+
volumeMounts:
|
|
78
|
+
- name: mongodb-storage
|
|
79
|
+
mountPath: /data/db
|
|
80
|
+
- name: keyfile
|
|
81
|
+
mountPath: /etc/mongodb-keyfile
|
|
82
|
+
readOnly: true
|
|
83
|
+
# - name: mongodb-configuration-file
|
|
84
|
+
# mountPath: /etc/mongod.conf
|
|
85
|
+
# subPath: mongod.conf
|
|
86
|
+
# readOnly: true
|
|
87
|
+
# - name: mongodb-config
|
|
88
|
+
# mountPath: /config
|
|
89
|
+
env:
|
|
90
|
+
- name: MONGO_INITDB_ROOT_USERNAME
|
|
91
|
+
valueFrom:
|
|
92
|
+
secretKeyRef:
|
|
93
|
+
name: mongodb-secret
|
|
94
|
+
key: username
|
|
95
|
+
- name: MONGO_INITDB_ROOT_PASSWORD
|
|
96
|
+
valueFrom:
|
|
97
|
+
secretKeyRef:
|
|
98
|
+
name: mongodb-secret
|
|
99
|
+
key: password
|
|
100
|
+
resources:
|
|
101
|
+
requests:
|
|
102
|
+
cpu: '100m'
|
|
103
|
+
memory: '256Mi'
|
|
104
|
+
limits:
|
|
105
|
+
cpu: '500m'
|
|
106
|
+
memory: '512Mi'
|
|
107
|
+
volumes:
|
|
108
|
+
- name: keyfile
|
|
109
|
+
secret:
|
|
110
|
+
secretName: mongodb-keyfile
|
|
111
|
+
defaultMode: 0400
|
|
112
|
+
# - name: mongodb-configuration-file
|
|
113
|
+
# configMap:
|
|
114
|
+
# name: mongodb-config-file
|
|
115
|
+
# - name: mongodb-config
|
|
116
|
+
# configMap:
|
|
117
|
+
# name: mongodb-config
|
|
118
|
+
volumeClaimTemplates:
|
|
119
|
+
- metadata:
|
|
120
|
+
name: mongodb-storage
|
|
121
|
+
spec:
|
|
122
|
+
accessModes: ['ReadWriteOnce']
|
|
123
|
+
resources:
|
|
124
|
+
requests:
|
|
125
|
+
storage: 5Gi
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: PersistentVolume
|
|
3
|
+
metadata:
|
|
4
|
+
name: mongodb-pv
|
|
5
|
+
spec:
|
|
6
|
+
capacity:
|
|
7
|
+
storage: 5Gi
|
|
8
|
+
accessModes:
|
|
9
|
+
- ReadWriteOnce
|
|
10
|
+
hostPath:
|
|
11
|
+
path: /data/mongodb
|
|
12
|
+
---
|
|
13
|
+
apiVersion: v1
|
|
14
|
+
kind: PersistentVolumeClaim
|
|
15
|
+
metadata:
|
|
16
|
+
name: mongodb-pvc
|
|
17
|
+
spec:
|
|
18
|
+
storageClassName: ''
|
|
19
|
+
accessModes:
|
|
20
|
+
- ReadWriteOnce
|
|
21
|
+
resources:
|
|
22
|
+
requests:
|
|
23
|
+
storage: 5Gi
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: mongodb-deployment
|
|
5
|
+
namespace: default
|
|
6
|
+
spec:
|
|
7
|
+
selector:
|
|
8
|
+
matchLabels:
|
|
9
|
+
app: mongodb
|
|
10
|
+
replicas: 1
|
|
11
|
+
template:
|
|
12
|
+
metadata:
|
|
13
|
+
labels:
|
|
14
|
+
app: mongodb
|
|
15
|
+
spec:
|
|
16
|
+
hostname: mongo
|
|
17
|
+
containers:
|
|
18
|
+
- name: mongodb
|
|
19
|
+
image: docker.io/library/mongo:4.4
|
|
20
|
+
command: ['mongod', '--replSet', 'rs0', '--bind_ip_all']
|
|
21
|
+
# -- bash
|
|
22
|
+
# mongo
|
|
23
|
+
# use admin
|
|
24
|
+
# rs.initiate()
|
|
25
|
+
ports:
|
|
26
|
+
- containerPort: 27017
|
|
27
|
+
|
|
28
|
+
volumeMounts:
|
|
29
|
+
- name: mongo-persistent-storage
|
|
30
|
+
mountPath: /data/db
|
|
31
|
+
|
|
32
|
+
# resources:
|
|
33
|
+
# requests:
|
|
34
|
+
# memory: '500Mi'
|
|
35
|
+
# cpu: '500m'
|
|
36
|
+
volumes:
|
|
37
|
+
- name: mongo-persistent-storage
|
|
38
|
+
persistentVolumeClaim:
|
|
39
|
+
claimName: mongodb-pvc
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
apiVersion: v1
|
|
43
|
+
kind: Service
|
|
44
|
+
metadata:
|
|
45
|
+
name: mongodb-service
|
|
46
|
+
namespace: default
|
|
47
|
+
spec:
|
|
48
|
+
clusterIP: None
|
|
49
|
+
selector:
|
|
50
|
+
app: mongodb
|
|
51
|
+
ports:
|
|
52
|
+
- protocol: TCP
|
|
53
|
+
port: 27017
|
|
54
|
+
# targetPort: 27017
|
|
55
|
+
# type: ClusterIP
|
|
56
|
+
|
|
57
|
+
# rs.initiate();
|
|
58
|
+
# use admin;
|
|
59
|
+
# rs.initiate({ _id: "rs0", members: [ { _id: 0, host: "127.0.0.1:27017" } ] })
|
|
60
|
+
# db.createUser({user: "your_user",pwd: "your_password", roles: [{role: "userAdminAnyDatabase", db: "admin" },{ role: "readWriteAnyDatabase", db: "admin" }]});
|
|
61
|
+
# cfg = rs.conf();
|
|
62
|
+
# cfg.members[0].host = "127.0.0.1:27027";
|
|
63
|
+
# rs.reconfig(cfg);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
apiVersion: v1
|
|
3
|
+
kind: Service
|
|
4
|
+
metadata:
|
|
5
|
+
name: service-valkey
|
|
6
|
+
namespace: default
|
|
7
|
+
spec:
|
|
8
|
+
ports:
|
|
9
|
+
- port: 6379
|
|
10
|
+
targetPort: 6379
|
|
11
|
+
selector:
|
|
12
|
+
app: service-valkey
|
|
13
|
+
ipFamilyPolicy: PreferDualStack
|
|
14
|
+
ipFamilies:
|
|
15
|
+
- IPv4
|
|
16
|
+
# - IPv6
|
|
17
|
+
type: ClusterIP
|
|
@@ -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,134 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
2
|
+
"type": "module",
|
|
3
|
+
"main": "src/index.js",
|
|
4
|
+
"name": "underpost",
|
|
5
|
+
"version": "2.8.6",
|
|
6
|
+
"description": "pwa api rest template",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
9
|
+
"test": "env-cmd -f .env.test c8 mocha",
|
|
10
|
+
"pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine",
|
|
11
|
+
"dev": "env-cmd -f .env.development node src/client.dev default",
|
|
12
|
+
"dev-img": "env-cmd -f .env.development node src/server",
|
|
13
|
+
"prod-img": "env-cmd -f .env.production node src/server",
|
|
14
|
+
"dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
|
|
15
|
+
"dev-client": "env-cmd -f .env.development node src/client.dev",
|
|
16
|
+
"proxy": "node src/proxy proxy",
|
|
17
|
+
"docs": "jsdoc -c jsdoc.json",
|
|
18
|
+
"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",
|
|
19
|
+
"install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
|
|
20
|
+
"install-underpost": "cp -a $(npm root -g)/underpost/node_modules ./node_modules && npm install --only=dev --ignore-scripts",
|
|
21
|
+
"install": "npm run install-global && npm run install-test",
|
|
22
|
+
"docker:start": "docker-compose up",
|
|
23
|
+
"prettier": "prettier --write .",
|
|
24
|
+
"fix": "npm audit fix --force && npm audit",
|
|
25
|
+
"changelog": "auto-changelog",
|
|
26
|
+
"build": "node bin/deploy build-full-client"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"underpost": "bin/index.js"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"pwa",
|
|
37
|
+
"microservices",
|
|
38
|
+
"template",
|
|
39
|
+
"builder",
|
|
40
|
+
"engine",
|
|
41
|
+
"server",
|
|
42
|
+
"proxy",
|
|
43
|
+
"client"
|
|
44
|
+
],
|
|
45
|
+
"author": "https://github.com/underpostnet",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/underpostnet/pwa-microservices-template/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/underpostnet/pwa-microservices-template#readme",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@fortawesome/fontawesome-free": "^6.4.2",
|
|
53
|
+
"@fullcalendar/rrule": "^6.1.15",
|
|
54
|
+
"@loadingio/css-spinner": "^2.0.2",
|
|
55
|
+
"@neodrag/vanilla": "^2.0.3",
|
|
56
|
+
"adm-zip": "^0.5.10",
|
|
57
|
+
"ag-grid-community": "31.0.0",
|
|
58
|
+
"axios": "^1.5.1",
|
|
59
|
+
"chai": "^5.1.0",
|
|
60
|
+
"clean-jsdoc-theme": "^4.3.0",
|
|
61
|
+
"cli-progress": "^3.12.0",
|
|
62
|
+
"cli-spinners": "^3.0.0",
|
|
63
|
+
"clipboardy": "^4.0.0",
|
|
64
|
+
"cloudinary": "^2.5.1",
|
|
65
|
+
"color": "^4.2.3",
|
|
66
|
+
"colors": "^1.4.0",
|
|
67
|
+
"commander": "^12.1.0",
|
|
68
|
+
"compression": "^1.7.4",
|
|
69
|
+
"cors": "^2.8.5",
|
|
70
|
+
"d3": "^7.9.0",
|
|
71
|
+
"dotenv": "^16.3.1",
|
|
72
|
+
"easy-json-schema": "^0.0.2-beta",
|
|
73
|
+
"easymde": "^2.18.0",
|
|
74
|
+
"env-cmd": "^10.1.0",
|
|
75
|
+
"express": "^4.18.2",
|
|
76
|
+
"express-fileupload": "^1.4.3",
|
|
77
|
+
"favicons": "^7.2.0",
|
|
78
|
+
"font-awesome-assets": "^0.0.9",
|
|
79
|
+
"fs-extra": "^11.1.1",
|
|
80
|
+
"fullcalendar": "^6.1.15",
|
|
81
|
+
"html-minifier-terser": "^7.2.0",
|
|
82
|
+
"http-proxy-middleware": "^2.0.6",
|
|
83
|
+
"ignore-walk": "^6.0.4",
|
|
84
|
+
"iovalkey": "^0.2.1",
|
|
85
|
+
"jimp": "^0.22.12",
|
|
86
|
+
"joystick-controller": "^1.0.15",
|
|
87
|
+
"json-colorizer": "^2.2.2",
|
|
88
|
+
"jsonwebtoken": "^9.0.2",
|
|
89
|
+
"keyword-extractor": "^0.0.28",
|
|
90
|
+
"log-update": "^6.0.0",
|
|
91
|
+
"mariadb": "^3.2.2",
|
|
92
|
+
"marked": "^12.0.2",
|
|
93
|
+
"mocha": "^10.8.2",
|
|
94
|
+
"mongoose": "^8.9.5",
|
|
95
|
+
"morgan": "^1.10.0",
|
|
96
|
+
"nodemailer": "^6.9.9",
|
|
97
|
+
"nodemon": "^3.0.1",
|
|
98
|
+
"pathfinding": "^0.4.18",
|
|
99
|
+
"peer": "^1.0.2",
|
|
100
|
+
"peerjs": "^1.5.2",
|
|
101
|
+
"pixi.js": "7.4.2",
|
|
102
|
+
"plantuml": "^0.0.2",
|
|
103
|
+
"prom-client": "^15.1.2",
|
|
104
|
+
"public-ip": "^6.0.1",
|
|
105
|
+
"read": "^2.1.0",
|
|
106
|
+
"rrule": "^2.8.1",
|
|
107
|
+
"sharp": "^0.32.5",
|
|
108
|
+
"shelljs": "^0.8.5",
|
|
109
|
+
"simple-icons": "^13.9.0",
|
|
110
|
+
"sitemap": "^7.1.1",
|
|
111
|
+
"socket.io": "^4.8.0",
|
|
112
|
+
"sortablejs": "^1.15.0",
|
|
113
|
+
"split-file": "^2.3.0",
|
|
114
|
+
"swagger-autogen": "^2.23.7",
|
|
115
|
+
"swagger-ui-express": "^5.0.0",
|
|
116
|
+
"systeminformation": "^5.23.7",
|
|
117
|
+
"uglify-js": "^3.17.4",
|
|
118
|
+
"validator": "^13.11.0",
|
|
119
|
+
"vanilla-jsoneditor": "^2.3.2",
|
|
120
|
+
"winston": "^3.11.0"
|
|
121
|
+
},
|
|
122
|
+
"devDependencies": {
|
|
123
|
+
"clean-jsdoc-theme": "^4.3.0",
|
|
124
|
+
"easy-json-schema": "^0.0.2-beta",
|
|
125
|
+
"mocha": "^10.8.2",
|
|
126
|
+
"plantuml": "^0.0.2",
|
|
127
|
+
"swagger-autogen": "^2.23.7"
|
|
128
|
+
},
|
|
129
|
+
"publishConfig": {
|
|
130
|
+
"provenance": true,
|
|
131
|
+
"access": "public",
|
|
132
|
+
"registry": "https://registry.npmjs.org/"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -9,7 +9,7 @@ const CoreService = {
|
|
|
9
9
|
/** @type {import('./core.model.js').CoreModel} */
|
|
10
10
|
const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Core;
|
|
11
11
|
if (req.path.startsWith('/sh')) {
|
|
12
|
-
if (req.body.
|
|
12
|
+
if (req.body.stdout) return shellExec(req.body.sh, { stdout: true });
|
|
13
13
|
shellExec(req.body.sh, { async: true });
|
|
14
14
|
return 'Command "' + req.body.sh + '" running';
|
|
15
15
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Schema, model } from 'mongoose';
|
|
2
2
|
import validator from 'validator';
|
|
3
|
+
import { userRoleEnum } from '../../client/components/core/CommonJs.js';
|
|
3
4
|
|
|
4
5
|
// https://mongoosejs.com/docs/2.7.x/docs/schematypes.html
|
|
5
6
|
|
|
6
|
-
const userRoleEnum = ['admin', 'moderator', 'user', 'guest'];
|
|
7
|
-
|
|
8
7
|
const UserSchema = new Schema(
|
|
9
8
|
{
|
|
10
9
|
email: {
|
|
@@ -26,7 +25,11 @@ const UserSchema = new Schema(
|
|
|
26
25
|
profileImageId: { type: Schema.Types.ObjectId, ref: 'File' },
|
|
27
26
|
phoneNumbers: [
|
|
28
27
|
{
|
|
29
|
-
type: {
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
enum: ['office', 'home', 'private'],
|
|
31
|
+
},
|
|
32
|
+
number: { type: String },
|
|
30
33
|
},
|
|
31
34
|
],
|
|
32
35
|
publicKey: {
|
|
@@ -38,6 +41,12 @@ const UserSchema = new Schema(
|
|
|
38
41
|
],
|
|
39
42
|
default: [],
|
|
40
43
|
},
|
|
44
|
+
associatedCompanies: [
|
|
45
|
+
{
|
|
46
|
+
company: { type: Schema.Types.ObjectId, ref: 'Company', required: true },
|
|
47
|
+
context: [{ type: String, enum: ['client', 'supplier', 'employee', 'owner'] }],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
41
50
|
},
|
|
42
51
|
{
|
|
43
52
|
timestamps: true,
|
|
@@ -58,6 +67,10 @@ const UserDto = {
|
|
|
58
67
|
},
|
|
59
68
|
},
|
|
60
69
|
auth: {
|
|
70
|
+
// TODO: -> set login device, location, ip, fingerprint
|
|
71
|
+
// and validate on authorization middleware
|
|
72
|
+
// -> dynamic refresh 100 tokens per session with 12h interval
|
|
73
|
+
// -> back secret per user, registrarion user model -> secret: { type: String }
|
|
61
74
|
payload: (user) => ({ _id: user._id.toString(), role: user.role, email: user.email }),
|
|
62
75
|
},
|
|
63
76
|
};
|
|
@@ -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) {
|