@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.
@@ -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(req.headers.origin || "*")) {
123
- return res.status(403).json({
124
- ["httpCode"]: 403,
125
- ["data"]: "Invalid origin."
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bool-ts/core",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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(req.headers.origin || "*")) {
153
- return res.status(403).json({
154
- ["httpCode"]: 403,
155
- ["data"]: "Invalid origin."
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 || "*");