badmfck-api-server 2.8.7 → 2.8.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.
@@ -89,7 +89,7 @@ async function Initializer(services) {
89
89
  exports.Initializer = Initializer;
90
90
  class APIService extends BaseService_1.BaseService {
91
91
  static nextLogID = 0;
92
- version = "2.8.7";
92
+ version = "2.8.8";
93
93
  options;
94
94
  monitor = null;
95
95
  monitorIndexFile;
@@ -108,6 +108,7 @@ class APIService extends BaseService_1.BaseService {
108
108
  if (this.options.monitor && this.options.monitor.length > 0) {
109
109
  exports.REQ_MONITOR_USERS.listener = async () => this.options.monitor ?? [];
110
110
  this.monitor = new MonitorService_1.MonitorService();
111
+ this.monitor.init();
111
112
  this.options.endpoints.push(new Monitor_1.Monitor());
112
113
  }
113
114
  this.options.endpoints.push(new ExternalServiceEndpoint_1.ExternalServiceEndpoint());
@@ -238,7 +239,7 @@ class APIService extends BaseService_1.BaseService {
238
239
  files: req.files ?? null,
239
240
  referer: req.get("Referer"),
240
241
  };
241
- if (this.options.preproducer) {
242
+ if (this.options.preproducer && ep !== "--sys-monitor") {
242
243
  try {
243
244
  const preproducerResult = await this.options.preproducer(httpRequest);
244
245
  if (preproducerResult)
@@ -19,6 +19,7 @@ export declare const REQ_EP_STAT: Req<IEPStatReqFilter, IEPStatResult>;
19
19
  export declare class MonitorService extends BaseService {
20
20
  endpoints: Map<number, Map<string, IEPStat>>;
21
21
  constructor();
22
+ init(): Promise<void>;
22
23
  getEPStat(req: IEPStatReqFilter): Promise<IEPStatResult>;
23
24
  onStatRegistrate(data: TransferPacketVO): void;
24
25
  pad(num: number): string;
@@ -33,9 +33,12 @@ class MonitorService extends BaseService_1.BaseService {
33
33
  endpoints = new Map();
34
34
  constructor() {
35
35
  super("MonitorService");
36
- exports.S_STAT_REGISTRATE_REQUEST.subscribe(this.onStatRegistrate);
36
+ exports.S_STAT_REGISTRATE_REQUEST.subscribe(req => this.onStatRegistrate(req));
37
37
  exports.REQ_EP_STAT.listener = async (req) => this.getEPStat(req);
38
38
  }
39
+ async init() {
40
+ super.init();
41
+ }
39
42
  async getEPStat(req) {
40
43
  const result = new Map();
41
44
  if (req.range === "hour") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "2.8.7",
3
+ "version": "2.8.8",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",