@remnawave/backend-contract 2.1.75 → 2.1.77
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/build/backend/commands/subscription/get-subscription-by-short-uuid-by-client-type.command.d.ts +2 -3
- package/build/backend/commands/subscription/get-subscription-by-short-uuid-by-client-type.command.d.ts.map +1 -1
- package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts +242 -0
- package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts.map +1 -1
- package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts +440 -0
- package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts.map +1 -1
- package/build/backend/commands/subscription-settings/update-subscription-settings.command.js +2 -1
- package/build/backend/commands/subscription-template/get-template.command.d.ts +14 -14
- package/build/backend/commands/subscription-template/update-template.command.d.ts +14 -14
- package/build/backend/commands/subscriptions/get-by/get-raw-subscription-by-short-uuid.command.d.ts +4 -4
- package/build/backend/constants/response-rules/response-rules.contants.d.ts +38 -6
- package/build/backend/constants/response-rules/response-rules.contants.d.ts.map +1 -1
- package/build/backend/constants/response-rules/response-rules.contants.js +29 -3
- package/build/backend/constants/subscription-template/template-type/request-template-type.constant.d.ts +1 -2
- package/build/backend/constants/subscription-template/template-type/request-template-type.constant.d.ts.map +1 -1
- package/build/backend/constants/subscription-template/template-type/request-template-type.constant.js +0 -1
- package/build/backend/constants/subscription-template/template-type/template-type.constant.d.ts +5 -5
- package/build/backend/constants/subscription-template/template-type/template-type.constant.d.ts.map +1 -1
- package/build/backend/constants/subscription-template/template-type/template-type.constant.js +4 -4
- package/build/backend/models/response-rules/index.d.ts +1 -1
- package/build/backend/models/response-rules/index.d.ts.map +1 -1
- package/build/backend/models/response-rules/index.js +1 -1
- package/build/backend/models/response-rules/response-rule-condition.schema.d.ts +29 -0
- package/build/backend/models/response-rules/response-rule-condition.schema.d.ts.map +1 -0
- package/build/backend/models/response-rules/response-rule-condition.schema.js +29 -0
- package/build/backend/models/response-rules/response-rule.schema.d.ts +53 -12
- package/build/backend/models/response-rules/response-rule.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rule.schema.js +101 -19
- package/build/backend/models/response-rules/response-rules-config.schema.d.ts +73 -16
- package/build/backend/models/response-rules/response-rules-config.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rules-config.schema.js +44 -3
- package/build/backend/models/subscription-settings.schema.d.ts +198 -0
- package/build/backend/models/subscription-settings.schema.d.ts.map +1 -1
- package/build/backend/models/subscription-settings.schema.js +2 -0
- package/build/frontend/commands/subscription-settings/update-subscription-settings.command.js +2 -1
- package/build/frontend/constants/response-rules/response-rules.contants.js +29 -2
- package/build/frontend/constants/subscription-template/template-type/request-template-type.constant.js +0 -1
- package/build/frontend/constants/subscription-template/template-type/template-type.constant.js +4 -4
- package/build/frontend/models/response-rules/index.js +1 -1
- package/build/frontend/models/response-rules/response-rule-condition.schema.js +29 -0
- package/build/frontend/models/response-rules/response-rule.schema.js +101 -19
- package/build/frontend/models/response-rules/response-rules-config.schema.js +44 -3
- package/build/frontend/models/subscription-settings.schema.js +2 -0
- package/package.json +1 -1
- package/build/backend/models/response-rules/response-rules-json-schema.d.ts +0 -7
- package/build/backend/models/response-rules/response-rules-json-schema.d.ts.map +0 -1
- package/build/backend/models/response-rules/response-rules-json-schema.js +0 -11
- package/build/frontend/models/response-rules/response-rules-json-schema.js +0 -11
|
@@ -3,27 +3,109 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ResponseRuleSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const response_rule_condition_schema_1 = require("./response-rule-condition.schema");
|
|
7
|
+
const RuleExampleJson = JSON.stringify({
|
|
8
|
+
name: 'Block Legacy Clients',
|
|
9
|
+
description: 'Block requests from legacy clients',
|
|
10
|
+
enabled: true,
|
|
11
|
+
operator: constants_1.RESPONSE_RULES_OPERATORS.OR,
|
|
12
|
+
conditions: [
|
|
13
|
+
{
|
|
14
|
+
headerName: 'user-agent',
|
|
15
|
+
operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
|
|
16
|
+
value: 'Hiddify',
|
|
17
|
+
caseSensitive: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
headerName: 'user-agent',
|
|
21
|
+
operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
|
|
22
|
+
value: 'FoxRay',
|
|
23
|
+
caseSensitive: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
responseType: constants_1.RESPONSE_RULES_RESPONSE_TYPES.BLOCK,
|
|
27
|
+
}, null, 2);
|
|
28
|
+
exports.ResponseRuleSchema = zod_1.z
|
|
29
|
+
.object({
|
|
30
|
+
name: zod_1.z
|
|
31
|
+
.string()
|
|
32
|
+
.min(1, 'Name is required')
|
|
33
|
+
.max(50, 'Name must be less than 50 characters')
|
|
34
|
+
.describe(JSON.stringify({
|
|
35
|
+
title: 'Name',
|
|
36
|
+
markdownDescription: 'Name of the response rule.',
|
|
37
|
+
})),
|
|
8
38
|
description: zod_1.z
|
|
9
39
|
.string()
|
|
10
40
|
.min(1, 'Description is required')
|
|
11
41
|
.max(250, 'Description must be less than 250 characters')
|
|
12
|
-
.optional()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
42
|
+
.optional()
|
|
43
|
+
.describe(JSON.stringify({
|
|
44
|
+
title: 'Description',
|
|
45
|
+
markdownDescription: 'Description of the response rule. Maximum length is 250 characters.',
|
|
46
|
+
})),
|
|
47
|
+
enabled: zod_1.z.boolean().describe(JSON.stringify({
|
|
48
|
+
markdownDescription: 'Whether the response rule is enabled. If disabled, the rule will not be applied.',
|
|
49
|
+
})),
|
|
50
|
+
operator: zod_1.z.nativeEnum(constants_1.RESPONSE_RULES_OPERATORS).describe(JSON.stringify({
|
|
51
|
+
title: 'Operator',
|
|
52
|
+
markdownDescription: 'Operator to use for combining conditions in the rule.',
|
|
53
|
+
})),
|
|
54
|
+
conditions: zod_1.z.array(response_rule_condition_schema_1.ResponseRuleConditionSchema),
|
|
55
|
+
responseType: zod_1.z.nativeEnum(constants_1.RESPONSE_RULES_RESPONSE_TYPES).describe(JSON.stringify({
|
|
56
|
+
markdownDescription: `Type of the response. Determines the type of **response** to be returned when the rule is matched.\n\n${Object.entries(constants_1.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION)
|
|
57
|
+
.map(([key, description]) => `- **${key}**: ${description}\n`)
|
|
58
|
+
.join('\n')}`,
|
|
27
59
|
})),
|
|
28
|
-
|
|
29
|
-
|
|
60
|
+
responseModifications: zod_1.z.object({
|
|
61
|
+
headers: zod_1.z
|
|
62
|
+
.array(zod_1.z.object({
|
|
63
|
+
key: zod_1.z
|
|
64
|
+
.string()
|
|
65
|
+
.regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
|
|
66
|
+
.describe(JSON.stringify({
|
|
67
|
+
title: 'Key',
|
|
68
|
+
markdownDescription: 'Key of the response header. Must comply with RFC 7230.',
|
|
69
|
+
})),
|
|
70
|
+
value: zod_1.z
|
|
71
|
+
.string()
|
|
72
|
+
.min(1, 'Value is required')
|
|
73
|
+
.describe(JSON.stringify({
|
|
74
|
+
title: 'Value',
|
|
75
|
+
markdownDescription: 'Value of the response header. ',
|
|
76
|
+
})),
|
|
77
|
+
}))
|
|
78
|
+
.optional()
|
|
79
|
+
.describe(JSON.stringify({
|
|
80
|
+
markdownDescription: 'Response headers to be added when the rule is matched.',
|
|
81
|
+
})),
|
|
82
|
+
}),
|
|
83
|
+
})
|
|
84
|
+
.describe(JSON.stringify({
|
|
85
|
+
title: 'Response Rule',
|
|
86
|
+
markdownDescription: `\n\nFields:\n- **name**: Name of the response rule (required)\n- **description**: Description of the response rule (optional)\n- **enabled**: Whether the response rule is enabled. If disabled, the rule will not be applied.\n- **operator**: Operator to combine conditions (AND/OR)\n- **conditions**: Array of conditions to match against HTTP headers\n - **headerName**: Name of the HTTP header to check (case insensitive)\n - **operator**: Comparison operator (CONTAINS, EQUALS, etc)\n - **value**: Value to compare against (case sensitive, max 255 chars)\n- **responseType**: Type of response when rule matches (e.g. BLOCK)\n\nExample:\n\`\`\`json\n${RuleExampleJson}\n\`\`\``,
|
|
87
|
+
examples: [
|
|
88
|
+
{
|
|
89
|
+
name: 'This is example rule name',
|
|
90
|
+
description: 'This is example rule description (optional)',
|
|
91
|
+
enabled: true,
|
|
92
|
+
operator: constants_1.RESPONSE_RULES_OPERATORS.AND,
|
|
93
|
+
conditions: [
|
|
94
|
+
{
|
|
95
|
+
headerName: 'user-agent',
|
|
96
|
+
operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
|
|
97
|
+
value: 'Example Rule Value, replace with your own value',
|
|
98
|
+
caseSensitive: true,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
responseType: constants_1.RESPONSE_RULES_RESPONSE_TYPES.BLOCK,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Empty rule',
|
|
105
|
+
enabled: true,
|
|
106
|
+
operator: constants_1.RESPONSE_RULES_OPERATORS.AND,
|
|
107
|
+
conditions: [],
|
|
108
|
+
responseType: constants_1.RESPONSE_RULES_RESPONSE_TYPES.BLOCK,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
}));
|
|
@@ -6,6 +6,7 @@ export declare const ResponseRulesConfigSchema: z.ZodObject<{
|
|
|
6
6
|
rules: z.ZodArray<z.ZodObject<{
|
|
7
7
|
name: z.ZodString;
|
|
8
8
|
description: z.ZodOptional<z.ZodString>;
|
|
9
|
+
enabled: z.ZodBoolean;
|
|
9
10
|
operator: z.ZodNativeEnum<{
|
|
10
11
|
readonly AND: "AND";
|
|
11
12
|
readonly OR: "OR";
|
|
@@ -25,48 +26,88 @@ export declare const ResponseRulesConfigSchema: z.ZodObject<{
|
|
|
25
26
|
readonly NOT_REGEX: "NOT_REGEX";
|
|
26
27
|
}>;
|
|
27
28
|
value: z.ZodString;
|
|
29
|
+
caseSensitive: z.ZodBoolean;
|
|
28
30
|
}, "strip", z.ZodTypeAny, {
|
|
29
31
|
value: string;
|
|
30
|
-
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
31
32
|
headerName: string;
|
|
33
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
34
|
+
caseSensitive: boolean;
|
|
32
35
|
}, {
|
|
33
36
|
value: string;
|
|
34
|
-
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
35
37
|
headerName: string;
|
|
38
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
39
|
+
caseSensitive: boolean;
|
|
36
40
|
}>, "many">;
|
|
37
41
|
responseType: z.ZodNativeEnum<{
|
|
42
|
+
readonly BROWSER: "BROWSER";
|
|
38
43
|
readonly BLOCK: "BLOCK";
|
|
39
|
-
readonly BASE64: "BASE64";
|
|
40
44
|
readonly STATUS_CODE_404: "STATUS_CODE_404";
|
|
41
|
-
readonly STATUS_CODE_403: "STATUS_CODE_403";
|
|
42
45
|
readonly STATUS_CODE_451: "STATUS_CODE_451";
|
|
43
46
|
readonly SOCKET_DROP: "SOCKET_DROP";
|
|
44
|
-
readonly STASH: "STASH";
|
|
45
|
-
readonly SINGBOX: "SINGBOX";
|
|
46
|
-
readonly SINGBOX_LEGACY: "SINGBOX_LEGACY";
|
|
47
|
-
readonly MIHOMO: "MIHOMO";
|
|
48
47
|
readonly XRAY_JSON: "XRAY_JSON";
|
|
48
|
+
readonly XRAY_BASE64: "XRAY_BASE64";
|
|
49
|
+
readonly MIHOMO: "MIHOMO";
|
|
50
|
+
readonly STASH: "STASH";
|
|
49
51
|
readonly CLASH: "CLASH";
|
|
52
|
+
readonly SINGBOX: "SINGBOX";
|
|
53
|
+
}>;
|
|
54
|
+
responseModifications: z.ZodObject<{
|
|
55
|
+
headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
56
|
+
key: z.ZodString;
|
|
57
|
+
value: z.ZodString;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
value: string;
|
|
60
|
+
key: string;
|
|
61
|
+
}, {
|
|
62
|
+
value: string;
|
|
63
|
+
key: string;
|
|
64
|
+
}>, "many">>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
headers?: {
|
|
67
|
+
value: string;
|
|
68
|
+
key: string;
|
|
69
|
+
}[] | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
headers?: {
|
|
72
|
+
value: string;
|
|
73
|
+
key: string;
|
|
74
|
+
}[] | undefined;
|
|
50
75
|
}>;
|
|
51
76
|
}, "strip", z.ZodTypeAny, {
|
|
52
77
|
name: string;
|
|
53
78
|
operator: "AND" | "OR";
|
|
79
|
+
enabled: boolean;
|
|
54
80
|
conditions: {
|
|
55
81
|
value: string;
|
|
56
|
-
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
57
82
|
headerName: string;
|
|
83
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
84
|
+
caseSensitive: boolean;
|
|
58
85
|
}[];
|
|
59
|
-
responseType: "STASH" | "SINGBOX" | "
|
|
86
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
87
|
+
responseModifications: {
|
|
88
|
+
headers?: {
|
|
89
|
+
value: string;
|
|
90
|
+
key: string;
|
|
91
|
+
}[] | undefined;
|
|
92
|
+
};
|
|
60
93
|
description?: string | undefined;
|
|
61
94
|
}, {
|
|
62
95
|
name: string;
|
|
63
96
|
operator: "AND" | "OR";
|
|
97
|
+
enabled: boolean;
|
|
64
98
|
conditions: {
|
|
65
99
|
value: string;
|
|
66
|
-
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
67
100
|
headerName: string;
|
|
101
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
102
|
+
caseSensitive: boolean;
|
|
68
103
|
}[];
|
|
69
|
-
responseType: "STASH" | "SINGBOX" | "
|
|
104
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
105
|
+
responseModifications: {
|
|
106
|
+
headers?: {
|
|
107
|
+
value: string;
|
|
108
|
+
key: string;
|
|
109
|
+
}[] | undefined;
|
|
110
|
+
};
|
|
70
111
|
description?: string | undefined;
|
|
71
112
|
}>, "many">;
|
|
72
113
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -74,12 +115,20 @@ export declare const ResponseRulesConfigSchema: z.ZodObject<{
|
|
|
74
115
|
rules: {
|
|
75
116
|
name: string;
|
|
76
117
|
operator: "AND" | "OR";
|
|
118
|
+
enabled: boolean;
|
|
77
119
|
conditions: {
|
|
78
120
|
value: string;
|
|
79
|
-
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
80
121
|
headerName: string;
|
|
122
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
123
|
+
caseSensitive: boolean;
|
|
81
124
|
}[];
|
|
82
|
-
responseType: "STASH" | "SINGBOX" | "
|
|
125
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
126
|
+
responseModifications: {
|
|
127
|
+
headers?: {
|
|
128
|
+
value: string;
|
|
129
|
+
key: string;
|
|
130
|
+
}[] | undefined;
|
|
131
|
+
};
|
|
83
132
|
description?: string | undefined;
|
|
84
133
|
}[];
|
|
85
134
|
}, {
|
|
@@ -87,12 +136,20 @@ export declare const ResponseRulesConfigSchema: z.ZodObject<{
|
|
|
87
136
|
rules: {
|
|
88
137
|
name: string;
|
|
89
138
|
operator: "AND" | "OR";
|
|
139
|
+
enabled: boolean;
|
|
90
140
|
conditions: {
|
|
91
141
|
value: string;
|
|
92
|
-
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
93
142
|
headerName: string;
|
|
143
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
144
|
+
caseSensitive: boolean;
|
|
94
145
|
}[];
|
|
95
|
-
responseType: "STASH" | "SINGBOX" | "
|
|
146
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
147
|
+
responseModifications: {
|
|
148
|
+
headers?: {
|
|
149
|
+
value: string;
|
|
150
|
+
key: string;
|
|
151
|
+
}[] | undefined;
|
|
152
|
+
};
|
|
96
153
|
description?: string | undefined;
|
|
97
154
|
}[];
|
|
98
155
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-rules-config.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rules-config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"response-rules-config.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rules-config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoCxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCpC,CAAC"}
|
|
@@ -4,11 +4,52 @@ exports.ResponseRulesConfigSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const response_rule_schema_1 = require("./response-rule.schema");
|
|
7
|
+
const RuleExampleJson = JSON.stringify({
|
|
8
|
+
name: 'Block Legacy Clients',
|
|
9
|
+
description: 'Block requests from legacy clients',
|
|
10
|
+
operator: constants_1.RESPONSE_RULES_OPERATORS.OR,
|
|
11
|
+
enabled: true,
|
|
12
|
+
conditions: [
|
|
13
|
+
{
|
|
14
|
+
headerName: 'user-agent',
|
|
15
|
+
operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
|
|
16
|
+
value: 'Hiddify',
|
|
17
|
+
caseSensitive: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
headerName: 'user-agent',
|
|
21
|
+
operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
|
|
22
|
+
value: 'FoxRay',
|
|
23
|
+
caseSensitive: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
responseType: constants_1.RESPONSE_RULES_RESPONSE_TYPES.BLOCK,
|
|
27
|
+
}, null, 2);
|
|
7
28
|
exports.ResponseRulesConfigSchema = zod_1.z.object({
|
|
8
29
|
version: zod_1.z.nativeEnum(constants_1.RESPONSE_RULES_CONFIG_VERSION).describe(JSON.stringify({
|
|
9
30
|
title: 'Response Rules Config Version',
|
|
10
|
-
|
|
11
|
-
|
|
31
|
+
markdownDescription: 'Version of the **response rules** config. Currently supported version is **1**.',
|
|
32
|
+
})),
|
|
33
|
+
rules: zod_1.z.array(response_rule_schema_1.ResponseRuleSchema).describe(JSON.stringify({
|
|
34
|
+
examples: [
|
|
35
|
+
[
|
|
36
|
+
{
|
|
37
|
+
name: 'This is example rule name',
|
|
38
|
+
description: 'This is example rule description (optional)',
|
|
39
|
+
operator: constants_1.RESPONSE_RULES_OPERATORS.AND,
|
|
40
|
+
enabled: true,
|
|
41
|
+
conditions: [
|
|
42
|
+
{
|
|
43
|
+
headerName: 'user-agent',
|
|
44
|
+
operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
|
|
45
|
+
value: 'Example Rule Value, replace with your own value',
|
|
46
|
+
caseSensitive: true,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
responseType: constants_1.RESPONSE_RULES_RESPONSE_TYPES.BLOCK,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
],
|
|
53
|
+
markdownDescription: `Array of **response rules**.\n\nRules served from top to bottom – first matched rule is applied. Each rule is an object with the following properties:\n\n- **name**: Name of the response rule.\n- **description**: Description of the response rule.(Optional) \n- **enabled**: Whether the response rule is enabled. If disabled, the rule will not be applied.\n- **operator**: Operator to use for the rule.\n- **conditions**: Array of conditions to use for the rule.\n- **responseType**: Type of the response.\n\nExamples:\n\n1. Block legacy clients:\n\n\`\`\`json\n${RuleExampleJson}\n\`\`\`\n\nThis example shows how to block requests from legacy clients by checking if the User-Agent header contains "Hiddify" or "FoxRay".`,
|
|
12
54
|
})),
|
|
13
|
-
rules: zod_1.z.array(response_rule_schema_1.ResponseRuleSchema),
|
|
14
55
|
});
|
|
@@ -15,6 +15,160 @@ export declare const SubscriptionSettingsSchema: z.ZodObject<{
|
|
|
15
15
|
disabledUsersRemarks: z.ZodArray<z.ZodString, "many">;
|
|
16
16
|
customResponseHeaders: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
17
17
|
randomizeHosts: z.ZodBoolean;
|
|
18
|
+
responseRules: z.ZodNullable<z.ZodObject<{
|
|
19
|
+
version: z.ZodNativeEnum<{
|
|
20
|
+
readonly 1: "1";
|
|
21
|
+
}>;
|
|
22
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
description: z.ZodOptional<z.ZodString>;
|
|
25
|
+
enabled: z.ZodBoolean;
|
|
26
|
+
operator: z.ZodNativeEnum<{
|
|
27
|
+
readonly AND: "AND";
|
|
28
|
+
readonly OR: "OR";
|
|
29
|
+
}>;
|
|
30
|
+
conditions: z.ZodArray<z.ZodObject<{
|
|
31
|
+
headerName: z.ZodString;
|
|
32
|
+
operator: z.ZodNativeEnum<{
|
|
33
|
+
readonly EQUALS: "EQUALS";
|
|
34
|
+
readonly NOT_EQUALS: "NOT_EQUALS";
|
|
35
|
+
readonly CONTAINS: "CONTAINS";
|
|
36
|
+
readonly NOT_CONTAINS: "NOT_CONTAINS";
|
|
37
|
+
readonly STARTS_WITH: "STARTS_WITH";
|
|
38
|
+
readonly NOT_STARTS_WITH: "NOT_STARTS_WITH";
|
|
39
|
+
readonly ENDS_WITH: "ENDS_WITH";
|
|
40
|
+
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
41
|
+
readonly REGEX: "REGEX";
|
|
42
|
+
readonly NOT_REGEX: "NOT_REGEX";
|
|
43
|
+
}>;
|
|
44
|
+
value: z.ZodString;
|
|
45
|
+
caseSensitive: z.ZodBoolean;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
value: string;
|
|
48
|
+
headerName: string;
|
|
49
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
50
|
+
caseSensitive: boolean;
|
|
51
|
+
}, {
|
|
52
|
+
value: string;
|
|
53
|
+
headerName: string;
|
|
54
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
55
|
+
caseSensitive: boolean;
|
|
56
|
+
}>, "many">;
|
|
57
|
+
responseType: z.ZodNativeEnum<{
|
|
58
|
+
readonly BROWSER: "BROWSER";
|
|
59
|
+
readonly BLOCK: "BLOCK";
|
|
60
|
+
readonly STATUS_CODE_404: "STATUS_CODE_404";
|
|
61
|
+
readonly STATUS_CODE_451: "STATUS_CODE_451";
|
|
62
|
+
readonly SOCKET_DROP: "SOCKET_DROP";
|
|
63
|
+
readonly XRAY_JSON: "XRAY_JSON";
|
|
64
|
+
readonly XRAY_BASE64: "XRAY_BASE64";
|
|
65
|
+
readonly MIHOMO: "MIHOMO";
|
|
66
|
+
readonly STASH: "STASH";
|
|
67
|
+
readonly CLASH: "CLASH";
|
|
68
|
+
readonly SINGBOX: "SINGBOX";
|
|
69
|
+
}>;
|
|
70
|
+
responseModifications: z.ZodObject<{
|
|
71
|
+
headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
72
|
+
key: z.ZodString;
|
|
73
|
+
value: z.ZodString;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
value: string;
|
|
76
|
+
key: string;
|
|
77
|
+
}, {
|
|
78
|
+
value: string;
|
|
79
|
+
key: string;
|
|
80
|
+
}>, "many">>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
headers?: {
|
|
83
|
+
value: string;
|
|
84
|
+
key: string;
|
|
85
|
+
}[] | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
headers?: {
|
|
88
|
+
value: string;
|
|
89
|
+
key: string;
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
name: string;
|
|
94
|
+
operator: "AND" | "OR";
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
conditions: {
|
|
97
|
+
value: string;
|
|
98
|
+
headerName: string;
|
|
99
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
100
|
+
caseSensitive: boolean;
|
|
101
|
+
}[];
|
|
102
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
103
|
+
responseModifications: {
|
|
104
|
+
headers?: {
|
|
105
|
+
value: string;
|
|
106
|
+
key: string;
|
|
107
|
+
}[] | undefined;
|
|
108
|
+
};
|
|
109
|
+
description?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
name: string;
|
|
112
|
+
operator: "AND" | "OR";
|
|
113
|
+
enabled: boolean;
|
|
114
|
+
conditions: {
|
|
115
|
+
value: string;
|
|
116
|
+
headerName: string;
|
|
117
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
118
|
+
caseSensitive: boolean;
|
|
119
|
+
}[];
|
|
120
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
121
|
+
responseModifications: {
|
|
122
|
+
headers?: {
|
|
123
|
+
value: string;
|
|
124
|
+
key: string;
|
|
125
|
+
}[] | undefined;
|
|
126
|
+
};
|
|
127
|
+
description?: string | undefined;
|
|
128
|
+
}>, "many">;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
version: "1";
|
|
131
|
+
rules: {
|
|
132
|
+
name: string;
|
|
133
|
+
operator: "AND" | "OR";
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
conditions: {
|
|
136
|
+
value: string;
|
|
137
|
+
headerName: string;
|
|
138
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
139
|
+
caseSensitive: boolean;
|
|
140
|
+
}[];
|
|
141
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
142
|
+
responseModifications: {
|
|
143
|
+
headers?: {
|
|
144
|
+
value: string;
|
|
145
|
+
key: string;
|
|
146
|
+
}[] | undefined;
|
|
147
|
+
};
|
|
148
|
+
description?: string | undefined;
|
|
149
|
+
}[];
|
|
150
|
+
}, {
|
|
151
|
+
version: "1";
|
|
152
|
+
rules: {
|
|
153
|
+
name: string;
|
|
154
|
+
operator: "AND" | "OR";
|
|
155
|
+
enabled: boolean;
|
|
156
|
+
conditions: {
|
|
157
|
+
value: string;
|
|
158
|
+
headerName: string;
|
|
159
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
160
|
+
caseSensitive: boolean;
|
|
161
|
+
}[];
|
|
162
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
163
|
+
responseModifications: {
|
|
164
|
+
headers?: {
|
|
165
|
+
value: string;
|
|
166
|
+
key: string;
|
|
167
|
+
}[] | undefined;
|
|
168
|
+
};
|
|
169
|
+
description?: string | undefined;
|
|
170
|
+
}[];
|
|
171
|
+
}>>;
|
|
18
172
|
createdAt: z.ZodEffects<z.ZodString, Date, string>;
|
|
19
173
|
updatedAt: z.ZodEffects<z.ZodString, Date, string>;
|
|
20
174
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -35,6 +189,28 @@ export declare const SubscriptionSettingsSchema: z.ZodObject<{
|
|
|
35
189
|
disabledUsersRemarks: string[];
|
|
36
190
|
customResponseHeaders: Record<string, string> | null;
|
|
37
191
|
randomizeHosts: boolean;
|
|
192
|
+
responseRules: {
|
|
193
|
+
version: "1";
|
|
194
|
+
rules: {
|
|
195
|
+
name: string;
|
|
196
|
+
operator: "AND" | "OR";
|
|
197
|
+
enabled: boolean;
|
|
198
|
+
conditions: {
|
|
199
|
+
value: string;
|
|
200
|
+
headerName: string;
|
|
201
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
202
|
+
caseSensitive: boolean;
|
|
203
|
+
}[];
|
|
204
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
205
|
+
responseModifications: {
|
|
206
|
+
headers?: {
|
|
207
|
+
value: string;
|
|
208
|
+
key: string;
|
|
209
|
+
}[] | undefined;
|
|
210
|
+
};
|
|
211
|
+
description?: string | undefined;
|
|
212
|
+
}[];
|
|
213
|
+
} | null;
|
|
38
214
|
}, {
|
|
39
215
|
uuid: string;
|
|
40
216
|
createdAt: string;
|
|
@@ -53,5 +229,27 @@ export declare const SubscriptionSettingsSchema: z.ZodObject<{
|
|
|
53
229
|
disabledUsersRemarks: string[];
|
|
54
230
|
customResponseHeaders: Record<string, string> | null;
|
|
55
231
|
randomizeHosts: boolean;
|
|
232
|
+
responseRules: {
|
|
233
|
+
version: "1";
|
|
234
|
+
rules: {
|
|
235
|
+
name: string;
|
|
236
|
+
operator: "AND" | "OR";
|
|
237
|
+
enabled: boolean;
|
|
238
|
+
conditions: {
|
|
239
|
+
value: string;
|
|
240
|
+
headerName: string;
|
|
241
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
|
|
242
|
+
caseSensitive: boolean;
|
|
243
|
+
}[];
|
|
244
|
+
responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
|
|
245
|
+
responseModifications: {
|
|
246
|
+
headers?: {
|
|
247
|
+
value: string;
|
|
248
|
+
key: string;
|
|
249
|
+
}[] | undefined;
|
|
250
|
+
};
|
|
251
|
+
description?: string | undefined;
|
|
252
|
+
}[];
|
|
253
|
+
} | null;
|
|
56
254
|
}>;
|
|
57
255
|
//# sourceMappingURL=subscription-settings.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-settings.schema.d.ts","sourceRoot":"","sources":["../../../models/subscription-settings.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"subscription-settings.schema.d.ts","sourceRoot":"","sources":["../../../models/subscription-settings.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCrC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SubscriptionSettingsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const response_rules_1 = require("./response-rules");
|
|
5
6
|
exports.SubscriptionSettingsSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.string().uuid(),
|
|
7
8
|
profileTitle: zod_1.z.string(),
|
|
@@ -21,6 +22,7 @@ exports.SubscriptionSettingsSchema = zod_1.z.object({
|
|
|
21
22
|
disabledUsersRemarks: zod_1.z.array(zod_1.z.string()),
|
|
22
23
|
customResponseHeaders: zod_1.z.nullable(zod_1.z.record(zod_1.z.string(), zod_1.z.string())),
|
|
23
24
|
randomizeHosts: zod_1.z.boolean(),
|
|
25
|
+
responseRules: zod_1.z.nullable(response_rules_1.ResponseRulesConfigSchema),
|
|
24
26
|
createdAt: zod_1.z
|
|
25
27
|
.string()
|
|
26
28
|
.datetime()
|
package/build/frontend/commands/subscription-settings/update-subscription-settings.command.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateSubscriptionSettingsCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const api_1 = require("../../api");
|
|
6
5
|
const models_1 = require("../../models");
|
|
6
|
+
const api_1 = require("../../api");
|
|
7
7
|
const constants_1 = require("../../constants");
|
|
8
8
|
var UpdateSubscriptionSettingsCommand;
|
|
9
9
|
(function (UpdateSubscriptionSettingsCommand) {
|
|
@@ -31,6 +31,7 @@ var UpdateSubscriptionSettingsCommand;
|
|
|
31
31
|
.string()
|
|
32
32
|
.regex(/^[a-zA-Z0-9_-]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.'), zod_1.z.string())),
|
|
33
33
|
randomizeHosts: zod_1.z.optional(zod_1.z.boolean()),
|
|
34
|
+
responseRules: zod_1.z.optional(models_1.ResponseRulesConfigSchema),
|
|
34
35
|
});
|
|
35
36
|
UpdateSubscriptionSettingsCommand.ResponseSchema = zod_1.z.object({
|
|
36
37
|
response: models_1.SubscriptionSettingsSchema,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RESPONSE_RULES_RESPONSE_TYPES = exports.RESPONSE_RULES_CONDITION_OPERATORS = exports.RESPONSE_RULE_CONDITION_TYPES = exports.RESPONSE_RULES_OPERATORS = exports.RESPONSE_RULES_CONFIG_VERSION = void 0;
|
|
3
|
+
exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = exports.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION = exports.RESPONSE_RULES_CONDITION_OPERATORS_VALUES = exports.RESPONSE_RULES_RESPONSE_TYPES_VALUES = exports.RESPONSE_RULES_RESPONSE_TYPES = exports.RESPONSE_RULES_CONDITION_OPERATORS = exports.RESPONSE_RULE_CONDITION_TYPES = exports.RESPONSE_RULES_OPERATORS = exports.RESPONSE_RULES_CONFIG_VERSION = void 0;
|
|
4
4
|
const subscription_template_1 = require("../subscription-template");
|
|
5
5
|
exports.RESPONSE_RULES_CONFIG_VERSION = {
|
|
6
6
|
1: '1',
|
|
@@ -24,4 +24,31 @@ exports.RESPONSE_RULES_CONDITION_OPERATORS = {
|
|
|
24
24
|
REGEX: 'REGEX',
|
|
25
25
|
NOT_REGEX: 'NOT_REGEX',
|
|
26
26
|
};
|
|
27
|
-
exports.RESPONSE_RULES_RESPONSE_TYPES = Object.assign(Object.assign({}, subscription_template_1.SUBSCRIPTION_TEMPLATE_TYPE), {
|
|
27
|
+
exports.RESPONSE_RULES_RESPONSE_TYPES = Object.assign(Object.assign({}, subscription_template_1.SUBSCRIPTION_TEMPLATE_TYPE), { BROWSER: 'BROWSER', BLOCK: 'BLOCK', STATUS_CODE_404: 'STATUS_CODE_404', STATUS_CODE_451: 'STATUS_CODE_451', SOCKET_DROP: 'SOCKET_DROP' });
|
|
28
|
+
exports.RESPONSE_RULES_RESPONSE_TYPES_VALUES = Object.values(exports.RESPONSE_RULES_RESPONSE_TYPES);
|
|
29
|
+
exports.RESPONSE_RULES_CONDITION_OPERATORS_VALUES = Object.values(exports.RESPONSE_RULES_CONDITION_OPERATORS);
|
|
30
|
+
exports.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION = {
|
|
31
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.BLOCK]: 'Block response type blocks the request and returns a 403 status code.',
|
|
32
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.XRAY_BASE64]: 'Previously used as fallback response type. It return subscription as base64 encoded string. Compatible with most client application with Xray core.',
|
|
33
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.STATUS_CODE_404]: 'Status code 404 response type returns a 404 status code. This response type is used to return a 404 status code.',
|
|
34
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.STATUS_CODE_451]: 'Status code 451 response type returns a 451 status code. This response type is used to return a 451 status code.',
|
|
35
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.SOCKET_DROP]: 'Socket drop response type drops the socket connection. This response type is used to drop the socket connection.',
|
|
36
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.CLASH]: 'Useful for client application that use Legacy Clash core. It return subscription as Clash YAML format.',
|
|
37
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.STASH]: 'Format which is used by Stash client application.',
|
|
38
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.SINGBOX]: 'Format which is used by Singbox client application.',
|
|
39
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.MIHOMO]: 'Return subscription as Mihomo Core YAML format.',
|
|
40
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.XRAY_JSON]: 'Return subscription as Xray JSON format.',
|
|
41
|
+
[exports.RESPONSE_RULES_RESPONSE_TYPES.BROWSER]: 'Return subscription as browser format.',
|
|
42
|
+
};
|
|
43
|
+
exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = {
|
|
44
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.EQUALS]: 'Equals operator checks if the header value exactly matches the specified string, case sensitive. Underlying implementation uses strict string comparison – ===.',
|
|
45
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_EQUALS]: 'Not equals operator checks if the header value does not match the specified string, case sensitive. Underlying implementation uses strict string comparison – !==.',
|
|
46
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS]: 'Contains operator checks if the header value contains the specified string, case sensitive. Underlying implementation uses string.includes().',
|
|
47
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_CONTAINS]: 'Not contains operator checks if the header value does not contain the specified string, case sensitive. Underlying implementation uses string.includes().',
|
|
48
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.STARTS_WITH]: 'Starts with operator checks if the header value starts with the specified string, case sensitive. Underlying implementation uses string.startsWith().',
|
|
49
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_STARTS_WITH]: 'Not starts with operator checks if the header value does not start with the specified string, case sensitive. Underlying implementation uses string.startsWith().',
|
|
50
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.ENDS_WITH]: 'Ends with operator checks if the header value ends with the specified string, case sensitive. Underlying implementation uses string.endsWith().',
|
|
51
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_ENDS_WITH]: 'Not ends with operator checks if the header value does not end with the specified string, case sensitive. Underlying implementation uses string.endsWith().',
|
|
52
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.REGEX]: 'Regex operator checks if the header value matches the specified regex. Underlying implementation uses regex.test().',
|
|
53
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_REGEX]: 'Inverse regex operator checks if the header value does not match the specified regex. Underlying implementation uses regex.test().',
|
|
54
|
+
};
|