@fdm-monster/server 1.7.1 → 1.7.3
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/.yarn/install-state.gz +0 -0
- package/README.md +2 -1
- package/RELEASE_NOTES.MD +14 -0
- package/dist/consoles/check-ports.js +170 -0
- package/dist/consoles/check-ports.js.map +1 -0
- package/dist/constants/service.constants.js +6 -6
- package/dist/constants/service.constants.js.map +1 -1
- package/dist/controllers/user.controller.js +187 -52
- package/dist/controllers/user.controller.js.map +1 -1
- package/dist/controllers/validation/printer-controller.validation.js +2 -2
- package/dist/controllers/validation/printer-controller.validation.js.map +1 -1
- package/dist/models/Printer.js.map +1 -1
- package/dist/server.constants.js +1 -1
- package/dist/services/orm/base.service.js +3 -0
- package/dist/services/orm/base.service.js.map +1 -1
- package/dist/services/validators/printer-service.validation.js +2 -2
- package/dist/services/validators/printer-service.validation.js.map +1 -1
- package/dist/services/validators/yaml-service.validation.js +1 -1
- package/dist/services/validators/yaml-service.validation.js.map +1 -1
- package/dist/state/validation/create-test-printer.validation.js +1 -1
- package/dist/state/validation/create-test-printer.validation.js.map +1 -1
- package/package.json +11 -11
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ Please join the discord, but stay professional and proactive!
|
|
|
76
76
|
These are the people involved in the project. Find the meaning of the emoji keys [here](https://allcontributors.org/docs/en/emoji-key).
|
|
77
77
|
|
|
78
78
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
79
|
-
[](#contributors-)
|
|
80
80
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
81
81
|
|
|
82
82
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
@@ -106,6 +106,7 @@ These are the people involved in the project. Find the meaning of the emoji keys
|
|
|
106
106
|
<td align="center" valign="top" width="14.28%"><a href="https://techinterview.guide"><img src="https://avatars.githubusercontent.com/u/168030?v=4?s=80" width="80px;" alt="w. ian douglas"/><br /><sub><b>w. ian douglas</b></sub></a><br /><a href="#ideas-iandouglas" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
107
107
|
<td align="center" valign="top" width="14.28%"><a href="http://insanityautomation.com/"><img src="https://avatars.githubusercontent.com/u/38436470?v=4?s=80" width="80px;" alt="InsanityAutomation"/><br /><sub><b>InsanityAutomation</b></sub></a><br /><a href="#ideas-InsanityAutomation" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/fdm-monster/fdm-monster/issues?q=author%3AInsanityAutomation" title="Bug reports">🐛</a></td>
|
|
108
108
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/LyfeOnEdge"><img src="https://avatars.githubusercontent.com/u/26140376?v=4?s=80" width="80px;" alt="Andrew (LyfeOnEdge) (ArcticGentoo)"/><br /><sub><b>Andrew (LyfeOnEdge) (ArcticGentoo)</b></sub></a><br /><a href="#ideas-LyfeOnEdge" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
109
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/callanova"><img src="https://avatars.githubusercontent.com/u/175639705?v=4?s=80" width="80px;" alt="callanova"/><br /><sub><b>callanova</b></sub></a><br /><a href="https://github.com/fdm-monster/fdm-monster/issues?q=author%3Acallanova" title="Bug reports">🐛</a></td>
|
|
109
110
|
</tr>
|
|
110
111
|
</tbody>
|
|
111
112
|
</table>
|
package/RELEASE_NOTES.MD
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Develop
|
|
2
2
|
|
|
3
|
+
# FDM Monster 11/11/2024 1.7.3
|
|
4
|
+
|
|
5
|
+
## Fixes:
|
|
6
|
+
|
|
7
|
+
- BaseService: catch null or undefined id before querying database
|
|
8
|
+
- Add set user roles API to avoid users staying in limbo with GUEST role after verification.
|
|
9
|
+
- User API apply consistent string number coercion in user API to avoid unexpected ID comparison
|
|
10
|
+
|
|
11
|
+
# FDM Monster 11/11/2024 1.7.2
|
|
12
|
+
|
|
13
|
+
## Fixes:
|
|
14
|
+
|
|
15
|
+
- API & Service validators: adjust max length of apiKey property validation to 43 to allow new `secrets` based OctoPrint api keys
|
|
16
|
+
|
|
3
17
|
# FDM Monster 04/11/2024 1.7.1
|
|
4
18
|
|
|
5
19
|
## Changes:
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
checkPort: function() {
|
|
13
|
+
return checkPort;
|
|
14
|
+
},
|
|
15
|
+
scanPortRange: function() {
|
|
16
|
+
return scanPortRange;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _net = /*#__PURE__*/ _interop_require_default(require("net"));
|
|
20
|
+
const _cluster = /*#__PURE__*/ _interop_require_default(require("cluster"));
|
|
21
|
+
const _os = require("os");
|
|
22
|
+
function _interop_require_default(obj) {
|
|
23
|
+
return obj && obj.__esModule ? obj : {
|
|
24
|
+
default: obj
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const numCPUs = (0, _os.cpus)().length;
|
|
28
|
+
const commonServices = {
|
|
29
|
+
80: "HTTP",
|
|
30
|
+
443: "HTTPS",
|
|
31
|
+
22: "SSH",
|
|
32
|
+
21: "FTP",
|
|
33
|
+
3306: "MySQL",
|
|
34
|
+
5432: "PostgreSQL",
|
|
35
|
+
27017: "MongoDB",
|
|
36
|
+
6379: "Redis",
|
|
37
|
+
8080: "HTTP-Alternate",
|
|
38
|
+
8443: "HTTPS-Alternate"
|
|
39
|
+
};
|
|
40
|
+
async function checkPort(host, port) {
|
|
41
|
+
console.log("Worker defined " + host + ":" + port);
|
|
42
|
+
return new Promise((resolve)=>{
|
|
43
|
+
const socket = new _net.default.Socket();
|
|
44
|
+
const timeout = 1000;
|
|
45
|
+
socket.setTimeout(timeout);
|
|
46
|
+
socket.on("connect", ()=>{
|
|
47
|
+
socket.destroy();
|
|
48
|
+
resolve({
|
|
49
|
+
port,
|
|
50
|
+
status: "open",
|
|
51
|
+
service: commonServices[port]
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
socket.on("timeout", ()=>{
|
|
55
|
+
socket.destroy();
|
|
56
|
+
resolve({
|
|
57
|
+
port,
|
|
58
|
+
status: "closed"
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
socket.on("error", ()=>{
|
|
62
|
+
socket.destroy();
|
|
63
|
+
resolve({
|
|
64
|
+
port,
|
|
65
|
+
status: "closed"
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
socket.connect(port, host);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async function scanPortRange(host, start, end, specificPorts = []) {
|
|
72
|
+
const portsToScan = [
|
|
73
|
+
...Array.from({
|
|
74
|
+
length: end - start + 1
|
|
75
|
+
}, (_, i)=>start + i),
|
|
76
|
+
...specificPorts
|
|
77
|
+
].filter((value, index, self)=>self.indexOf(value) === index);
|
|
78
|
+
const chunkSize = Math.ceil(portsToScan.length / numCPUs);
|
|
79
|
+
const chunks = Array.from({
|
|
80
|
+
length: numCPUs
|
|
81
|
+
}, (_, i)=>portsToScan.slice(i * chunkSize, (i + 1) * chunkSize));
|
|
82
|
+
if (_cluster.default.isPrimary) {
|
|
83
|
+
console.log(`Primary ${process.pid} is running`);
|
|
84
|
+
console.log(`Starting scan on ${host} for ports ${start}-${end} and specific ports: ${specificPorts.join(", ")}`);
|
|
85
|
+
console.log(`Number of CPU cores: ${numCPUs}`);
|
|
86
|
+
const results = [];
|
|
87
|
+
const workers = new Set();
|
|
88
|
+
_cluster.default.on("exit", (worker, code, signal)=>{
|
|
89
|
+
console.log(`Worker ${worker.process.pid} died. Signal: ${signal}. Code: ${code}`);
|
|
90
|
+
workers.delete(worker);
|
|
91
|
+
if (workers.size === 0) {
|
|
92
|
+
console.log("All workers completed");
|
|
93
|
+
process.emit("allWorkersCompleted", results);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return new Promise((resolve, reject)=>{
|
|
97
|
+
const timeout = setTimeout(()=>{
|
|
98
|
+
for (const worker of workers){
|
|
99
|
+
worker.kill();
|
|
100
|
+
}
|
|
101
|
+
reject(new Error("Scan timeout after 30 seconds"));
|
|
102
|
+
}, 30000);
|
|
103
|
+
process.once("allWorkersCompleted", (finalResults)=>{
|
|
104
|
+
clearTimeout(timeout);
|
|
105
|
+
resolve(finalResults.sort((a, b)=>a.port - b.port));
|
|
106
|
+
});
|
|
107
|
+
chunks.forEach((chunk, index)=>{
|
|
108
|
+
try {
|
|
109
|
+
const worker = _cluster.default.fork();
|
|
110
|
+
workers.add(worker);
|
|
111
|
+
console.log(`Created worker ${worker.process.pid} for chunk ${index + 1}/${chunks.length}`);
|
|
112
|
+
worker.on("message", (msg)=>{
|
|
113
|
+
console.log(`Received results from worker ${worker.process.pid}: ${msg.length} ports`);
|
|
114
|
+
results.push(...msg);
|
|
115
|
+
});
|
|
116
|
+
worker.on("error", (error)=>{
|
|
117
|
+
console.error(`Worker ${worker.process.pid} error:`, error);
|
|
118
|
+
});
|
|
119
|
+
worker.send({
|
|
120
|
+
host,
|
|
121
|
+
ports: chunk
|
|
122
|
+
});
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error("Error creating worker:", error);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
} else {
|
|
129
|
+
console.log(`Worker ${process.pid} started`);
|
|
130
|
+
return new Promise((resolve)=>{
|
|
131
|
+
process.on("message", async (msg)=>{
|
|
132
|
+
try {
|
|
133
|
+
console.log(`Worker ${process.pid} received ${msg.ports.length} ports to scan`);
|
|
134
|
+
const results = [];
|
|
135
|
+
const promises = msg.ports.map((port)=>checkPort(msg.host, port));
|
|
136
|
+
const workerResults = await Promise.all(promises);
|
|
137
|
+
results.push(...workerResults);
|
|
138
|
+
if (process.send) {
|
|
139
|
+
process.send(results);
|
|
140
|
+
console.log(`Worker ${process.pid} completed scanning`);
|
|
141
|
+
}
|
|
142
|
+
process.exit(0);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error(`Worker ${process.pid} error:`, error);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (require.main === module) {
|
|
152
|
+
const host = process.argv[2] || "localhost";
|
|
153
|
+
scanPortRange(host, 80, 8888, [
|
|
154
|
+
27017
|
|
155
|
+
]).then((results)=>{
|
|
156
|
+
console.log("\nScan Results:");
|
|
157
|
+
const openPorts = results.filter((r)=>r.status === "open");
|
|
158
|
+
if (openPorts.length === 0) {
|
|
159
|
+
console.log("No open ports found");
|
|
160
|
+
} else {
|
|
161
|
+
console.table(openPorts);
|
|
162
|
+
}
|
|
163
|
+
process.exit(0);
|
|
164
|
+
}).catch((error)=>{
|
|
165
|
+
console.error("Error during scan:", error);
|
|
166
|
+
process.exit(1);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//# sourceMappingURL=check-ports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/consoles/check-ports.ts"],"names":["checkPort","scanPortRange","numCPUs","cpus","length","commonServices","host","port","console","log","Promise","resolve","socket","net","Socket","timeout","setTimeout","on","destroy","status","service","connect","start","end","specificPorts","portsToScan","Array","from","_","i","filter","value","index","self","indexOf","chunkSize","Math","ceil","chunks","slice","cluster","isPrimary","process","pid","join","results","workers","Set","worker","code","signal","delete","size","emit","reject","kill","Error","once","finalResults","clearTimeout","sort","a","b","forEach","chunk","fork","add","msg","push","error","send","ports","promises","map","workerResults","all","exit","require","main","module","argv","then","openPorts","r","table","catch"],"m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AGhB,IAAIhC,QAAQ4B,IAAI,EAAE;wBAChB5B,QAAQ4B,IAAI,CAACzB;wBACbrC,QAAQC,GAAG,CAAC,CAAC,OAAO,EAAEiC,QAAQC,GAAG,CAAC,mBAAmB,CAAC;oBACxD;oBAGAD,QAAQkC,IAAI,CAAC;gBACf,EAAE,OAAOP,OAAO;oBACd7D,QAAQ6D,KAAK,CAAC,CAAC,OAAO,EAAE3B,QAAQC,GAAG,CAAC,OAAO,CAAC,EAAE0B;oBAC9C3B,QAAQkC,IAAI,CAAC;gBACf;YACF;QACF;IACF;AACF;AAGA,IAAIC,QAAQC,IAAI,KAAKC,QAAQ;IAC3B,MAAMzE,OAAOoC,QAAQsC,IAAI,CAAC,EAAE,IAAI;IAEhC/E,cAAcK,MAAM,IAAI,MAAM;QAAC;KAAM,EAClC2E,IAAI,CAAC,CAACpC;QACLrC,QAAQC,GAAG,CAAC;QACZ,MAAMyE,YAAYrC,QAAQf,MAAM,CAAC,CAACqD,IAAMA,EAAEhE,MAAM,KAAK;QAErD,IAAI+D,UAAU9E,MAAM,KAAK,GAAG;YAC1BI,QAAQC,GAAG,CAAC;QACd,OAAO;YACLD,QAAQ4E,KAAK,CAACF;QAChB;QAEAxC,QAAQkC,IAAI,CAAC;IACf,GACCS,KAAK,CAAC,CAAChB;QACN7D,QAAQ6D,KAAK,CAAC,sBAAsBA;QACpC3B,QAAQkC,IAAI,CAAC;IACf;AACJ"}
|
|
@@ -9,18 +9,18 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
apiKeyLengthMaxDefault: function() {
|
|
13
|
+
return apiKeyLengthMaxDefault;
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
return
|
|
15
|
+
apiKeyLengthMinDefault: function() {
|
|
16
|
+
return apiKeyLengthMinDefault;
|
|
17
17
|
},
|
|
18
18
|
minFloorNameLength: function() {
|
|
19
19
|
return minFloorNameLength;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const UUID_LENGTH = 32;
|
|
23
22
|
const minFloorNameLength = 3;
|
|
24
|
-
const
|
|
23
|
+
const apiKeyLengthMinDefault = 32;
|
|
24
|
+
const apiKeyLengthMaxDefault = 43;
|
|
25
25
|
|
|
26
26
|
//# sourceMappingURL=service.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/service.constants.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../src/constants/service.constants.ts"],"names":["apiKeyLengthMaxDefault","apiKeyLengthMinDefault","minFloorNameLength"],"mappings":";;;;;;;;;;;IAGaA,sBAAsB;eAAtBA;;IADAC,sBAAsB;eAAtBA;;IAFAC,kBAAkB;eAAlBA;;;AAAN,MAAMA,qBAAqB;AAE3B,MAAMD,yBAAyB;AAC/B,MAAMD,yBAAyB"}
|
|
@@ -2,21 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
UserController: function() {
|
|
5
|
+
Object.defineProperty(exports, "UserController", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
13
8
|
return UserController;
|
|
14
|
-
},
|
|
15
|
-
default: function() {
|
|
16
|
-
return _default;
|
|
17
9
|
}
|
|
18
10
|
});
|
|
19
|
-
const
|
|
11
|
+
const _express = require("express");
|
|
20
12
|
const _serverconstants = require("../server.constants");
|
|
21
13
|
const _authenticate = require("../middleware/authenticate");
|
|
22
14
|
const _authorizationconstants = require("../constants/authorization.constants");
|
|
@@ -25,6 +17,16 @@ const _genericvalidation = require("./validation/generic.validation");
|
|
|
25
17
|
const _runtimeexceptions = require("../exceptions/runtime.exceptions");
|
|
26
18
|
const _demomiddleware = require("../middleware/demo.middleware");
|
|
27
19
|
const _errorutils = require("../utils/error.utils");
|
|
20
|
+
const _awilixexpress = require("awilix-express");
|
|
21
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
22
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
24
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
25
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26
|
+
}
|
|
27
|
+
function _ts_metadata(k, v) {
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
29
|
+
}
|
|
28
30
|
class UserController {
|
|
29
31
|
userService;
|
|
30
32
|
roleService;
|
|
@@ -42,6 +44,14 @@ class UserController {
|
|
|
42
44
|
this.isTypeormMode = isTypeormMode;
|
|
43
45
|
this.logger = loggerFactory(UserController.name);
|
|
44
46
|
}
|
|
47
|
+
async list(req, res) {
|
|
48
|
+
const users = await this.userService.listUsers();
|
|
49
|
+
res.send(users.map((u)=>this.userService.toDto(u)));
|
|
50
|
+
}
|
|
51
|
+
async listRoles(req, res) {
|
|
52
|
+
const roleDtos = this.roleService.roles.map((r)=>this.roleService.toDto(r));
|
|
53
|
+
res.send(roleDtos);
|
|
54
|
+
}
|
|
45
55
|
async profile(req, res) {
|
|
46
56
|
if (!req.user?.id) {
|
|
47
57
|
res.send({});
|
|
@@ -50,21 +60,16 @@ class UserController {
|
|
|
50
60
|
const user = await this.userService.getUser(req.user?.id);
|
|
51
61
|
res.send(this.userService.toDto(user));
|
|
52
62
|
}
|
|
53
|
-
async
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
async listRoles(req, res) {
|
|
58
|
-
const roleDtos = this.roleService.roles.map((r)=>this.roleService.toDto(r));
|
|
59
|
-
res.send(roleDtos);
|
|
63
|
+
async get(req, res) {
|
|
64
|
+
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
65
|
+
const user = await this.userService.getUser(id);
|
|
66
|
+
res.send(this.userService.toDto(user));
|
|
60
67
|
}
|
|
61
68
|
async delete(req, res) {
|
|
62
69
|
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
63
70
|
const ownUserId = req.user?.id;
|
|
64
|
-
if (ownUserId) {
|
|
65
|
-
|
|
66
|
-
throw new _runtimeexceptions.ForbiddenError("Not allowed to delete own account");
|
|
67
|
-
}
|
|
71
|
+
if (ownUserId == id) {
|
|
72
|
+
throw new _runtimeexceptions.ForbiddenError("Not allowed to delete own account");
|
|
68
73
|
}
|
|
69
74
|
const isRootUser = await this.userService.isUserRootUser(id);
|
|
70
75
|
if (isRootUser) {
|
|
@@ -84,14 +89,9 @@ class UserController {
|
|
|
84
89
|
}
|
|
85
90
|
res.send();
|
|
86
91
|
}
|
|
87
|
-
async get(req, res) {
|
|
88
|
-
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
89
|
-
const user = await this.userService.getUser(id);
|
|
90
|
-
res.send(this.userService.toDto(user));
|
|
91
|
-
}
|
|
92
92
|
async changeUsername(req, res) {
|
|
93
93
|
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
94
|
-
if (req.user?.id
|
|
94
|
+
if (req.user?.id != id && await this.settingsStore.getLoginRequired()) {
|
|
95
95
|
throw new _runtimeexceptions.ForbiddenError("Not allowed to change username of other users");
|
|
96
96
|
}
|
|
97
97
|
const { username } = await (0, _validators.validateInput)(req.body, {
|
|
@@ -102,7 +102,7 @@ class UserController {
|
|
|
102
102
|
}
|
|
103
103
|
async changePassword(req, res) {
|
|
104
104
|
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
105
|
-
if (req.user?.id
|
|
105
|
+
if (req.user?.id != id && await this.settingsStore.getLoginRequired()) {
|
|
106
106
|
throw new _runtimeexceptions.ForbiddenError("Not allowed to change password of other users");
|
|
107
107
|
}
|
|
108
108
|
const { oldPassword, newPassword } = await (0, _validators.validateInput)(req.body, {
|
|
@@ -112,13 +112,34 @@ class UserController {
|
|
|
112
112
|
await this.userService.updatePasswordById(id, oldPassword, newPassword);
|
|
113
113
|
res.send();
|
|
114
114
|
}
|
|
115
|
+
async setUserRoles(req, res) {
|
|
116
|
+
const { id: currentUserId } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
117
|
+
const ownUserId = req.user?.id;
|
|
118
|
+
const ownUser = await this.userService.getUser(ownUserId);
|
|
119
|
+
const ownUserRoles = ownUser.roles;
|
|
120
|
+
const adminRole = await this.roleService.getSynchronizedRoleByName(_authorizationconstants.ROLES.ADMIN);
|
|
121
|
+
if (ownUserId == currentUserId && !ownUserRoles.includes(adminRole.id) && !ownUser.isRootUser) {
|
|
122
|
+
throw new _runtimeexceptions.ForbiddenError("Only an ADMIN or OWNER user is allowed to change its own roles");
|
|
123
|
+
}
|
|
124
|
+
const { roleIds } = await (0, _validators.validateInput)(req.body, {
|
|
125
|
+
roleIds: "array",
|
|
126
|
+
"roleIds.*": "alphaNumeric"
|
|
127
|
+
});
|
|
128
|
+
if (ownUserId == currentUserId && !roleIds.includes(adminRole.id)) {
|
|
129
|
+
if (ownUser.isRootUser) {
|
|
130
|
+
throw new _runtimeexceptions.BadRequestException("It does not make sense to remove ADMIN role from an OWNER user.");
|
|
131
|
+
} else {
|
|
132
|
+
throw new _runtimeexceptions.BadRequestException("An ADMIN user cannot remove its ADMIN role.");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
await this.userService.setUserRoleIds(currentUserId, roleIds);
|
|
136
|
+
res.send();
|
|
137
|
+
}
|
|
115
138
|
async setVerified(req, res) {
|
|
116
139
|
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
117
140
|
const ownUserId = req.user?.id;
|
|
118
|
-
if (ownUserId) {
|
|
119
|
-
|
|
120
|
-
throw new _runtimeexceptions.ForbiddenError("Not allowed to change own verified status");
|
|
121
|
-
}
|
|
141
|
+
if (ownUserId == id) {
|
|
142
|
+
throw new _runtimeexceptions.ForbiddenError("Not allowed to change own verified status");
|
|
122
143
|
}
|
|
123
144
|
const isRootUser = await this.userService.isUserRootUser(id);
|
|
124
145
|
if (isRootUser) {
|
|
@@ -152,38 +173,152 @@ class UserController {
|
|
|
152
173
|
}
|
|
153
174
|
}
|
|
154
175
|
}
|
|
155
|
-
|
|
156
|
-
(0,
|
|
157
|
-
|
|
158
|
-
before
|
|
176
|
+
_ts_decorate([
|
|
177
|
+
(0, _awilixexpress.GET)(),
|
|
178
|
+
(0, _awilixexpress.route)("/"),
|
|
179
|
+
(0, _awilixexpress.before)([
|
|
159
180
|
(0, _authenticate.authorizeRoles)([
|
|
160
181
|
_authorizationconstants.ROLES.ADMIN
|
|
161
182
|
])
|
|
162
|
-
]
|
|
163
|
-
|
|
164
|
-
|
|
183
|
+
]),
|
|
184
|
+
_ts_metadata("design:type", Function),
|
|
185
|
+
_ts_metadata("design:paramtypes", [
|
|
186
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
187
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
188
|
+
]),
|
|
189
|
+
_ts_metadata("design:returntype", Promise)
|
|
190
|
+
], UserController.prototype, "list", null);
|
|
191
|
+
_ts_decorate([
|
|
192
|
+
(0, _awilixexpress.GET)(),
|
|
193
|
+
(0, _awilixexpress.route)("/roles"),
|
|
194
|
+
_ts_metadata("design:type", Function),
|
|
195
|
+
_ts_metadata("design:paramtypes", [
|
|
196
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
197
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
198
|
+
]),
|
|
199
|
+
_ts_metadata("design:returntype", Promise)
|
|
200
|
+
], UserController.prototype, "listRoles", null);
|
|
201
|
+
_ts_decorate([
|
|
202
|
+
(0, _awilixexpress.GET)(),
|
|
203
|
+
(0, _awilixexpress.route)("/profile"),
|
|
204
|
+
_ts_metadata("design:type", Function),
|
|
205
|
+
_ts_metadata("design:paramtypes", [
|
|
206
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
207
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
208
|
+
]),
|
|
209
|
+
_ts_metadata("design:returntype", Promise)
|
|
210
|
+
], UserController.prototype, "profile", null);
|
|
211
|
+
_ts_decorate([
|
|
212
|
+
(0, _awilixexpress.GET)(),
|
|
213
|
+
(0, _awilixexpress.route)("/:id"),
|
|
214
|
+
(0, _awilixexpress.before)([
|
|
165
215
|
(0, _authenticate.authorizeRoles)([
|
|
166
216
|
_authorizationconstants.ROLES.ADMIN
|
|
167
217
|
])
|
|
168
|
-
]
|
|
169
|
-
|
|
170
|
-
|
|
218
|
+
]),
|
|
219
|
+
_ts_metadata("design:type", Function),
|
|
220
|
+
_ts_metadata("design:paramtypes", [
|
|
221
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
222
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
223
|
+
]),
|
|
224
|
+
_ts_metadata("design:returntype", Promise)
|
|
225
|
+
], UserController.prototype, "get", null);
|
|
226
|
+
_ts_decorate([
|
|
227
|
+
(0, _awilixexpress.DELETE)(),
|
|
228
|
+
(0, _awilixexpress.route)("/:id"),
|
|
229
|
+
(0, _awilixexpress.before)([
|
|
171
230
|
(0, _authenticate.authorizeRoles)([
|
|
172
231
|
_authorizationconstants.ROLES.ADMIN
|
|
173
232
|
]),
|
|
174
233
|
_demomiddleware.demoUserNotAllowed
|
|
175
|
-
]
|
|
176
|
-
|
|
177
|
-
|
|
234
|
+
]),
|
|
235
|
+
_ts_metadata("design:type", Function),
|
|
236
|
+
_ts_metadata("design:paramtypes", [
|
|
237
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
238
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
239
|
+
]),
|
|
240
|
+
_ts_metadata("design:returntype", Promise)
|
|
241
|
+
], UserController.prototype, "delete", null);
|
|
242
|
+
_ts_decorate([
|
|
243
|
+
(0, _awilixexpress.POST)(),
|
|
244
|
+
(0, _awilixexpress.route)("/:id/change-username"),
|
|
245
|
+
(0, _awilixexpress.before)([
|
|
246
|
+
_demomiddleware.demoUserNotAllowed
|
|
247
|
+
]),
|
|
248
|
+
_ts_metadata("design:type", Function),
|
|
249
|
+
_ts_metadata("design:paramtypes", [
|
|
250
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
251
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
252
|
+
]),
|
|
253
|
+
_ts_metadata("design:returntype", Promise)
|
|
254
|
+
], UserController.prototype, "changeUsername", null);
|
|
255
|
+
_ts_decorate([
|
|
256
|
+
(0, _awilixexpress.POST)(),
|
|
257
|
+
(0, _awilixexpress.route)("/:id/change-password"),
|
|
258
|
+
(0, _awilixexpress.before)([
|
|
178
259
|
_demomiddleware.demoUserNotAllowed
|
|
179
|
-
]
|
|
180
|
-
|
|
181
|
-
|
|
260
|
+
]),
|
|
261
|
+
_ts_metadata("design:type", Function),
|
|
262
|
+
_ts_metadata("design:paramtypes", [
|
|
263
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
264
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
265
|
+
]),
|
|
266
|
+
_ts_metadata("design:returntype", Promise)
|
|
267
|
+
], UserController.prototype, "changePassword", null);
|
|
268
|
+
_ts_decorate([
|
|
269
|
+
(0, _awilixexpress.POST)(),
|
|
270
|
+
(0, _awilixexpress.route)("/:id/set-user-roles"),
|
|
271
|
+
(0, _awilixexpress.before)([
|
|
182
272
|
(0, _authenticate.authorizeRoles)([
|
|
183
273
|
_authorizationconstants.ROLES.ADMIN
|
|
184
274
|
]),
|
|
185
275
|
_demomiddleware.demoUserNotAllowed
|
|
186
|
-
]
|
|
187
|
-
|
|
276
|
+
]),
|
|
277
|
+
_ts_metadata("design:type", Function),
|
|
278
|
+
_ts_metadata("design:paramtypes", [
|
|
279
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
280
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
281
|
+
]),
|
|
282
|
+
_ts_metadata("design:returntype", Promise)
|
|
283
|
+
], UserController.prototype, "setUserRoles", null);
|
|
284
|
+
_ts_decorate([
|
|
285
|
+
(0, _awilixexpress.POST)(),
|
|
286
|
+
(0, _awilixexpress.route)("/:id/set-verified"),
|
|
287
|
+
(0, _awilixexpress.before)([
|
|
288
|
+
(0, _authenticate.authorizeRoles)([
|
|
289
|
+
_authorizationconstants.ROLES.ADMIN
|
|
290
|
+
]),
|
|
291
|
+
_demomiddleware.demoUserNotAllowed
|
|
292
|
+
]),
|
|
293
|
+
_ts_metadata("design:type", Function),
|
|
294
|
+
_ts_metadata("design:paramtypes", [
|
|
295
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
296
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
297
|
+
]),
|
|
298
|
+
_ts_metadata("design:returntype", Promise)
|
|
299
|
+
], UserController.prototype, "setVerified", null);
|
|
300
|
+
_ts_decorate([
|
|
301
|
+
(0, _awilixexpress.POST)(),
|
|
302
|
+
(0, _awilixexpress.route)("/:id/set-root-user"),
|
|
303
|
+
(0, _awilixexpress.before)([
|
|
304
|
+
_demomiddleware.demoUserNotAllowed
|
|
305
|
+
]),
|
|
306
|
+
_ts_metadata("design:type", Function),
|
|
307
|
+
_ts_metadata("design:paramtypes", [
|
|
308
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
309
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
310
|
+
]),
|
|
311
|
+
_ts_metadata("design:returntype", Promise)
|
|
312
|
+
], UserController.prototype, "setRootUser", null);
|
|
313
|
+
UserController = _ts_decorate([
|
|
314
|
+
(0, _awilixexpress.route)(_serverconstants.AppConstants.apiRoute + "/user"),
|
|
315
|
+
(0, _awilixexpress.before)([
|
|
316
|
+
(0, _authenticate.authenticate)()
|
|
317
|
+
]),
|
|
318
|
+
_ts_metadata("design:type", Function),
|
|
319
|
+
_ts_metadata("design:paramtypes", [
|
|
320
|
+
Object
|
|
321
|
+
])
|
|
322
|
+
], UserController);
|
|
188
323
|
|
|
189
324
|
//# sourceMappingURL=user.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/controllers/user.controller.ts"],"names":["UserController","userService","roleService","configService","authService","settingsStore","logger","isTypeormMode","constructor","loggerFactory","name","
|
|
1
|
+
{"version":3,"sources":["../../src/controllers/user.controller.ts"],"names":["UserController","userService","roleService","configService","authService","settingsStore","logger","isTypeormMode","constructor","loggerFactory","name","list","req","res","users","listUsers","send","map","u","toDto","listRoles","roleDtos","roles","r","profile","user","id","getUser","get","validateInput","params","idRulesV2","delete","ownUserId","ForbiddenError","isRootUser","isUserRootUser","isDemoMode","demoUserId","getDemoUserId","throwIfDemoMode","deleteUser","logoutUserId","e","error","errorSummary","changeUsername","getLoginRequired","username","body","updateUsernameById","changePassword","oldPassword","newPassword","updatePasswordById","setUserRoles","currentUserId","ownUser","ownUserRoles","adminRole","getSynchronizedRoleByName","ROLES","ADMIN","includes","roleIds","BadRequestException","setUserRoleIds","setVerified","isVerified","setVerifiedById","setRootUser","userId","setIsRootUserById","authorizeRoles","demoUserNotAllowed","AppConstants","apiRoute","authenticate"],"mappings":";;;;+BAqBaA;;;eAAAA;;;yBApBqB;iCACL;8BACgB;wCACvB;4BACQ;mCACJ;mCAC0B;gCAGjB;4BAKN;+BAEoB;;;;;;;;;;A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AAkB;;;;;;;;;;;;;QAwBjDA,kCAAkB;;;;;;;;;;8BAxMtBC,6BAAY,CAACC,QAAQ,GAAG;;QACtBC,IAAAA,0BAAY"}
|
|
@@ -44,7 +44,7 @@ const feedRateRules = {
|
|
|
44
44
|
};
|
|
45
45
|
const testPrinterApiRules = {
|
|
46
46
|
printerType: `required|integer|in:${_printerapiinterface.OctoprintType},${_printerapiinterface.MoonrakerType}`,
|
|
47
|
-
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.
|
|
47
|
+
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.apiKeyLengthMaxDefault},${_serviceconstants.apiKeyLengthMinDefault}|alphaDash`,
|
|
48
48
|
printerURL: "required|httpurl"
|
|
49
49
|
};
|
|
50
50
|
const updatePrinterDisabledReasonRules = {
|
|
@@ -56,7 +56,7 @@ const updatePrinterEnabledRule = {
|
|
|
56
56
|
const updatePrinterConnectionSettingRules = {
|
|
57
57
|
printerType: `required|integer|in:${_printerapiinterface.OctoprintType},${_printerapiinterface.MoonrakerType}`,
|
|
58
58
|
printerURL: "required|httpurl",
|
|
59
|
-
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.
|
|
59
|
+
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.apiKeyLengthMaxDefault},${_serviceconstants.apiKeyLengthMinDefault}|alphaDash`
|
|
60
60
|
};
|
|
61
61
|
const createOctoPrintBackupRules = {
|
|
62
62
|
exclude: "array",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/controllers/validation/printer-controller.validation.ts"],"names":["createOctoPrintBackupRules","feedRateRules","flowRateRules","getOctoPrintBackupRules","testPrinterApiRules","updatePrinterConnectionSettingRules","updatePrinterDisabledReasonRules","updatePrinterEnabledRule","flowRate","feedRate","printerType","OctoprintType","MoonrakerType","apiKey","
|
|
1
|
+
{"version":3,"sources":["../../../src/controllers/validation/printer-controller.validation.ts"],"names":["createOctoPrintBackupRules","feedRateRules","flowRateRules","getOctoPrintBackupRules","testPrinterApiRules","updatePrinterConnectionSettingRules","updatePrinterDisabledReasonRules","updatePrinterEnabledRule","flowRate","feedRate","printerType","OctoprintType","MoonrakerType","apiKey","apiKeyLengthMaxDefault","apiKeyLengthMinDefault","printerURL","disabledReason","enabled","exclude","fileName"],"mappings":";;;;;;;;;;;IA+BaA,0BAA0B;eAA1BA;;IAxBAC,aAAa;eAAbA;;IAJAC,aAAa;eAAbA;;IAiCAC,uBAAuB;eAAvBA;;IAzBAC,mBAAmB;eAAnBA;;IAcAC,mCAAmC;eAAnCA;;IARAC,gCAAgC;eAAhCA;;IAIAC,wBAAwB;eAAxBA;;;kCArBkD;qCAClB;AAEtC,MAAML,gBAAgB;IAC3BM,UAAU;AACZ;AAEO,MAAMP,gBAAgB;IAC3BQ,UAAU;AACZ;AAEO,MAAML,sBAAsB;IACjCM,aAAa,CAAC,oBAAoB,EAAEC,kCAAa,CAAC,CAAC,EAAEC,kCAAa,EAAE;IACpEC,QAAQ,CAAC,uBAAuB,EAAEF,kCAAa,CAAC,QAAQ,EAAEG,wCAAsB,CAAC,CAAC,EAAEC,wCAAsB,CAAC,UAAU,CAAC;IACtHC,YAAY;AACd;AAEO,MAAMV,mCAAmC;IAC9CW,gBAAgB;AAClB;AAEO,MAAMV,2BAA2B;IACtCW,SAAS;AACX;AAEO,MAAMb,sCAAsC;IACjDK,aAAa,CAAC,oBAAoB,EAAEC,kCAAa,CAAC,CAAC,EAAEC,kCAAa,EAAE;IACpEI,YAAY;IACZH,QAAQ,CAAC,uBAAuB,EAAEF,kCAAa,CAAC,QAAQ,EAAEG,wCAAsB,CAAC,CAAC,EAAEC,wCAAsB,CAAC,UAAU,CAAC;AACxH;AAEO,MAAMf,6BAA6B;IACxCmB,SAAS;IACT,aAAa;AACf;AAEO,MAAMhB,0BAA0B;IACrCiB,UAAU;AACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/Printer.ts"],"names":["Printer","PrinterSchema","Schema","apiKey","type","String","default","printerURL","required","printerType","Number","OctoprintType","enabled","Boolean","disabledReason","assignee","name","currentUser","dateAdded","feedRate","flowRate","model"],"mappings":";;;;;;;;;;;IAoEaA,OAAO;eAAPA;;IAlDAC,aAAa;eAAbA;;;0BAlBiB;
|
|
1
|
+
{"version":3,"sources":["../../src/models/Printer.ts"],"names":["Printer","PrinterSchema","Schema","apiKey","type","String","default","printerURL","required","printerType","Number","OctoprintType","enabled","Boolean","disabledReason","assignee","name","currentUser","dateAdded","feedRate","flowRate","model"],"mappings":";;;;;;;;;;;IAoEaA,OAAO;eAAPA;;IAlDAC,aAAa;eAAbA;;;0BAlBiB;qCACA;AAiBvB,MAAMA,gBAAgB,IAAIC,gBAAM,CAAW;IAChDC,QAAQ;QACNC,MAAMC;QACNC,SAAS;IACX;IACAC,YAAY;QACVH,MAAMC;QACNG,UAAU;IACZ;IACAC,aAAa;QACXL,MAAMM;QACNF,UAAU;QACVF,SAASK,kCAAa;IACxB;IACAC,SAAS;QACPR,MAAMS;QACNL,UAAU;QACVF,SAAS;IACX;IACAQ,gBAAgB;QACdV,MAAMC;QACNG,UAAU;IACZ;IACAO,UAAU;QACRX,MAAMC;QACNG,UAAU;IACZ;IACAQ,MAAM;QACJZ,MAAMC;QACNG,UAAU;IACZ;IAEAS,aAAa;QACXb,MAAMC;QACNG,UAAU;IACZ;IACAU,WAAW;QACTd,MAAMM;QACNF,UAAU;IACZ;IACAW,UAAU;QACRf,MAAMM;QACNF,UAAU;IACZ;IACAY,UAAU;QACRhB,MAAMM;QACNF,UAAU;IACZ;AACF;AAEO,MAAMR,UAAUqB,IAAAA,eAAK,EAAC,WAAWpB"}
|
package/dist/server.constants.js
CHANGED
|
@@ -66,7 +66,7 @@ const AppConstants = {
|
|
|
66
66
|
githubUrl: "https://github.com/fdm-monster/fdm-monster",
|
|
67
67
|
orgName: "fdm-monster",
|
|
68
68
|
currentWizardVersion: 1,
|
|
69
|
-
defaultClientMinimum: "1.6.
|
|
69
|
+
defaultClientMinimum: "1.6.10",
|
|
70
70
|
influxUrl: "INFLUX_URL",
|
|
71
71
|
influxToken: "INFLUX_TOKEN",
|
|
72
72
|
influxOrg: "INFLUX_ORG",
|
|
@@ -22,6 +22,9 @@ function BaseService(entity, dto, createDTO, updateDto) {
|
|
|
22
22
|
}
|
|
23
23
|
async get(id, throwIfNotFound = true, options) {
|
|
24
24
|
try {
|
|
25
|
+
if (id === null || id === undefined) {
|
|
26
|
+
throw new _typeorm.EntityNotFoundError(entity, "Id was not provided");
|
|
27
|
+
}
|
|
25
28
|
return this.repository.findOneOrFail({
|
|
26
29
|
...options,
|
|
27
30
|
where: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/services/orm/base.service.ts"],"names":["BaseService","entity","dto","createDTO","updateDto","BaseServiceHost","typeormService","repository","constructor","getDataSource","getRepository","get","id","throwIfNotFound","options","
|
|
1
|
+
{"version":3,"sources":["../../../src/services/orm/base.service.ts"],"names":["BaseService","entity","dto","createDTO","updateDto","BaseServiceHost","typeormService","repository","constructor","getDataSource","getRepository","get","id","throwIfNotFound","options","undefined","EntityNotFoundError","findOneOrFail","where","e","NotFoundException","list","find","listPaged","page","DEFAULT_PAGE","take","pageSize","skip","update","validate","Object","assign","create","save","delete","deleteMany","ids","emitEvent"],"mappings":";;;;+BAkBgBA;;;eAAAA;;;yBAPT;gCACkB;mCAGS;+BACQ;AAEnC,SAASA,YAKdC,MAAuB,EAAEC,GAAc,EAAEC,SAA2B,EAAEC,SAA2B;IACjG,MAAeC;QACbC,eAA+B;QAC/BC,WAA0B;QAE1BC,YAAY,EAAEF,cAAc,EAAsC,CAAE;YAClE,IAAI,CAACA,cAAc,GAAGA;YACtB,IAAI,CAACC,UAAU,GAAGD,eAAeG,aAAa,GAAGC,aAAa,CAACT;QACjE;QAIA,MAAMU,IAAIC,EAAgB,E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B,MAAM,CAAC/B;YACtC,MAAM4B,IAAAA,wBAAQ,EAAC7B;YAEf,OAAO,MAAM,IAAI,CAACM,UAAU,CAAC2B,IAAI,CAACjC;QACpC;QAEA,MAAMkC,OAAOvB,EAAgB,EAAEC,kBAAkB,IAAI,EAAE;YACrD,MAAMZ,SAAS,MAAM,IAAI,CAACU,GAAG,CAACC,IAAIC;YAClC,OAAO,MAAM,IAAI,CAACN,UAAU,CAAC4B,MAAM,CAAClC,OAAOW,EAAE;QAC/C;QAEA,MAAMwB,WAAWC,GAAmB,EAAEC,YAAY,IAAI,EAAyB;YAC7E,OAAO,MAAM,IAAI,CAAC/B,UAAU,CAAC4B,MAAM,CAACE;QACtC;IACF;IAEA,OAAOhC;AACT"}
|
|
@@ -28,14 +28,14 @@ const createMongoPrinterRules = {
|
|
|
28
28
|
_id: "not",
|
|
29
29
|
printerURL: "required|httpurl",
|
|
30
30
|
printerType: `required|integer|in:${_printerapiinterface.OctoprintType},${_printerapiinterface.MoonrakerType}`,
|
|
31
|
-
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.
|
|
31
|
+
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.apiKeyLengthMaxDefault},${_serviceconstants.apiKeyLengthMinDefault}|alphaDash`,
|
|
32
32
|
enabled: "boolean",
|
|
33
33
|
name: "string"
|
|
34
34
|
};
|
|
35
35
|
const createPrinterRules = {
|
|
36
36
|
printerURL: "required|httpurl",
|
|
37
37
|
printerType: `required|integer|in:${_printerapiinterface.OctoprintType},${_printerapiinterface.MoonrakerType}`,
|
|
38
|
-
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.
|
|
38
|
+
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.apiKeyLengthMaxDefault},${_serviceconstants.apiKeyLengthMinDefault}|alphaDash`,
|
|
39
39
|
enabled: "boolean",
|
|
40
40
|
name: "required|string"
|
|
41
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/services/validators/printer-service.validation.ts"],"names":["createMongoPrinterRules","createPrinterRules","updatePrinterDisabledReasonRule","updatePrinterEnabledRule","_id","printerURL","printerType","OctoprintType","MoonrakerType","apiKey","
|
|
1
|
+
{"version":3,"sources":["../../../src/services/validators/printer-service.validation.ts"],"names":["createMongoPrinterRules","createPrinterRules","updatePrinterDisabledReasonRule","updatePrinterEnabledRule","_id","printerURL","printerType","OctoprintType","MoonrakerType","apiKey","apiKeyLengthMaxDefault","apiKeyLengthMinDefault","enabled","name","disabledReason"],"mappings":";;;;;;;;;;;IAGaA,uBAAuB;eAAvBA;;IASAC,kBAAkB;eAAlBA;;IAYAC,+BAA+B;eAA/BA;;IAJAC,wBAAwB;eAAxBA;;;kCApBkD;qCAClB;AAEtC,MAAMH,0BAA0B;IACrCI,KAAK;IACLC,YAAY;IACZC,aAAa,CAAC,oBAAoB,EAAEC,kCAAa,CAAC,CAAC,EAAEC,kCAAa,EAAE;IACpEC,QAAQ,CAAC,uBAAuB,EAAEF,kCAAa,CAAC,QAAQ,EAAEG,wCAAsB,CAAC,CAAC,EAAEC,wCAAsB,CAAC,UAAU,CAAC;IACtHC,SAAS;IACTC,MAAM;AACR;AAEO,MAAMZ,qBAAqB;IAChCI,YAAY;IACZC,aAAa,CAAC,oBAAoB,EAAEC,kCAAa,CAAC,CAAC,EAAEC,kCAAa,EAAE;IACpEC,QAAQ,CAAC,uBAAuB,EAAEF,kCAAa,CAAC,QAAQ,EAAEG,wCAAsB,CAAC,CAAC,EAAEC,wCAAsB,CAAC,UAAU,CAAC;IACtHC,SAAS;IACTC,MAAM;AACR;AAEO,MAAMV,2BAA2B;IACtCS,SAAS;AACX;AAEO,MAAMV,kCAAkC;IAC7CY,gBAAgB;IAChBF,SAAS;AACX"}
|
|
@@ -44,7 +44,7 @@ const importPrintersFloorsYamlRules = (importPrinters, importFloorGrid, importFl
|
|
|
44
44
|
"config.floorComparisonStrategiesByPriority": "required|string|in:name,floor,id",
|
|
45
45
|
printers: `${!!importPrinters ? "array|minLength:0" : "not"}`,
|
|
46
46
|
"printers.*.id": "required",
|
|
47
|
-
"printers.*.apiKey": `required|length:${_serviceconstants.
|
|
47
|
+
"printers.*.apiKey": `required|length:${_serviceconstants.apiKeyLengthMaxDefault},${_serviceconstants.apiKeyLengthMinDefault}|alphaNumeric`,
|
|
48
48
|
"printers.*.printerURL": "required|httpurl",
|
|
49
49
|
"printers.*.enabled": "boolean",
|
|
50
50
|
"printers.*.printerType": `integer|in:${_printerapiinterface.OctoprintType},${_printerapiinterface.MoonrakerType}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/services/validators/yaml-service.validation.ts"],"names":["exportPrintersFloorsYamlRules","importPrinterPositionsRules","importPrintersFloorsYamlRules","exportPrinters","exportFloorGrid","exportFloors","exportGroups","printerComparisonStrategiesByPriority","floorComparisonStrategiesByPriority","notes","importPrinters","importFloorGrid","importFloors","importGroups","version","config","printers","
|
|
1
|
+
{"version":3,"sources":["../../../src/services/validators/yaml-service.validation.ts"],"names":["exportPrintersFloorsYamlRules","importPrinterPositionsRules","importPrintersFloorsYamlRules","exportPrinters","exportFloorGrid","exportFloors","exportGroups","printerComparisonStrategiesByPriority","floorComparisonStrategiesByPriority","notes","importPrinters","importFloorGrid","importFloors","importGroups","version","config","printers","apiKeyLengthMaxDefault","apiKeyLengthMinDefault","OctoprintType","MoonrakerType","floors","groups","isTypeormMode"],"mappings":";;;;;;;;;;;IAGaA,6BAA6B;eAA7BA;;IAsDAC,2BAA2B;eAA3BA;;IApCAC,6BAA6B;eAA7BA;;;kCArBkD;qCAClB;AAEtC,MAAMF,gCAAgC;IAE3CG,gBAAgB;IAChBC,iBAAiB;IACjBC,cAAc;IAEdC,cAAc;IAEdC,uCAAuC;IACvC,2CAA2C;IAC3CC,qCAAqC;IAErCC,OAAO;AAIT;AAEO,MAAMP,gCAAgC,CAC3CQ,gBACAC,iBACAC,cACAC;IAEA,OAAO;QACLC,SAAS;QACTC,QAAQ;QACR,yBAAyB;QACzB,0BAA0B;QAC1B,uBAAuB;QACvB,uBAAuB;QACvB,gDAAgD;QAChD,kDAAkD;QAClD,8CAA8C;QAC9CC,UAAU,GAAG,CAAC,CAACN,iBAAiB,sBAAsB,OAAO;QAC7D,iBAAiB;QACjB,qBAAqB,CAAC,gBAAgB,EAAEO,wCAAsB,CAAC,CAAC,EAAEC,wCAAsB,CAAC,aAAa,CAAC;QACvG,yBAAyB;QACzB,sBAAsB;QACtB,0BAA0B,CAAC,WAAW,EAAEC,kCAAa,CAAC,CAAC,EAAEC,kCAAa,EAAE;QACxE,mBAAmB;QACnBC,QAAQ,GAAG,CAAC,CAACT,eAAe,sBAAsB,OAAO;QACzD,eAAe;QACf,kBAAkB;QAClB,iBAAiB;QAEjBU,QAAQ,GAAG,CAAC,CAACT,eAAe,sBAAsB,OAAO;QACzD,eAAe;QACf,iBAAiB;IAGnB;AACF;AAEO,MAAMZ,8BAA8B,CAACsB,gBAA4B,CAAA;QACtEP,UAAU;QACV,wBAAwB;QAExB,gBAAgB;QAChB,gBAAgB;IAClB,CAAA"}
|
|
@@ -13,7 +13,7 @@ const _printerapiinterface = require("../../services/printer-api.interface");
|
|
|
13
13
|
const createTestPrinterRules = {
|
|
14
14
|
printerType: `required|integer|in:${_printerapiinterface.OctoprintType},${_printerapiinterface.MoonrakerType}`,
|
|
15
15
|
correlationToken: "required|string",
|
|
16
|
-
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.
|
|
16
|
+
apiKey: `requiredIf:printerType,${_printerapiinterface.OctoprintType}|length:${_serviceconstants.apiKeyLengthMaxDefault},${_serviceconstants.apiKeyLengthMinDefault}|alphaDash`,
|
|
17
17
|
printerURL: "required|httpurl"
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/validation/create-test-printer.validation.ts"],"names":["createTestPrinterRules","printerType","OctoprintType","MoonrakerType","correlationToken","apiKey","
|
|
1
|
+
{"version":3,"sources":["../../../src/state/validation/create-test-printer.validation.ts"],"names":["createTestPrinterRules","printerType","OctoprintType","MoonrakerType","correlationToken","apiKey","apiKeyLengthMaxDefault","apiKeyLengthMinDefault","printerURL"],"mappings":";;;;+BAGaA;;;eAAAA;;;kCAHkD;qCAClB;AAEtC,MAAMA,yBAAyB;IACpCC,aAAa,CAAC,oBAAoB,EAAEC,kCAAa,CAAC,CAAC,EAAEC,kCAAa,EAAE;IACpEC,kBAAkB;IAClBC,QAAQ,CAAC,uBAAuB,EAAEH,kCAAa,CAAC,QAAQ,EAAEI,wCAAsB,CAAC,CAAC,EAAEC,wCAAsB,CAAC,UAAU,CAAC;IACtHC,YAAY;AACd"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
},
|
|
7
7
|
"author": "David Zwart",
|
|
8
8
|
"license": "AGPL-3.0-or-later",
|
|
9
|
-
"version": "1.7.
|
|
9
|
+
"version": "1.7.3",
|
|
10
10
|
"bin": {
|
|
11
11
|
"fdm-monster": "dist/index.js",
|
|
12
12
|
"fdmm": "dist/index.js"
|
|
@@ -53,18 +53,18 @@
|
|
|
53
53
|
"vue"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@fdm-monster/client": "1.6.
|
|
57
|
-
"@fdm-monster/client-next": "0.0.
|
|
56
|
+
"@fdm-monster/client": "1.6.10",
|
|
57
|
+
"@fdm-monster/client-next": "0.0.7",
|
|
58
58
|
"@influxdata/influxdb-client": "1.35.0",
|
|
59
59
|
"@octokit/plugin-throttling": "8.2.0",
|
|
60
|
-
"@sentry/node": "8.
|
|
60
|
+
"@sentry/node": "8.37.1",
|
|
61
61
|
"adm-zip": "0.5.16",
|
|
62
62
|
"awilix": "12.0.3",
|
|
63
63
|
"awilix-express": "9.0.1",
|
|
64
64
|
"axios": "1.7.7",
|
|
65
65
|
"bcryptjs": "2.4.3",
|
|
66
66
|
"better-sqlite3": "11.5.0",
|
|
67
|
-
"cache-manager": "6.1.
|
|
67
|
+
"cache-manager": "6.1.3",
|
|
68
68
|
"class-validator": "0.14.1",
|
|
69
69
|
"connect-history-api-fallback": "2.0.0",
|
|
70
70
|
"cookie-parser": "1.4.7",
|
|
@@ -95,15 +95,15 @@
|
|
|
95
95
|
"socket.io": "4.8.1",
|
|
96
96
|
"toad-scheduler": "3.0.1",
|
|
97
97
|
"typeorm": "0.3.20",
|
|
98
|
-
"uuid": "11.0.
|
|
99
|
-
"winston": "3.
|
|
98
|
+
"uuid": "11.0.3",
|
|
99
|
+
"winston": "3.17.0",
|
|
100
100
|
"ws": "8.18.0"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@lcov-viewer/cli": "1.3.0",
|
|
104
104
|
"@lcov-viewer/istanbul-report": "1.4.0",
|
|
105
105
|
"@swc/cli": "0.5.0",
|
|
106
|
-
"@swc/core": "1.
|
|
106
|
+
"@swc/core": "1.9.2",
|
|
107
107
|
"@swc/jest": "0.2.37",
|
|
108
108
|
"@types/adm-zip": "0.5.6",
|
|
109
109
|
"@types/bcryptjs": "2.4.6",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@types/luxon": "3.4.2",
|
|
119
119
|
"@types/migrate-mongo": "10.0.5",
|
|
120
120
|
"@types/multer": "1.4.12",
|
|
121
|
-
"@types/node": "22.
|
|
121
|
+
"@types/node": "22.9.0",
|
|
122
122
|
"@types/passport-anonymous": "1.0.5",
|
|
123
123
|
"@types/passport-jwt": "4.0.1",
|
|
124
124
|
"@types/semver": "7.5.8",
|
|
@@ -132,14 +132,14 @@
|
|
|
132
132
|
"eslint-config-prettier": "9.1.0",
|
|
133
133
|
"eslint-config-standard": "17.1.0",
|
|
134
134
|
"eslint-plugin-import": "2.31.0",
|
|
135
|
-
"eslint-plugin-n": "17.
|
|
135
|
+
"eslint-plugin-n": "17.13.1",
|
|
136
136
|
"eslint-plugin-prettier": "4.2.1",
|
|
137
137
|
"eslint-plugin-promise": "7.1.0",
|
|
138
138
|
"express-list-routes": "1.2.4",
|
|
139
139
|
"jest": "29.7.0",
|
|
140
140
|
"jest-27-expect-message": "1.1.0",
|
|
141
141
|
"mongodb-memory-server": "10.1.2",
|
|
142
|
-
"nock": "13.5.
|
|
142
|
+
"nock": "13.5.6",
|
|
143
143
|
"prettier": "2.8.8",
|
|
144
144
|
"supertest": "7.0.0",
|
|
145
145
|
"ts-node": "10.9.2",
|