miqro 7.3.2 → 7.3.4
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/build/esm/editor/auth.js +6 -4
- package/build/esm/src/cluster.js +0 -0
- package/build/esm/src/common/esbuild.js +1 -0
- package/build/esm/src/common/exit.js +23 -5
- package/build/esm/src/main.js +0 -0
- package/build/esm/src/services/app.d.ts +1 -0
- package/build/esm/src/services/app.js +6 -1
- package/build/lib.cjs +417 -1638
- package/editor/auth.ts +6 -5
- package/package.json +4 -4
package/build/esm/editor/auth.js
CHANGED
|
@@ -18,13 +18,15 @@ export default {
|
|
|
18
18
|
const cookieToken = args.req.cookies[ADMIN_EDITOR_AUTH_COOKIE];
|
|
19
19
|
//console.log("\n\nqueryToken[%s] cookieToken[%s] KEY[%s]\n\n", queryToken, cookieToken, KEY);
|
|
20
20
|
if (queryToken) {
|
|
21
|
-
|
|
21
|
+
const queryBuf = Buffer.from(String(queryToken));
|
|
22
|
+
const keyBuf = Buffer.from(KEY);
|
|
23
|
+
if (typeof queryToken === "string" && queryBuf.length === keyBuf.length && timingSafeEqual(queryBuf, keyBuf)) {
|
|
22
24
|
args.res.setCookie(ADMIN_EDITOR_AUTH_COOKIE, KEY, {
|
|
23
|
-
expires: new Date(Date.now() + 1000 * 60 * 60 * 24
|
|
25
|
+
expires: new Date(Date.now() + 1000 * 60 * 60 * 24),
|
|
24
26
|
httpOnly: true,
|
|
25
|
-
//secure:
|
|
27
|
+
//secure: args.req.secure,
|
|
28
|
+
sameSite: "strict",
|
|
26
29
|
path: "/",
|
|
27
|
-
//sameSite: "strict"
|
|
28
30
|
});
|
|
29
31
|
args.req.searchParams.delete(ADMIN_EDITOR_AUTH_QUERY);
|
|
30
32
|
const queryString = args.req.searchParams.toString();
|
package/build/esm/src/cluster.js
CHANGED
|
File without changes
|
|
@@ -47,7 +47,7 @@ export function setupExitHandlers(app) {
|
|
|
47
47
|
}
|
|
48
48
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
49
49
|
});
|
|
50
|
-
process.on('exit',
|
|
50
|
+
process.on('exit', function (code) {
|
|
51
51
|
if (exceptionOccured) {
|
|
52
52
|
app.logger?.error('Exception occured');
|
|
53
53
|
}
|
|
@@ -60,7 +60,7 @@ export function setupExitHandlers(app) {
|
|
|
60
60
|
}*/
|
|
61
61
|
cleanJSX(app);
|
|
62
62
|
if (app.server) {
|
|
63
|
-
|
|
63
|
+
app.stop();
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -80,20 +80,38 @@ export function setupExitHandlers(app) {
|
|
|
80
80
|
}
|
|
81
81
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
82
82
|
});
|
|
83
|
-
process.on("SIGTERM", function () {
|
|
83
|
+
process.on("SIGTERM", async function () {
|
|
84
84
|
app.logger?.info('SIGTERM received');
|
|
85
|
+
if (app.server) {
|
|
86
|
+
await Promise.race([
|
|
87
|
+
app.stop(),
|
|
88
|
+
new Promise(r => setTimeout(r, 5000))
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
85
91
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
86
92
|
});
|
|
87
|
-
process.on('SIGHUP', function () {
|
|
93
|
+
process.on('SIGHUP', async function () {
|
|
88
94
|
app.logger?.info('SIGHUP received');
|
|
95
|
+
if (app.server) {
|
|
96
|
+
await Promise.race([
|
|
97
|
+
app.stop(),
|
|
98
|
+
new Promise(r => setTimeout(r, 5000))
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
89
101
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
90
102
|
});
|
|
91
103
|
/*process.on('SIGKILL', function () {
|
|
92
104
|
server.logger.info('SIGKILL received');
|
|
93
105
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
94
106
|
});*/
|
|
95
|
-
process.on('SIGINT', function () {
|
|
107
|
+
process.on('SIGINT', async function () {
|
|
96
108
|
app.logger?.info('SIGINT received');
|
|
109
|
+
if (app.server) {
|
|
110
|
+
await Promise.race([
|
|
111
|
+
app.stop(),
|
|
112
|
+
new Promise(r => setTimeout(r, 5000))
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
97
115
|
process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
|
|
98
116
|
});
|
|
99
117
|
}
|
package/build/esm/src/main.js
CHANGED
|
File without changes
|
|
@@ -383,7 +383,12 @@ export class Miqro {
|
|
|
383
383
|
if (this.options?.httpRedirect) {
|
|
384
384
|
this.httpsRedirectServer = new App();
|
|
385
385
|
this.httpsRedirectServer.use(async (req, res) => {
|
|
386
|
-
const hostname = req.headers.host
|
|
386
|
+
const hostname = req.headers.host?.split(":")[0] ?? "";
|
|
387
|
+
const allowed = this.options?.allowedRedirectHosts;
|
|
388
|
+
if (allowed && !allowed.includes(hostname)) {
|
|
389
|
+
res.writeHead(400).end("Invalid Host header");
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
387
392
|
return await res.redirect('https://' + hostname + ":" + this.options.port + req.url);
|
|
388
393
|
});
|
|
389
394
|
}
|