badmfck-api-server 1.5.6 → 1.5.7

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.
@@ -1,6 +1,5 @@
1
1
  import { BaseEndpoint } from "../BaseEndpoint";
2
2
  import { HTTPRequestVO, TransferPacketVO } from "../structures/Interfaces";
3
- export declare const indexFilePath: string;
4
3
  interface IStatObject {
5
4
  requests: Map<string, number>;
6
5
  errors: Map<string, number>;
@@ -3,13 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Monitor = exports.indexFilePath = void 0;
6
+ exports.Monitor = void 0;
7
7
  const APIService_1 = require("../APIService");
8
8
  const BaseEndpoint_1 = require("../BaseEndpoint");
9
9
  const LogService_1 = require("../LogService");
10
10
  const crypto_1 = __importDefault(require("crypto"));
11
- const path_1 = __importDefault(require("path"));
12
- exports.indexFilePath = path_1.default.resolve(__dirname, "index.html");
13
11
  class Monitor extends BaseEndpoint_1.BaseEndpoint {
14
12
  ignoreHttpLogging = true;
15
13
  startedAt = new Date();
@@ -90,11 +88,11 @@ class Monitor extends BaseEndpoint_1.BaseEndpoint {
90
88
  if (!req.headers['authorization'])
91
89
  return { error: { code: 10002, message: "No authorization found", httpStatus: 400 } };
92
90
  const auth = req.headers['authorization'];
93
- if (!Array.isArray(req.precheck)) {
91
+ if (!req.precheck || !Array.isArray(req.precheck.data)) {
94
92
  return { error: { code: 10003, message: "No authorization records found", httpStatus: 400 } };
95
93
  }
96
94
  let authorized = false;
97
- for (let i of req.precheck) {
95
+ for (let i of req.precheck.data) {
98
96
  let expectationStr = "";
99
97
  expectationStr += JSON.stringify(i);
100
98
  expectationStr += JSON.stringify(req.method);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",