@social-mail/social-mail-web-server 1.7.263 → 1.7.264

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.7.263",
3
+ "version": "1.7.264",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -18,6 +18,8 @@ export default class PgEvents {
18
18
  private added: string[] = [];
19
19
  private removed: string[] = [];
20
20
 
21
+ private ac: AbortController;
22
+
21
23
  private get client() {
22
24
  return this._client ??= (async () => {
23
25
  try {
@@ -119,12 +121,14 @@ export default class PgEvents {
119
121
  }
120
122
 
121
123
  private update() {
124
+ this.ac?.abort();
122
125
  return this._running ??= (async () => {
123
126
  while(this.handlers.size) {
124
127
  try {
125
128
  const c = await this.client;
126
129
  if (!c) {
127
- await sleep(3000);
130
+ const a = this.ac = new AbortController();
131
+ await sleep(3000, a.signal);
128
132
  continue;
129
133
  }
130
134
  if (this.added.length) {
@@ -145,7 +149,8 @@ export default class PgEvents {
145
149
  } catch (error) {
146
150
  console.error(error);
147
151
  }
148
- await sleep(30000);
152
+ const a1 = this.ac = new AbortController();
153
+ await sleep(30000, a1.signal);
149
154
  }
150
155
  this._running = null;
151
156
  })();
@@ -10,6 +10,7 @@ import { spawnPromise } from "../../../common/spawnPromise.js";
10
10
  import { join } from "node:path";
11
11
  import { mkdir, rm } from "node:fs/promises";
12
12
  import { globalEnv } from "../../../common/globalEnv.js";
13
+ import { isTestMode } from "../../../globalServices.js";
13
14
 
14
15
  const rootCertDir = "/cache/root-certs";
15
16
  const rootCertPath = rootCertDir + "/all.pem";
@@ -28,6 +29,9 @@ export default class RootCertificates {
28
29
  if (!globalEnv.ssl.downloadCerts) {
29
30
  return;
30
31
  }
32
+ if (isTestMode) {
33
+ return;
34
+ }
31
35
  this.store.install().catch(console.error);
32
36
  }
33
37
 
@@ -31,6 +31,8 @@ export default class DomainReputationService
31
31
 
32
32
  const { failed } = reputation;
33
33
 
34
+ // console.log({ failed });
35
+
34
36
  if (failed > 3) {
35
37
  if (failed > (reputation.received / 10)) {
36
38
  throw new SmtpError("Sender Blocked for 24 Hours", SmtpStatusCodes.SenderBlocked);
@@ -39,6 +41,8 @@ export default class DomainReputationService
39
41
  }
40
42
 
41
43
  postInit() {
42
- this.ms.reputationCleared.on(() => this.cache?.clear("checkReputation"));
44
+ this.ms.reputationCleared.on(() => {
45
+ this.cache?.clear("checkReputation");
46
+ });
43
47
  }
44
48
  }
@@ -227,9 +227,9 @@ export default class MailReceiverService {
227
227
  }));
228
228
 
229
229
  if (activity === "rcpt-not-found") {
230
- if (d?.failed > 3) {
231
- if (d.failed > (d.received / 10)) {
232
- // clear on reputation change
230
+ const { failed, received } = d ?? {};
231
+ if (failed > 3) {
232
+ if (failed > (received / 10)) {
233
233
  this.ms.reputationCleared.notify("");
234
234
  }
235
235
  }
@@ -1,6 +0,0 @@
1
- export default class DomainReputation {
2
- name: string;
3
- received: number;
4
- failed: number;
5
- }
6
- //# sourceMappingURL=DomainReputation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomainReputation.d.ts","sourceRoot":"","sources":["../../../../src/server/model/entities/DomainReputation.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAG1B,IAAI,EAAE,MAAM,CAAC;IAGb,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,MAAM,CAAC;CACzB"}
@@ -1,30 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import Column from "@entity-access/entity-access/dist/decorators/Column.js";
11
- import Table from "@entity-access/entity-access/dist/decorators/Table.js";
12
- let DomainReputation = class DomainReputation {
13
- };
14
- __decorate([
15
- Column({ dataType: "Char", length: 400, key: true }),
16
- __metadata("design:type", String)
17
- ], DomainReputation.prototype, "name", void 0);
18
- __decorate([
19
- Column({ dataType: "Int", default: () => 0 }),
20
- __metadata("design:type", Number)
21
- ], DomainReputation.prototype, "received", void 0);
22
- __decorate([
23
- Column({ dataType: "Int", default: () => 0 }),
24
- __metadata("design:type", Number)
25
- ], DomainReputation.prototype, "failed", void 0);
26
- DomainReputation = __decorate([
27
- Table("DomainReputations")
28
- ], DomainReputation);
29
- export default DomainReputation;
30
- //# sourceMappingURL=DomainReputation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomainReputation.js","sourceRoot":"","sources":["../../../../src/server/model/entities/DomainReputation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,wDAAwD,CAAC;AAC5E,OAAO,KAAK,MAAM,uDAAuD,CAAC;AAG3D,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAUpC,CAAA;AAPU;IADN,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;;8CACjC;AAGb;IADN,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAC,CAAC;;kDACrB;AAGjB;IADN,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAC,CAAC;;gDACvB;AATL,gBAAgB;IADpC,KAAK,CAAC,mBAAmB,CAAC;GACN,gBAAgB,CAUpC;eAVoB,gBAAgB"}
@@ -1,15 +0,0 @@
1
- import Column from "@entity-access/entity-access/dist/decorators/Column.js";
2
- import Table from "@entity-access/entity-access/dist/decorators/Table.js";
3
-
4
- @Table("DomainReputations")
5
- export default class DomainReputation {
6
-
7
- @Column({ dataType: "Char", length: 400, key: true })
8
- public name: string;
9
-
10
- @Column({ dataType: "Int", default: () => 0})
11
- public received: number;
12
-
13
- @Column({ dataType: "Int", default: () => 0})
14
- public failed: number;
15
- }