@timshel_npm/maildev 3.1.1 → 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
@@ -1,4 +1,5 @@
1
1
  # MailDev
2
+ [![npm](https://img.shields.io/npm/v/@timshel_npm/maildev)](https://www.npmjs.com/package/@timshel_npm/maildev)
2
3
  [![Docker Pulls](https://img.shields.io/docker/pulls/timshel/maildev)](https://hub.docker.com/r/timshel/maildev)
3
4
  [![License](https://img.shields.io/npm/l/maildev?color=white)](/LICENSE)
4
5
  [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-black.svg)](https://prettier.io/)
@@ -23,10 +24,15 @@
23
24
 
24
25
  ## Npm / Yarn
25
26
 
26
- It's not published on `npm` but due to [Github](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#git-urls-as-dependencies) support you can use it with:
27
+ Available on `npm` at [@timshel_npm/maildev](https://www.npmjs.com/package/@timshel_npm/maildev).
28
+ Or can be installed using [Github](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#git-urls-as-dependencies).
27
29
 
28
- ```
29
- "maildev": "timshel/maildev#3.1.0"
30
+ Ex:
31
+ ```json
32
+ "devDependencies": {
33
+ "maildev": "github:timshel/maildev#3.1.2",
34
+ "maildev": "npm:@timshel_npm/maildev@^3.1.2"
35
+ }
30
36
  ```
31
37
 
32
38
  ## API
@@ -137,6 +143,7 @@ Usage: maildev [options]
137
143
  | `--web-ip <ip address>` | `MAILDEV_WEB_IP` | IP Address to bind HTTP service to, defaults to --ip |
138
144
  | `--web-user <user>` | `MAILDEV_WEB_USER` | HTTP user for GUI |
139
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) |
140
147
  | `--base-pathname <path>` | `MAILDEV_BASE_PATHNAME` | Base path for URLs |
141
148
  | `--disable-web` | `MAILDEV_DISABLE_WEB` | Disable the use of the web interface. Useful for unit testing |
142
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.1",
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,8 +82,8 @@
82
82
  "mocha": "^10.8.2",
83
83
  "nodemon": "^3.1.10",
84
84
  "nyc": "^17.1.0",
85
- "prettier": "^3.5.3",
86
- "sass": "^1.89.1",
85
+ "prettier": "^3.6.2",
86
+ "sass": "^1.89.2",
87
87
  "ts-node": "^10.9.2",
88
88
  "ts-node-dev": "^2.0.0",
89
89
  "typescript": "^5.8.3"