@bool-ts/core 1.0.7 → 1.0.8
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/dist/hooks/factory.js +7 -5
- package/package.json +1 -1
- package/src/hooks/factory.ts +7 -5
package/dist/hooks/factory.js
CHANGED
|
@@ -119,11 +119,13 @@ export const BoolFactory = (target) => {
|
|
|
119
119
|
console.info(`PID: ${convertedPID} - Method: ${convertedMethod} - IP: ${convertedReqIp} - ${req.originalUrl.blue} - Time: ${convertedTime}`);
|
|
120
120
|
}));
|
|
121
121
|
app.use((req, res, next) => {
|
|
122
|
-
if (!allowOrigins.includes(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
if (!allowOrigins.includes("*")) {
|
|
123
|
+
if (!allowOrigins.includes(req.headers.origin || "*")) {
|
|
124
|
+
return res.status(403).json({
|
|
125
|
+
["httpCode"]: 403,
|
|
126
|
+
["data"]: "Invalid origin."
|
|
127
|
+
});
|
|
128
|
+
}
|
|
127
129
|
}
|
|
128
130
|
res.header("Access-Control-Allow-Origin", req.headers.origin || "*");
|
|
129
131
|
res.header("Access-Control-Allow-Headers", "*");
|
package/package.json
CHANGED
package/src/hooks/factory.ts
CHANGED
|
@@ -149,11 +149,13 @@ export const BoolFactory = (
|
|
|
149
149
|
);
|
|
150
150
|
|
|
151
151
|
app.use((req: Request, res: Response, next: NextFunction) => {
|
|
152
|
-
if (!allowOrigins.includes(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
if (!allowOrigins.includes("*")) {
|
|
153
|
+
if (!allowOrigins.includes(req.headers.origin || "*")) {
|
|
154
|
+
return res.status(403).json({
|
|
155
|
+
["httpCode"]: 403,
|
|
156
|
+
["data"]: "Invalid origin."
|
|
157
|
+
});
|
|
158
|
+
}
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
res.header("Access-Control-Allow-Origin", req.headers.origin || "*");
|