@server/next 0.27.9 → 0.27.11
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/index.js +6 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -668,7 +668,7 @@ function config(options = {}) {
|
|
|
668
668
|
// src/helpers/cors.ts
|
|
669
669
|
var localhost = /^https?:\/\/localhost(:\d+)?$/;
|
|
670
670
|
function cors(config2, origin = "") {
|
|
671
|
-
origin = origin
|
|
671
|
+
origin = origin?.toLowerCase();
|
|
672
672
|
if (config2 === true) return origin || null;
|
|
673
673
|
if (config2 === "*") return "*";
|
|
674
674
|
if (!origin) return null;
|
|
@@ -693,6 +693,9 @@ parse.month = parse.b = parse.y / 12;
|
|
|
693
693
|
function parse(str) {
|
|
694
694
|
if (str === null || str === void 0) return null;
|
|
695
695
|
if (typeof str === "number") return str;
|
|
696
|
+
if (typeof str !== "string") {
|
|
697
|
+
throw new Error(`Not a string: ${str} (${typeof str})`);
|
|
698
|
+
}
|
|
696
699
|
str = str.toLowerCase().replace(/[,_]/g, "");
|
|
697
700
|
const [_, value, units] = times.exec(str) || [];
|
|
698
701
|
if (!units) return null;
|
|
@@ -1308,13 +1311,10 @@ async function verify(password, hash3) {
|
|
|
1308
1311
|
// src/auth/findSessionId.ts
|
|
1309
1312
|
var validateToken = (authorization) => {
|
|
1310
1313
|
const [type2, id] = authorization.trim().split(" ");
|
|
1311
|
-
if (!type2 ||
|
|
1312
|
-
throw ServerError_default.AUTH_INVALID_HEADER({ type: type2 });
|
|
1313
|
-
}
|
|
1314
|
-
if (type2.toLowerCase() !== "bearer") {
|
|
1314
|
+
if (!type2 || type2.toLowerCase() !== "bearer") {
|
|
1315
1315
|
throw ServerError_default.AUTH_INVALID_HEADER({ type: type2 });
|
|
1316
1316
|
}
|
|
1317
|
-
if (id.length !== 16) {
|
|
1317
|
+
if (!id || id.length !== 16) {
|
|
1318
1318
|
throw ServerError_default.AUTH_INVALID_TOKEN();
|
|
1319
1319
|
}
|
|
1320
1320
|
return id;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@server/next",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.11",
|
|
4
4
|
"description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
|
|
5
5
|
"homepage": "https://server-js.com/",
|
|
6
6
|
"repository": "https://github.com/franciscop/server-next.git",
|