@remnawave/backend-contract 2.2.23 → 2.2.25

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.
@@ -1001,7 +1001,7 @@ export declare const ERRORS: {
1001
1001
  };
1002
1002
  readonly PASSKEYS_NOT_ENABLED: {
1003
1003
  readonly code: "A195";
1004
- readonly message: "Passkeys not enabled";
1004
+ readonly message: "Passkeys not enabled. Please enable it first.";
1005
1005
  readonly httpCode: 400;
1006
1006
  };
1007
1007
  readonly GENERATE_PASSKEY_REGISTRATION_OPTIONS: {
@@ -972,7 +972,7 @@ exports.ERRORS = {
972
972
  },
973
973
  PASSKEYS_NOT_ENABLED: {
974
974
  code: 'A195',
975
- message: 'Passkeys not enabled',
975
+ message: 'Passkeys not enabled. Please enable it first.',
976
976
  httpCode: 400,
977
977
  },
978
978
  GENERATE_PASSKEY_REGISTRATION_OPTIONS: {
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2-settings.schema.d.ts","sourceRoot":"","sources":["../../../../models/remnawave-settings/oauth2-settings.schema.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6B/B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"oauth2-settings.schema.d.ts","sourceRoot":"","sources":["../../../../models/remnawave-settings/oauth2-settings.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmC/B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Oauth2SettingsSchema = void 0;
7
- const isFQDN_1 = __importDefault(require("validator/lib/isFQDN"));
8
7
  const zod_1 = __importDefault(require("zod"));
9
8
  exports.Oauth2SettingsSchema = zod_1.default.object({
10
9
  github: zod_1.default.object({
@@ -17,10 +16,15 @@ exports.Oauth2SettingsSchema = zod_1.default.object({
17
16
  enabled: zod_1.default.boolean(),
18
17
  clientId: zod_1.default.nullable(zod_1.default.string()),
19
18
  clientSecret: zod_1.default.nullable(zod_1.default.string()),
20
- plainDomain: zod_1.default.nullable(zod_1.default.string().refine((val) => val === 'localhost' ||
21
- (0, isFQDN_1.default)(val, {
22
- require_tld: true,
23
- }), 'Must be a valid fully qualified domain name (FQDN), e.g. "remna.st"')),
19
+ plainDomain: zod_1.default.nullable(zod_1.default.string().refine((val) => {
20
+ const fqdnRegex = /(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)/;
21
+ if (fqdnRegex.test(val)) {
22
+ return true;
23
+ }
24
+ return false;
25
+ }, {
26
+ message: 'Must be a valid fully qualified domain name (FQDN), e.g. "remna.st"',
27
+ })),
24
28
  allowedEmails: zod_1.default.array(zod_1.default.string()),
25
29
  }),
26
30
  yandex: zod_1.default.object({
@@ -1 +1 @@
1
- {"version":3,"file":"passkey-settings.schema.d.ts","sourceRoot":"","sources":["../../../../models/remnawave-settings/passkey-settings.schema.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EA2BhC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"passkey-settings.schema.d.ts","sourceRoot":"","sources":["../../../../models/remnawave-settings/passkey-settings.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAwChC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -4,22 +4,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PasskeySettingsSchema = void 0;
7
- const isFQDN_1 = __importDefault(require("validator/lib/isFQDN"));
8
- const isURL_1 = __importDefault(require("validator/lib/isURL"));
9
7
  const zod_1 = __importDefault(require("zod"));
10
8
  exports.PasskeySettingsSchema = zod_1.default.object({
11
9
  enabled: zod_1.default.boolean(),
12
- rpId: zod_1.default.nullable(zod_1.default.string().refine((val) => val === 'localhost' ||
13
- (0, isFQDN_1.default)(val, {
14
- require_tld: true,
15
- }), 'Must be a valid fully qualified domain name (FQDN), e.g. "remna.st"')),
16
- origin: zod_1.default.nullable(zod_1.default.string().refine((val) => /^http[s]?:\/\/localhost:\d+$/.test(val) ||
17
- (0, isURL_1.default)(val, {
18
- protocols: ['http', 'https'],
19
- require_protocol: true,
20
- require_valid_protocol: true,
21
- allow_fragments: false,
22
- allow_query_components: false,
23
- allow_trailing_dot: false,
24
- }), 'Must be a valid URL, e.g. "https://remna.st"')),
10
+ rpId: zod_1.default.nullable(zod_1.default.string().refine((val) => {
11
+ if (val === 'localhost') {
12
+ return true;
13
+ }
14
+ const fqdnRegex = /(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)/;
15
+ if (fqdnRegex.test(val)) {
16
+ return true;
17
+ }
18
+ return false;
19
+ }, {
20
+ message: 'Must be a valid fully qualified domain name (FQDN), e.g. "remna.st"',
21
+ })),
22
+ origin: zod_1.default.nullable(zod_1.default.string().refine((value) => {
23
+ if (/^http:\/\/localhost:\d+$/.test(value)) {
24
+ return true;
25
+ }
26
+ if (/^https:\/\/(?=.*\.[a-z]{2,})[^\s\/?#]+$/i.test(value)) {
27
+ return true;
28
+ }
29
+ return false;
30
+ }, {
31
+ message: 'Must be a valid URL, e.g. "https://remna.st"',
32
+ })),
25
33
  });
@@ -972,7 +972,7 @@ exports.ERRORS = {
972
972
  },
973
973
  PASSKEYS_NOT_ENABLED: {
974
974
  code: 'A195',
975
- message: 'Passkeys not enabled',
975
+ message: 'Passkeys not enabled. Please enable it first.',
976
976
  httpCode: 400,
977
977
  },
978
978
  GENERATE_PASSKEY_REGISTRATION_OPTIONS: {
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Oauth2SettingsSchema = void 0;
7
- const isFQDN_1 = __importDefault(require("validator/lib/isFQDN"));
8
7
  const zod_1 = __importDefault(require("zod"));
9
8
  exports.Oauth2SettingsSchema = zod_1.default.object({
10
9
  github: zod_1.default.object({
@@ -17,10 +16,15 @@ exports.Oauth2SettingsSchema = zod_1.default.object({
17
16
  enabled: zod_1.default.boolean(),
18
17
  clientId: zod_1.default.nullable(zod_1.default.string()),
19
18
  clientSecret: zod_1.default.nullable(zod_1.default.string()),
20
- plainDomain: zod_1.default.nullable(zod_1.default.string().refine((val) => val === 'localhost' ||
21
- (0, isFQDN_1.default)(val, {
22
- require_tld: true,
23
- }), 'Must be a valid fully qualified domain name (FQDN), e.g. "remna.st"')),
19
+ plainDomain: zod_1.default.nullable(zod_1.default.string().refine((val) => {
20
+ const fqdnRegex = /(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)/;
21
+ if (fqdnRegex.test(val)) {
22
+ return true;
23
+ }
24
+ return false;
25
+ }, {
26
+ message: 'Must be a valid fully qualified domain name (FQDN), e.g. "remna.st"',
27
+ })),
24
28
  allowedEmails: zod_1.default.array(zod_1.default.string()),
25
29
  }),
26
30
  yandex: zod_1.default.object({
@@ -4,22 +4,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PasskeySettingsSchema = void 0;
7
- const isFQDN_1 = __importDefault(require("validator/lib/isFQDN"));
8
- const isURL_1 = __importDefault(require("validator/lib/isURL"));
9
7
  const zod_1 = __importDefault(require("zod"));
10
8
  exports.PasskeySettingsSchema = zod_1.default.object({
11
9
  enabled: zod_1.default.boolean(),
12
- rpId: zod_1.default.nullable(zod_1.default.string().refine((val) => val === 'localhost' ||
13
- (0, isFQDN_1.default)(val, {
14
- require_tld: true,
15
- }), 'Must be a valid fully qualified domain name (FQDN), e.g. "remna.st"')),
16
- origin: zod_1.default.nullable(zod_1.default.string().refine((val) => /^http[s]?:\/\/localhost:\d+$/.test(val) ||
17
- (0, isURL_1.default)(val, {
18
- protocols: ['http', 'https'],
19
- require_protocol: true,
20
- require_valid_protocol: true,
21
- allow_fragments: false,
22
- allow_query_components: false,
23
- allow_trailing_dot: false,
24
- }), 'Must be a valid URL, e.g. "https://remna.st"')),
10
+ rpId: zod_1.default.nullable(zod_1.default.string().refine((val) => {
11
+ if (val === 'localhost') {
12
+ return true;
13
+ }
14
+ const fqdnRegex = /(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)/;
15
+ if (fqdnRegex.test(val)) {
16
+ return true;
17
+ }
18
+ return false;
19
+ }, {
20
+ message: 'Must be a valid fully qualified domain name (FQDN), e.g. "remna.st"',
21
+ })),
22
+ origin: zod_1.default.nullable(zod_1.default.string().refine((value) => {
23
+ if (/^http:\/\/localhost:\d+$/.test(value)) {
24
+ return true;
25
+ }
26
+ if (/^https:\/\/(?=.*\.[a-z]{2,})[^\s\/?#]+$/i.test(value)) {
27
+ return true;
28
+ }
29
+ return false;
30
+ }, {
31
+ message: 'Must be a valid URL, e.g. "https://remna.st"',
32
+ })),
25
33
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "2.2.23",
3
+ "version": "2.2.25",
4
4
  "public": true,
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "A contract library for Remnawave Backend. It can be used in backend and frontend.",
@@ -29,9 +29,5 @@
29
29
  "keywords": [],
30
30
  "dependencies": {
31
31
  "zod": "^3.25.76"
32
- },
33
- "devDependencies": {
34
- "validator": "13.15.15",
35
- "@types/validator": "13.15.3"
36
32
  }
37
33
  }