bdy 1.8.20-dev → 1.8.21-dev

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,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.8.20-dev",
4
+ "version": "1.8.21-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -31,6 +31,7 @@
31
31
  "jsonwebtoken": "9.0.2",
32
32
  "mime-db": "1.52.0",
33
33
  "mime-types": "2.1.35",
34
+ "punycode": "2.3.1",
34
35
  "netmask": "2.0.2",
35
36
  "node-fetch": "3.3.2",
36
37
  "node-forge": "1.3.1",
@@ -38,11 +38,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const output_js_1 = __importDefault(require("./output.js"));
40
40
  const netmask_1 = __importDefault(require("netmask"));
41
+ const punycode_1 = __importDefault(require("punycode/"));
41
42
  const fs_1 = __importStar(require("fs"));
42
43
  const tls_1 = __importDefault(require("tls"));
43
44
  const crypto_1 = __importDefault(require("crypto"));
44
45
  const utils_js_1 = require("./utils.js");
45
46
  const texts_js_1 = require("./texts.js");
47
+ const logger_1 = __importDefault(require("./logger"));
46
48
  class Input {
47
49
  static timeout(timeout) {
48
50
  const t = parseInt(timeout, 10);
@@ -90,19 +92,23 @@ class Input {
90
92
  return r;
91
93
  }
92
94
  static subdomain(subdomain) {
93
- if (!/^[a-z0-9-]+$/i.test(subdomain)) {
95
+ const encoded = punycode_1.default.toASCII(subdomain);
96
+ if (!/^[a-z0-9-]+$/i.test(encoded)) {
94
97
  output_js_1.default.exitError((0, texts_js_1.ERR_SUBDOMAIN_IS_NOT_VALID)(subdomain));
95
98
  }
96
99
  if (subdomain.length < 5) {
97
100
  output_js_1.default.exitError((0, texts_js_1.ERR_SUBDOMAIN_IS_TOO_SHORT)(subdomain));
98
101
  }
99
- if (subdomain.length > 63) {
102
+ if (encoded.length > 63) {
100
103
  output_js_1.default.exitError((0, texts_js_1.ERR_SUBDOMAIN_IS_TOO_LONG)(subdomain));
101
104
  }
102
105
  return subdomain;
103
106
  }
104
107
  static domain(domain) {
105
- if (!/^(?:[A-z0-9](?:[A-z0-9-]{0,61}[A-z0-9])?\.)+[A-z0-9][A-z0-9-]{0,61}[A-z0-9]$/i.test(domain)) {
108
+ const encoded = punycode_1.default.toASCII(domain);
109
+ logger_1.default.info(domain);
110
+ logger_1.default.info(encoded);
111
+ if (!/^(?:[A-z0-9](?:[A-z0-9-]{0,61}[A-z0-9])?\.)+[A-z0-9][A-z0-9-]{0,61}[A-z0-9]$/i.test(encoded)) {
106
112
  output_js_1.default.exitError((0, texts_js_1.ERR_DOMAIN_IS_NOT_VALID)(domain));
107
113
  }
108
114
  return domain;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.8.20-dev",
4
+ "version": "1.8.21-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -31,6 +31,7 @@
31
31
  "jsonwebtoken": "9.0.2",
32
32
  "mime-db": "1.52.0",
33
33
  "mime-types": "2.1.35",
34
+ "punycode": "2.3.1",
34
35
  "netmask": "2.0.2",
35
36
  "node-fetch": "3.3.2",
36
37
  "node-forge": "1.3.1",