@timshel_npm/maildev 3.1.2 → 3.1.3

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/README.md CHANGED
@@ -143,6 +143,7 @@ Usage: maildev [options]
143
143
  | `--web-ip <ip address>` | `MAILDEV_WEB_IP` | IP Address to bind HTTP service to, defaults to --ip |
144
144
  | `--web-user <user>` | `MAILDEV_WEB_USER` | HTTP user for GUI |
145
145
  | `--web-pass <password>` | `MAILDEV_WEB_PASS` | HTTP password for GUI |
146
+ | `--web-domain <domain>` | `MAILDEV_WEB_DOMAIN` | External domain name (used for socket CORS, "*" otherwise) |
146
147
  | `--base-pathname <path>` | `MAILDEV_BASE_PATHNAME` | Base path for URLs |
147
148
  | `--disable-web` | `MAILDEV_DISABLE_WEB` | Disable the use of the web interface. Useful for unit testing |
148
149
  | `--hide-extensions <extensions>` | `MAILDEV_HIDE_EXTENSIONS` | Comma separated list of SMTP extensions to NOT advertise (SMTPUTF8, PIPELINING, 8BITMIME) |
@@ -58,6 +58,7 @@ const options = [
58
58
  ],
59
59
  ["--web-user <user>", "MAILDEV_WEB_USER", "HTTP user for GUI"],
60
60
  ["--web-pass <password>", "MAILDEV_WEB_PASS", "HTTP password for GUI"],
61
+ ["--web-domain <path>", "MAILDEV_WEB_DOMAIN", "External domain name (used for socket CORS, \"*\" otherwise)"],
61
62
  ["--base-pathname <path>", "MAILDEV_BASE_PATHNAME", "Base path for URLs"],
62
63
  ["--https", "MAILDEV_HTTPS", "Switch from http to https protocol", false],
63
64
  ["--https-key <file>", "MAILDEV_HTTPS_KEY", "The file path to the ssl private key"],
@@ -100,6 +101,7 @@ function cliOptions() {
100
101
  disabled: false,
101
102
  port: config === null || config === void 0 ? void 0 : config.web,
102
103
  host: config === null || config === void 0 ? void 0 : config.webIp,
104
+ domain: config === null || config === void 0 ? void 0 : config.webDomain,
103
105
  basePathname: config === null || config === void 0 ? void 0 : config.basePathname,
104
106
  auth: (config === null || config === void 0 ? void 0 : config.webUser) && (config === null || config === void 0 ? void 0 : config.webPass)
105
107
  ? { user: config === null || config === void 0 ? void 0 : config.webUser, pass: config === null || config === void 0 ? void 0 : config.webPass }
package/dist/lib/web.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface WebOptions {
6
6
  port?: number;
7
7
  host?: string;
8
8
  basePathname?: string;
9
+ domain?: string;
9
10
  auth?: {
10
11
  user: string;
11
12
  pass: string;
package/dist/lib/web.js CHANGED
@@ -13,7 +13,7 @@ const logger = require("./logger");
13
13
  const path = require("path");
14
14
  class Web {
15
15
  constructor(mailserver, options) {
16
- var _a, _b, _c, _d, _e;
16
+ var _a, _b, _c, _d, _e, _f;
17
17
  /**
18
18
  * Keep record of all connections to close them on shutdown
19
19
  */
@@ -32,7 +32,13 @@ class Web {
32
32
  if (options === null || options === void 0 ? void 0 : options.auth) {
33
33
  app.use(auth((_d = options === null || options === void 0 ? void 0 : options.auth) === null || _d === void 0 ? void 0 : _d.user, (_e = options === null || options === void 0 ? void 0 : options.auth) === null || _e === void 0 ? void 0 : _e.pass));
34
34
  }
35
- this.io = socketio({ path: path.posix.join(this.basePathname, "/socket.io") });
35
+ this.io = socketio({
36
+ path: path.posix.join(this.basePathname, '/socket.io'),
37
+ cors: {
38
+ origin: (_f = options === null || options === void 0 ? void 0 : options.domain) !== null && _f !== void 0 ? _f : '*',
39
+ methods: ["GET", "POST"]
40
+ }
41
+ });
36
42
  app.use(this.basePathname, express.static(path.join(__dirname, "../app")));
37
43
  app.use(cors());
38
44
  (0, routes_1.routes)(app, mailserver, this.basePathname);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@timshel_npm/maildev",
3
3
  "description": "SMTP Server and Web Interface for reading and testing emails during development",
4
- "version": "3.1.2",
4
+ "version": "3.1.3",
5
5
  "keywords": [
6
6
  "email",
7
7
  "e-mail",
@@ -33,7 +33,7 @@
33
33
  "test:debug": "npm run build && nyc _mocha --exit --timeout 5000",
34
34
  "lint": "prettier . -c",
35
35
  "lint:fix": "prettier . -w",
36
- "dev": "node ./scripts/dev.js && npm run css-watch",
36
+ "dev": "npm run build && node ./scripts/dev.js && npm run css-watch",
37
37
  "css": "sass --style=compressed --no-source-map src/app/styles/style.scss:dist/app/styles/style.css",
38
38
  "css-watch": "sass --watch --style=compressed --no-source-map src/app/styles/style.scss:dist/app/styles/style.css",
39
39
  "docker-build": "./src/scripts/dockerBuild.sh",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/express": "^4.17.23",
77
- "@types/node": "^18.19.111",
77
+ "@types/node": "^18.19.112",
78
78
  "expect": "^29.7.0",
79
79
  "http-proxy-middleware": "^3.0.5",
80
80
  "jest": "^29.7.0",
@@ -82,7 +82,7 @@
82
82
  "mocha": "^10.8.2",
83
83
  "nodemon": "^3.1.10",
84
84
  "nyc": "^17.1.0",
85
- "prettier": "^3.5.3",
85
+ "prettier": "^3.6.2",
86
86
  "sass": "^1.89.2",
87
87
  "ts-node": "^10.9.2",
88
88
  "ts-node-dev": "^2.0.0",