isite 2022.5.6 → 2022.8.1
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/apps/client-side/app.js +250 -204
- package/apps/client-side/site_files/css/bootstrap5-addon.css +68 -0
- package/apps/client-side/site_files/css/bootstrap5.css +4 -4
- package/apps/client-side/site_files/css/font-cairo.css +2 -2
- package/apps/client-side/site_files/css/font-droid.css +2 -2
- package/apps/client-side/site_files/css/theme.css +147 -147
- package/apps/client-side/site_files/css/theme_dark.css +1 -1
- package/apps/client-side/site_files/css/theme_paper.css +1 -1
- package/apps/client-side/site_files/js/bootstrap-5-addon.js +18 -0
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +1784 -0
- package/apps/client-side/site_files/js/bootstrap5.js +3 -4
- package/apps/client-side/site_files/js/directive-core.js +181 -0
- package/apps/client-side/site_files/js/directive.js +9 -1
- package/apps/client-side/site_files/js/site.js +17 -27
- package/lib/fsm.js +1 -1
- package/lib/mongodb.js +649 -646
- package/lib/routing.js +1184 -1187
- package/package.json +1 -1
package/lib/routing.js
CHANGED
|
@@ -1,1264 +1,1261 @@
|
|
|
1
1
|
module.exports = function init(____0) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
2
|
+
____0.on(____0.strings[4], (_) => {
|
|
3
|
+
if (!_) {
|
|
4
|
+
_0xrrxo.list = _0xrrxo.list.filter((r) => r.name.like('*x-api*'));
|
|
5
|
+
}
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
let _0xrrxo = function () {};
|
|
9
|
+
|
|
10
|
+
_0xrrxo.list = [];
|
|
11
|
+
|
|
12
|
+
_0xrrxo.endResponse = function (req, res) {
|
|
13
|
+
let route = req.route;
|
|
14
|
+
|
|
15
|
+
if (route.empty) {
|
|
16
|
+
if (____0.options.help) {
|
|
17
|
+
res.set('help-error-message', 'route is empty');
|
|
18
|
+
}
|
|
19
|
+
res.end();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (route.parser.like('*html*') && route.content && route.content.length > 0) {
|
|
24
|
+
req.content = ____0.parser(req, res, ____0, route).html(route.content);
|
|
25
|
+
} else if (route.parser == 'css' && route.content && route.content.length > 0) {
|
|
26
|
+
req.content = ____0.parser(req, res, ____0, route).css(route.content);
|
|
27
|
+
} else if (route.parser == 'js' && route.content && route.content.length > 0) {
|
|
28
|
+
req.content = ____0.parser(req, res, ____0, route).js(route.content);
|
|
29
|
+
} else {
|
|
30
|
+
req.content = route.content;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (route.compress) {
|
|
34
|
+
req.content = req.content.replace(/\r?\n|\r/g, ' ').replace(/\s+/g, ' ');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
route.path = route.path || '';
|
|
38
|
+
let encode = ____0.getFileEncode(route.path);
|
|
39
|
+
|
|
40
|
+
// let hash = req.content ? ____0.x0md50x(req.content) : ____0.x0md50x('');
|
|
41
|
+
let last_modified = new Date().toUTCString();
|
|
42
|
+
if (route.stat) {
|
|
43
|
+
last_modified = new Date(route.stat.mtimeMs).toUTCString();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// if (req.headers['if-none-match'] == hash) {
|
|
47
|
+
// if (____0.options.help) {
|
|
48
|
+
// res.set('help-info-message', 'etag matched');
|
|
49
|
+
// }
|
|
50
|
+
// // res.status(304).end(null);
|
|
51
|
+
// // return;
|
|
52
|
+
// }
|
|
53
|
+
|
|
54
|
+
// if (____0.options.help) {
|
|
55
|
+
// res.set('help-info-etag', hash);
|
|
56
|
+
// }
|
|
57
|
+
|
|
58
|
+
// res.set('ETag', hash);
|
|
59
|
+
|
|
60
|
+
if (____0.options.cache.enabled) {
|
|
61
|
+
res.set('Last-Modified', last_modified);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (route.headers) {
|
|
65
|
+
for (const property in route.headers) {
|
|
66
|
+
res.set(property, route.headers[property]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (route.path.endsWith('.css')) {
|
|
71
|
+
res.set(____0.strings[7], 'text/css');
|
|
72
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.css);
|
|
73
|
+
|
|
74
|
+
res.end(req.content, encode);
|
|
75
|
+
} else if (route.path.endsWith('.js')) {
|
|
76
|
+
res.set(____0.strings[7], 'application/javascript');
|
|
77
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
|
|
78
|
+
|
|
79
|
+
res.end(req.content, encode);
|
|
80
|
+
} else if (route.path.endsWith('.html')) {
|
|
81
|
+
res.set(____0.strings[7], 'text/html');
|
|
82
|
+
if (____0.options.cache.enabled && route.cache) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
|
|
83
|
+
|
|
84
|
+
res.end(req.content, encode);
|
|
85
|
+
} else if (route.path.endsWith('.txt')) {
|
|
86
|
+
res.set(____0.strings[7], 'text/plain');
|
|
87
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
|
|
88
|
+
|
|
89
|
+
res.end(req.content, encode);
|
|
90
|
+
} else if (route.path.endsWith('.json')) {
|
|
91
|
+
res.set(____0.strings[7], 'application/json');
|
|
92
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
|
|
93
|
+
|
|
94
|
+
res.end(req.content, encode);
|
|
95
|
+
} else if (route.path.endsWith('.xml')) {
|
|
96
|
+
res.set(____0.strings[7], 'text/xml');
|
|
97
|
+
if (____0.options.cache.enabled) {
|
|
98
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
res.end(req.content, encode);
|
|
102
|
+
} else if (route.path.endsWith('.woff2')) {
|
|
103
|
+
res.set(____0.strings[7], 'application/font-woff2');
|
|
104
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
105
|
+
|
|
106
|
+
res.end(req.content, encode);
|
|
107
|
+
} else if (route.path.endsWith('.woff')) {
|
|
108
|
+
res.set(____0.strings[7], 'application/font-woff');
|
|
109
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
110
|
+
|
|
111
|
+
res.end(req.content, encode);
|
|
112
|
+
} else if (route.path.endsWith('.ttf')) {
|
|
113
|
+
res.set(____0.strings[7], 'application/font-ttf');
|
|
114
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
115
|
+
|
|
116
|
+
res.end(req.content, encode);
|
|
117
|
+
} else if (route.path.endsWith('.otf')) {
|
|
118
|
+
res.set(____0.strings[7], 'application/font-otf');
|
|
119
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
120
|
+
|
|
121
|
+
res.end(req.content, encode);
|
|
122
|
+
} else if (route.path.endsWith('.eot')) {
|
|
123
|
+
res.set(____0.strings[7], 'application/font-eot');
|
|
124
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
125
|
+
|
|
126
|
+
res.end(req.content, encode);
|
|
127
|
+
} else if (route.path.endsWith('.gif')) {
|
|
128
|
+
res.set(____0.strings[7], 'image/gif');
|
|
129
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
130
|
+
|
|
131
|
+
res.end(req.content, encode);
|
|
132
|
+
} else if (route.path.endsWith('.png')) {
|
|
133
|
+
res.set(____0.strings[7], 'image/png');
|
|
134
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
135
|
+
|
|
136
|
+
res.end(req.content, encode);
|
|
137
|
+
} else if (route.path.endsWith('.jpg')) {
|
|
138
|
+
res.set(____0.strings[7], 'image/jpg');
|
|
139
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
140
|
+
|
|
141
|
+
res.end(req.content, encode);
|
|
142
|
+
} else if (route.path.endsWith('.jpeg')) {
|
|
143
|
+
res.set(____0.strings[7], 'image/jpeg');
|
|
144
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
145
|
+
|
|
146
|
+
res.end(req.content, encode);
|
|
147
|
+
} else if (route.path.endsWith('.ico')) {
|
|
148
|
+
res.set(____0.strings[7], 'image/ico');
|
|
149
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
150
|
+
|
|
151
|
+
res.end(req.content, encode);
|
|
152
|
+
} else if (route.path.endsWith('.bmp')) {
|
|
153
|
+
res.set(____0.strings[7], 'image/bmp');
|
|
154
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
155
|
+
|
|
156
|
+
res.end(req.content, encode);
|
|
157
|
+
} else if (route.path.endsWith('.svg')) {
|
|
158
|
+
res.set(____0.strings[7], 'image/svg+xml');
|
|
159
|
+
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
160
|
+
|
|
161
|
+
res.end(req.content, encode);
|
|
162
|
+
} else {
|
|
163
|
+
if (typeof req.content == 'object') {
|
|
164
|
+
res.json(req.content);
|
|
165
|
+
} else {
|
|
166
|
+
res.end(req.content, encode);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
_0xrrxo.defaultCallback = function (req, res) {
|
|
172
|
+
let route = req.route;
|
|
173
|
+
|
|
174
|
+
if (route.cache && route.content) {
|
|
175
|
+
if (____0.options.help) {
|
|
176
|
+
res.set('help-info-content', 'From Route Memory');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
res.status(200);
|
|
180
|
+
_0xrrxo.endResponse(req, res);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (route.empty) {
|
|
185
|
+
res.status(404);
|
|
186
|
+
_0xrrxo.endResponse(req, res);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (!route.path && !route.content) {
|
|
191
|
+
if (____0.options.help) {
|
|
192
|
+
res.set('help-info-content', 'Route Not Set File Path');
|
|
193
|
+
}
|
|
194
|
+
res.status(200);
|
|
195
|
+
_0xrrxo.endResponse(req, res);
|
|
196
|
+
return;
|
|
197
|
+
} else if (route.content) {
|
|
198
|
+
if (____0.options.help) {
|
|
199
|
+
res.set('help-info-content', 'Content From Route init');
|
|
200
|
+
}
|
|
201
|
+
res.status(200);
|
|
202
|
+
_0xrrxo.endResponse(req, res);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (typeof route.path == 'string') {
|
|
206
|
+
____0.readFile(route.path, function (err, data, file) {
|
|
207
|
+
if (!err) {
|
|
208
|
+
route.content = data.toString('utf8');
|
|
209
|
+
if (route.encript && route.encript === '123') {
|
|
210
|
+
route.content = ____0.f1(route.content);
|
|
211
|
+
}
|
|
212
|
+
route.stat = file.stat;
|
|
213
|
+
if (route.masterPage) {
|
|
214
|
+
for (var i = 0; i < ____0.masterPages.length; i++) {
|
|
215
|
+
if (route.masterPage == ____0.masterPages[i].name) {
|
|
216
|
+
route.content = ____0.readFileSync(____0.masterPages[i].header) + route.content + ____0.readFileSync(____0.masterPages[i].footer);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
67
219
|
}
|
|
68
|
-
|
|
220
|
+
}
|
|
69
221
|
|
|
70
|
-
|
|
71
|
-
res.set(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
res.end(req.content, encode);
|
|
75
|
-
} else if (route.path.endsWith('.js')) {
|
|
76
|
-
res.set(____0.strings[7], 'application/javascript');
|
|
77
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
|
|
78
|
-
|
|
79
|
-
res.end(req.content, encode);
|
|
80
|
-
} else if (route.path.endsWith('.html')) {
|
|
81
|
-
res.set(____0.strings[7], 'text/html');
|
|
82
|
-
if (____0.options.cache.enabled && route.cache) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
|
|
83
|
-
|
|
84
|
-
res.end(req.content, encode);
|
|
85
|
-
} else if (route.path.endsWith('.txt')) {
|
|
86
|
-
res.set(____0.strings[7], 'text/plain');
|
|
87
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
|
|
88
|
-
|
|
89
|
-
res.end(req.content, encode);
|
|
90
|
-
} else if (route.path.endsWith('.json')) {
|
|
91
|
-
res.set(____0.strings[7], 'application/json');
|
|
92
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
|
|
93
|
-
|
|
94
|
-
res.end(req.content, encode);
|
|
95
|
-
} else if (route.path.endsWith('.xml')) {
|
|
96
|
-
res.set(____0.strings[7], 'text/xml');
|
|
97
|
-
if (____0.options.cache.enabled) {
|
|
98
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
|
|
99
|
-
}
|
|
222
|
+
if (____0.options.help) {
|
|
223
|
+
res.set('help-info-content', 'Route Read File');
|
|
224
|
+
}
|
|
100
225
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
res.set(____0.strings[7], 'application/font-woff2');
|
|
104
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
105
|
-
|
|
106
|
-
res.end(req.content, encode);
|
|
107
|
-
} else if (route.path.endsWith('.woff')) {
|
|
108
|
-
res.set(____0.strings[7], 'application/font-woff');
|
|
109
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
110
|
-
|
|
111
|
-
res.end(req.content, encode);
|
|
112
|
-
} else if (route.path.endsWith('.ttf')) {
|
|
113
|
-
res.set(____0.strings[7], 'application/font-ttf');
|
|
114
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
115
|
-
|
|
116
|
-
res.end(req.content, encode);
|
|
117
|
-
} else if (route.path.endsWith('.otf')) {
|
|
118
|
-
res.set(____0.strings[7], 'application/font-otf');
|
|
119
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
120
|
-
|
|
121
|
-
res.end(req.content, encode);
|
|
122
|
-
} else if (route.path.endsWith('.eot')) {
|
|
123
|
-
res.set(____0.strings[7], 'application/font-eot');
|
|
124
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
125
|
-
|
|
126
|
-
res.end(req.content, encode);
|
|
127
|
-
} else if (route.path.endsWith('.gif')) {
|
|
128
|
-
res.set(____0.strings[7], 'image/gif');
|
|
129
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
130
|
-
|
|
131
|
-
res.end(req.content, encode);
|
|
132
|
-
} else if (route.path.endsWith('.png')) {
|
|
133
|
-
res.set(____0.strings[7], 'image/png');
|
|
134
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
135
|
-
|
|
136
|
-
res.end(req.content, encode);
|
|
137
|
-
} else if (route.path.endsWith('.jpg')) {
|
|
138
|
-
res.set(____0.strings[7], 'image/jpg');
|
|
139
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
140
|
-
|
|
141
|
-
res.end(req.content, encode);
|
|
142
|
-
} else if (route.path.endsWith('.jpeg')) {
|
|
143
|
-
res.set(____0.strings[7], 'image/jpeg');
|
|
144
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
145
|
-
|
|
146
|
-
res.end(req.content, encode);
|
|
147
|
-
} else if (route.path.endsWith('.ico')) {
|
|
148
|
-
res.set(____0.strings[7], 'image/ico');
|
|
149
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
150
|
-
|
|
151
|
-
res.end(req.content, encode);
|
|
152
|
-
} else if (route.path.endsWith('.bmp')) {
|
|
153
|
-
res.set(____0.strings[7], 'image/bmp');
|
|
154
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
155
|
-
|
|
156
|
-
res.end(req.content, encode);
|
|
157
|
-
} else if (route.path.endsWith('.svg')) {
|
|
158
|
-
res.set(____0.strings[7], 'image/svg+xml');
|
|
159
|
-
if (____0.options.cache.enabled) res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
160
|
-
|
|
161
|
-
res.end(req.content, encode);
|
|
226
|
+
res.status(200);
|
|
227
|
+
_0xrrxo.endResponse(req, res);
|
|
162
228
|
} else {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
229
|
+
if (____0.options.help) {
|
|
230
|
+
res.set('help-error', 'Route Error Read File');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
res.status(404);
|
|
234
|
+
route.empty = !0;
|
|
235
|
+
_0xrrxo.endResponse(req, res);
|
|
236
|
+
return;
|
|
168
237
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
238
|
+
});
|
|
239
|
+
} else if (typeof route.path == 'object') {
|
|
240
|
+
____0.readFiles(route.path, function (err, data) {
|
|
241
|
+
if (!err) {
|
|
242
|
+
if (____0.options.help) {
|
|
243
|
+
res.set('help-info-content', 'Route Read Files');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
route.content = data.toString('utf8');
|
|
247
|
+
if (route.encript && route.encript === '123') {
|
|
248
|
+
route.content = ____0.f1(route.content);
|
|
249
|
+
}
|
|
250
|
+
res.status(200);
|
|
251
|
+
route.path = route.path.join('&&');
|
|
252
|
+
_0xrrxo.endResponse(req, res);
|
|
253
|
+
} else {
|
|
254
|
+
if (____0.options.help) {
|
|
255
|
+
res.set('help-error', 'Route Error Read Files');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
res.status(404);
|
|
259
|
+
route.empty = !0;
|
|
260
|
+
_0xrrxo.endResponse(req, res);
|
|
261
|
+
return;
|
|
182
262
|
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
_0xrrxo.call = function (r, req, res, callback) {
|
|
268
|
+
callback =
|
|
269
|
+
callback ||
|
|
270
|
+
function (req, res) {
|
|
271
|
+
console.log('No CallBack set For : ', r);
|
|
272
|
+
res.end();
|
|
273
|
+
};
|
|
274
|
+
if (typeof r === 'string') {
|
|
275
|
+
r = {
|
|
276
|
+
name: r,
|
|
277
|
+
method: req.method,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
let exists = false;
|
|
282
|
+
_0xrrxo.list.forEach((rr) => {
|
|
283
|
+
if (exists) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (rr.name == r.name && rr.method == r.method) {
|
|
287
|
+
exists = true;
|
|
288
|
+
req.route = rr;
|
|
289
|
+
rr.callback(req, res);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
183
292
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
293
|
+
if (!exists) {
|
|
294
|
+
callback(req, res);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
_0xrrxo.off = function (r) {
|
|
298
|
+
if (!r) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (typeof r == 'string') {
|
|
302
|
+
r = { name: r };
|
|
303
|
+
}
|
|
304
|
+
for (let i = _0xrrxo.list.length; i--; ) {
|
|
305
|
+
let r0 = _0xrrxo.list[i];
|
|
306
|
+
if (r.name && r.method && r0.name.like(r.name) && r0.method.like(r.method)) {
|
|
307
|
+
_0xrrxo.list.splice(i, 1);
|
|
308
|
+
____0.fsm.off(r0.path);
|
|
309
|
+
} else if (r.name && r0.name.like(r.name)) {
|
|
310
|
+
_0xrrxo.list.splice(i, 1);
|
|
311
|
+
____0.fsm.off('*' + r0.name.replace('/', '') + '*');
|
|
312
|
+
____0.fsm.off(r0.path);
|
|
313
|
+
} else if (r.method && r0.method.like(r.method)) {
|
|
314
|
+
_0xrrxo.list.splice(i, 1);
|
|
315
|
+
____0.fsm.off(r0.path);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
_0xrrxo.add = function (r, callback) {
|
|
320
|
+
if (Array.isArray(r)) {
|
|
321
|
+
r.forEach((r2) => {
|
|
322
|
+
_0xrrxo.add(r2, callback);
|
|
323
|
+
});
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (r && r.name && Array.isArray(r.name)) {
|
|
327
|
+
r.name.forEach((r2) => {
|
|
328
|
+
let r3 = Object.assign({}, r);
|
|
329
|
+
r3.name = r2;
|
|
330
|
+
_0xrrxo.onGET(r3, r.callback);
|
|
331
|
+
});
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
let route = {};
|
|
335
|
+
|
|
336
|
+
if (typeof r == 'string') {
|
|
337
|
+
route.name = r.toLowerCase();
|
|
338
|
+
route.name0 = r;
|
|
339
|
+
route.public = ____0.options.public || false;
|
|
340
|
+
route.method = 'GET';
|
|
341
|
+
route.path = null;
|
|
342
|
+
route.parser = 'static';
|
|
343
|
+
route.parserDir = ____0.dir;
|
|
344
|
+
route.cache = !0;
|
|
345
|
+
route.hide = !1;
|
|
346
|
+
route.compress = !1;
|
|
347
|
+
route.content = null;
|
|
348
|
+
route.headers = null;
|
|
349
|
+
route.map = [];
|
|
350
|
+
route.callback = callback ?? _0xrrxo.defaultCallback;
|
|
351
|
+
if (route.public) {
|
|
352
|
+
route.require = {
|
|
353
|
+
features: [],
|
|
354
|
+
permissions: [],
|
|
355
|
+
};
|
|
356
|
+
} else {
|
|
357
|
+
route.require = ____0.options.requires;
|
|
358
|
+
route.default = ____0.options.defaults;
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
route.name = r.name.toLowerCase();
|
|
362
|
+
route.name0 = r.name;
|
|
363
|
+
route.public = r.public ?? (____0.options.public || false);
|
|
364
|
+
route.method = r.method || 'GET';
|
|
365
|
+
route.path = r.path || null;
|
|
366
|
+
route.content = r.content;
|
|
367
|
+
route.headers = r.headers;
|
|
368
|
+
route.parser = r.parser || 'static';
|
|
369
|
+
route.parserDir = r.parserDir || ____0.dir;
|
|
370
|
+
route.masterPage = r.masterPage || null;
|
|
371
|
+
route.cache = r.cache ?? !0;
|
|
372
|
+
route.hide = r.hide ?? !1;
|
|
373
|
+
route.encript = r.encript;
|
|
374
|
+
route.compress = r.compress ?? !1;
|
|
375
|
+
route.map = r.map || [];
|
|
376
|
+
route.callback = callback || r.callback || _0xrrxo.defaultCallback;
|
|
377
|
+
|
|
378
|
+
if (route.public) {
|
|
379
|
+
route.require = {
|
|
380
|
+
features: [],
|
|
381
|
+
permissions: [],
|
|
382
|
+
};
|
|
383
|
+
} else {
|
|
384
|
+
route.require = r.require ?? ____0.options.requires;
|
|
385
|
+
route.require.features = route.require.features ?? ____0.options.requires.features;
|
|
386
|
+
route.require.permissions = route.require.permissions ?? ____0.options.requires.permissions;
|
|
387
|
+
|
|
388
|
+
route.default = r.default ?? ____0.options.defaults;
|
|
389
|
+
route.default.features = route.default.features ?? ____0.options.defaults.features;
|
|
390
|
+
route.default.permissions = route.default.permissions ?? ____0.options.defaults.permissions;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (!route.name.startsWith('/')) {
|
|
395
|
+
route.name = '/' + route.name;
|
|
396
|
+
route.name0 = '/' + route.name0;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
route.name = route.name.replace('//', '/');
|
|
400
|
+
route.name0 = route.name0.replace('//', '/');
|
|
401
|
+
|
|
402
|
+
let arr = route.name.split('/');
|
|
403
|
+
let arr0 = route.name0.split('/');
|
|
404
|
+
|
|
405
|
+
for (var i = 0; i < arr.length; i++) {
|
|
406
|
+
var s = arr[i];
|
|
407
|
+
var s0 = arr0[i];
|
|
408
|
+
|
|
409
|
+
if (s.startsWith(':')) {
|
|
410
|
+
arr[i] = '*';
|
|
411
|
+
let name = s.replace(':', '');
|
|
412
|
+
let name0 = s0.replace(':', '');
|
|
413
|
+
|
|
414
|
+
route.map.push({
|
|
415
|
+
index: i,
|
|
416
|
+
name: name,
|
|
417
|
+
isLower: !1,
|
|
418
|
+
});
|
|
419
|
+
if (name !== name0) {
|
|
420
|
+
route.map.push({
|
|
421
|
+
index: i,
|
|
422
|
+
name: name0,
|
|
423
|
+
isLower: !0,
|
|
424
|
+
});
|
|
188
425
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
try {
|
|
429
|
+
route.name = arr.join('/');
|
|
430
|
+
if (typeof route.path == 'string' && ____0.fs.lstatSync(route.path).isDirectory()) {
|
|
431
|
+
____0.fs.readdir(route.path, (err, files) => {
|
|
432
|
+
files.forEach((file) => {
|
|
433
|
+
let r2 = { ...route };
|
|
434
|
+
if (route.name.endsWith('/')) {
|
|
435
|
+
r2.name = route.name + file;
|
|
436
|
+
} else {
|
|
437
|
+
r2.name = route.name + '/' + file;
|
|
200
438
|
}
|
|
201
|
-
res.status(200);
|
|
202
|
-
_0xrrxo.endResponse(req, res);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (typeof route.path == 'string') {
|
|
206
|
-
____0.readFile(route.path, function (err, data, file) {
|
|
207
|
-
if (!err) {
|
|
208
|
-
route.content = data.toString('utf8');
|
|
209
|
-
if (route.encript && route.encript === '123') {
|
|
210
|
-
route.content = ____0.f1(route.content);
|
|
211
|
-
}
|
|
212
|
-
route.stat = file.stat;
|
|
213
|
-
if (route.masterPage) {
|
|
214
|
-
for (var i = 0; i < ____0.masterPages.length; i++) {
|
|
215
|
-
if (route.masterPage == ____0.masterPages[i].name) {
|
|
216
|
-
route.content = ____0.readFileSync(____0.masterPages[i].header) + route.content + ____0.readFileSync(____0.masterPages[i].footer);
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (____0.options.help) {
|
|
223
|
-
res.set('help-info-content', 'Route Read File');
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
res.status(200);
|
|
227
|
-
_0xrrxo.endResponse(req, res);
|
|
228
|
-
} else {
|
|
229
|
-
if (____0.options.help) {
|
|
230
|
-
res.set('help-error', 'Route Error Read File');
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
res.status(404);
|
|
234
|
-
route.empty = !0;
|
|
235
|
-
_0xrrxo.endResponse(req, res);
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
} else if (typeof route.path == 'object') {
|
|
240
|
-
____0.readFiles(route.path, function (err, data) {
|
|
241
|
-
if (!err) {
|
|
242
|
-
if (____0.options.help) {
|
|
243
|
-
res.set('help-info-content', 'Route Read Files');
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
route.content = data.toString('utf8');
|
|
247
|
-
if (route.encript && route.encript === '123') {
|
|
248
|
-
route.content = ____0.f1(route.content);
|
|
249
|
-
}
|
|
250
|
-
res.status(200);
|
|
251
|
-
route.path = route.path.join('&&');
|
|
252
|
-
_0xrrxo.endResponse(req, res);
|
|
253
|
-
} else {
|
|
254
|
-
if (____0.options.help) {
|
|
255
|
-
res.set('help-error', 'Route Error Read Files');
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
res.status(404);
|
|
259
|
-
route.empty = !0;
|
|
260
|
-
_0xrrxo.endResponse(req, res);
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
439
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
r = {
|
|
276
|
-
name: r,
|
|
277
|
-
method: req.method,
|
|
278
|
-
};
|
|
440
|
+
r2.path = route.path + '/' + file;
|
|
441
|
+
r2.is_dynamic = !0;
|
|
442
|
+
_0xrrxo.add(r2);
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
} else {
|
|
446
|
+
if (!route.name.startsWith('/')) {
|
|
447
|
+
route.name = '/' + route.name;
|
|
279
448
|
}
|
|
280
449
|
|
|
281
|
-
let
|
|
450
|
+
let exist = !1;
|
|
282
451
|
_0xrrxo.list.forEach((rr) => {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (rr.name == r.name && rr.method == r.method) {
|
|
287
|
-
exists = true;
|
|
288
|
-
req.route = rr;
|
|
289
|
-
rr.callback(req, res);
|
|
290
|
-
}
|
|
452
|
+
if (rr.name == route.name && rr.method == route.method) {
|
|
453
|
+
exist = !0;
|
|
454
|
+
}
|
|
291
455
|
});
|
|
292
456
|
|
|
293
|
-
if (!
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (typeof r == 'string') {
|
|
302
|
-
r = { name: r };
|
|
303
|
-
}
|
|
304
|
-
for (let i = _0xrrxo.list.length; i--; ) {
|
|
305
|
-
let r0 = _0xrrxo.list[i];
|
|
306
|
-
if (r.name && r.method && r0.name.like(r.name) && r0.method.like(r.method)) {
|
|
307
|
-
_0xrrxo.list.splice(i, 1);
|
|
308
|
-
____0.fsm.off(r0.path);
|
|
309
|
-
} else if (r.name && r0.name.like(r.name)) {
|
|
310
|
-
_0xrrxo.list.splice(i, 1);
|
|
311
|
-
____0.fsm.off('*' + r0.name.replace('/', '') + '*');
|
|
312
|
-
____0.fsm.off(r0.path);
|
|
313
|
-
} else if (r.method && r0.method.like(r.method)) {
|
|
314
|
-
_0xrrxo.list.splice(i, 1);
|
|
315
|
-
____0.fsm.off(r0.path);
|
|
316
|
-
}
|
|
457
|
+
if (!exist) {
|
|
458
|
+
_0xrrxo.list.push(route);
|
|
459
|
+
} else {
|
|
460
|
+
if (route.name.like('*api/*')) {
|
|
461
|
+
____0.log('[ Duplicate API ] ' + route.name);
|
|
462
|
+
} else {
|
|
463
|
+
____0.log('[ Duplicate Route ] ' + route.name + ' || ' + route.path);
|
|
464
|
+
}
|
|
317
465
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
466
|
+
}
|
|
467
|
+
} catch (err) {
|
|
468
|
+
____0.log(err);
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
_0xrrxo.onREQUEST = function (type, r, callback) {
|
|
474
|
+
if (Array.isArray(r)) {
|
|
475
|
+
r.forEach((r2) => {
|
|
476
|
+
_0xrrxo.onREQUEST(type, r2, callback);
|
|
477
|
+
});
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
let route = {};
|
|
481
|
+
if (typeof r == 'string') {
|
|
482
|
+
route = {
|
|
483
|
+
name: r,
|
|
484
|
+
method: type,
|
|
485
|
+
callback: callback || _0xrrxo.defaultCallback,
|
|
486
|
+
};
|
|
487
|
+
} else {
|
|
488
|
+
route = r;
|
|
489
|
+
|
|
490
|
+
if (Array.isArray(r.name)) {
|
|
491
|
+
r.name.forEach((n) => {
|
|
492
|
+
let sub_route = { ...route };
|
|
493
|
+
sub_route.name = n;
|
|
494
|
+
_0xrrxo.onREQUEST(type, sub_route, callback);
|
|
495
|
+
});
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
route.callback = route.callback || callback || _0xrrxo.defaultCallback;
|
|
499
|
+
}
|
|
500
|
+
route.method = type;
|
|
501
|
+
_0xrrxo.add(route);
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
_0xrrxo.onGET = function (r, callback) {
|
|
505
|
+
_0xrrxo.onREQUEST('GET', r, callback);
|
|
506
|
+
};
|
|
507
|
+
_0xrrxo.onPOST = function (r, callback) {
|
|
508
|
+
_0xrrxo.onREQUEST('POST', r, callback);
|
|
509
|
+
};
|
|
510
|
+
_0xrrxo.onPUT = function (r, callback) {
|
|
511
|
+
_0xrrxo.onREQUEST('PUT', r, callback);
|
|
512
|
+
};
|
|
513
|
+
_0xrrxo.onDELETE = function (r, callback) {
|
|
514
|
+
_0xrrxo.onREQUEST('DELETE', r, callback);
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
_0xrrxo.onTEST = function (r, callback) {
|
|
518
|
+
_0xrrxo.onREQUEST('TEST', r, callback);
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
_0xrrxo.onVIEW = function (r, callback) {
|
|
522
|
+
_0xrrxo.onREQUEST('VIEW', r, callback);
|
|
523
|
+
};
|
|
524
|
+
_0xrrxo.onOPTIONS = function (r, callback) {
|
|
525
|
+
_0xrrxo.onREQUEST('OPTIONS', r, callback);
|
|
526
|
+
};
|
|
527
|
+
_0xrrxo.onPATCH = function (r, callback) {
|
|
528
|
+
_0xrrxo.onREQUEST('PATCH', r, callback);
|
|
529
|
+
};
|
|
530
|
+
_0xrrxo.onCOPY = function (r, callback) {
|
|
531
|
+
_0xrrxo.onREQUEST('COPY', r, callback);
|
|
532
|
+
};
|
|
533
|
+
_0xrrxo.onHEAD = function (r, callback) {
|
|
534
|
+
_0xrrxo.onREQUEST('HEAD', r, callback);
|
|
535
|
+
};
|
|
536
|
+
_0xrrxo.onLINK = function (r, callback) {
|
|
537
|
+
_0xrrxo.onREQUEST('LINK', r, callback);
|
|
538
|
+
};
|
|
539
|
+
_0xrrxo.onUNLINK = function (r, callback) {
|
|
540
|
+
_0xrrxo.onREQUEST('UNLINK', r, callback);
|
|
541
|
+
};
|
|
542
|
+
_0xrrxo.onPURGE = function (r, callback) {
|
|
543
|
+
_0xrrxo.onREQUEST('PURGE', r, callback);
|
|
544
|
+
};
|
|
545
|
+
_0xrrxo.onLOCK = function (r, callback) {
|
|
546
|
+
_0xrrxo.onREQUEST('LOCK', r, callback);
|
|
547
|
+
};
|
|
548
|
+
_0xrrxo.onUNLOCK = function (r, callback) {
|
|
549
|
+
_0xrrxo.onREQUEST('UNLOCK', r, callback);
|
|
550
|
+
};
|
|
551
|
+
_0xrrxo.onPROPFIND = function (r, callback) {
|
|
552
|
+
_0xrrxo.onREQUEST('PROPFIND', r, callback);
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
_0xrrxo.onALL = _0xrrxo.onANY = function (r, callback) {
|
|
556
|
+
_0xrrxo.onREQUEST('*', r, callback);
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
_0xrrxo.handleRoute = async function (req, res, route) {
|
|
560
|
+
if (!route.public) {
|
|
561
|
+
if (!route.name.like(____0.strings[15]) && route.require.features.length > 0) {
|
|
562
|
+
let ok = !0;
|
|
563
|
+
route.require.features.forEach((feature) => {
|
|
564
|
+
if (!req.hasFeature(feature)) {
|
|
565
|
+
ok = !1;
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
if (!ok) {
|
|
569
|
+
res.status(401);
|
|
570
|
+
if (route.name.contains(____0.strings[16])) {
|
|
571
|
+
return res.json({
|
|
572
|
+
done: !1,
|
|
573
|
+
error: ____0.strings[13],
|
|
574
|
+
features: route.require.features,
|
|
323
575
|
});
|
|
324
|
-
|
|
576
|
+
} else
|
|
577
|
+
return res.render(
|
|
578
|
+
____0.strings[11],
|
|
579
|
+
{
|
|
580
|
+
features: route.require.features.join(','),
|
|
581
|
+
html: ` ${____0.strings[13]} : ${route.require.features.join(',')}`,
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
parser: ____0.strings[17],
|
|
585
|
+
}
|
|
586
|
+
);
|
|
325
587
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
if (!route.name.like(____0.strings[15]) && route.require.permissions.length > 0) {
|
|
591
|
+
let ok = !0;
|
|
592
|
+
route.require.permissions.forEach((permission) => {
|
|
593
|
+
if (!____0.security.isUserHasPermissions(req, res, permission)) {
|
|
594
|
+
ok = !1;
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
if (!ok) {
|
|
598
|
+
res.status(401);
|
|
599
|
+
if (route.name.contains(____0.strings[16])) {
|
|
600
|
+
return res.json({
|
|
601
|
+
done: !1,
|
|
602
|
+
error: ____0.strings[14],
|
|
603
|
+
permissions: route.require.permissions,
|
|
331
604
|
});
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
route.cache = !0;
|
|
345
|
-
route.hide = !1;
|
|
346
|
-
route.compress = !1;
|
|
347
|
-
route.content = null;
|
|
348
|
-
route.headers = null;
|
|
349
|
-
route.map = [];
|
|
350
|
-
route.callback = callback ?? _0xrrxo.defaultCallback;
|
|
351
|
-
if (route.public) {
|
|
352
|
-
route.require = {
|
|
353
|
-
features: [],
|
|
354
|
-
permissions: [],
|
|
355
|
-
};
|
|
356
|
-
} else {
|
|
357
|
-
route.require = ____0.options.requires;
|
|
358
|
-
route.default = ____0.options.defaults;
|
|
359
|
-
}
|
|
360
|
-
} else {
|
|
361
|
-
route.name = r.name.toLowerCase();
|
|
362
|
-
route.name0 = r.name;
|
|
363
|
-
route.public = r.public ?? (____0.options.public || false);
|
|
364
|
-
route.method = r.method || 'GET';
|
|
365
|
-
route.path = r.path || null;
|
|
366
|
-
route.content = r.content;
|
|
367
|
-
route.headers = r.headers;
|
|
368
|
-
route.parser = r.parser || 'static';
|
|
369
|
-
route.parserDir = r.parserDir || ____0.dir;
|
|
370
|
-
route.masterPage = r.masterPage || null;
|
|
371
|
-
route.cache = r.cache ?? !0;
|
|
372
|
-
route.hide = r.hide ?? !1;
|
|
373
|
-
route.encript = r.encript;
|
|
374
|
-
route.compress = r.compress ?? !1;
|
|
375
|
-
route.map = r.map || [];
|
|
376
|
-
route.callback = callback || r.callback || _0xrrxo.defaultCallback;
|
|
377
|
-
|
|
378
|
-
if (route.public) {
|
|
379
|
-
route.require = {
|
|
380
|
-
features: [],
|
|
381
|
-
permissions: [],
|
|
382
|
-
};
|
|
383
|
-
} else {
|
|
384
|
-
route.require = r.require ?? ____0.options.requires;
|
|
385
|
-
route.require.features = route.require.features ?? ____0.options.requires.features;
|
|
386
|
-
route.require.permissions = route.require.permissions ?? ____0.options.requires.permissions;
|
|
387
|
-
|
|
388
|
-
route.default = r.default ?? ____0.options.defaults;
|
|
389
|
-
route.default.features = route.default.features ?? ____0.options.defaults.features;
|
|
390
|
-
route.default.permissions = route.default.permissions ?? ____0.options.defaults.permissions;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (!route.name.startsWith('/')) {
|
|
395
|
-
route.name = '/' + route.name;
|
|
396
|
-
route.name0 = '/' + route.name0;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
route.name = route.name.replace('//', '/');
|
|
400
|
-
route.name0 = route.name0.replace('//', '/');
|
|
401
|
-
|
|
402
|
-
let arr = route.name.split('/');
|
|
403
|
-
let arr0 = route.name0.split('/');
|
|
404
|
-
|
|
405
|
-
for (var i = 0; i < arr.length; i++) {
|
|
406
|
-
var s = arr[i];
|
|
407
|
-
var s0 = arr0[i];
|
|
408
|
-
|
|
409
|
-
if (s.startsWith(':')) {
|
|
410
|
-
arr[i] = '*';
|
|
411
|
-
let name = s.replace(':', '');
|
|
412
|
-
let name0 = s0.replace(':', '');
|
|
413
|
-
|
|
414
|
-
route.map.push({
|
|
415
|
-
index: i,
|
|
416
|
-
name: name,
|
|
417
|
-
isLower: !1,
|
|
418
|
-
});
|
|
419
|
-
if (name !== name0) {
|
|
420
|
-
route.map.push({
|
|
421
|
-
index: i,
|
|
422
|
-
name: name0,
|
|
423
|
-
isLower: !0,
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
try {
|
|
429
|
-
route.name = arr.join('/');
|
|
430
|
-
if (typeof route.path == 'string' && ____0.fs.lstatSync(route.path).isDirectory()) {
|
|
431
|
-
____0.fs.readdir(route.path, (err, files) => {
|
|
432
|
-
files.forEach((file) => {
|
|
433
|
-
let r2 = { ...route };
|
|
434
|
-
if (route.name.endsWith('/')) {
|
|
435
|
-
r2.name = route.name + file;
|
|
436
|
-
} else {
|
|
437
|
-
r2.name = route.name + '/' + file;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
r2.path = route.path + '/' + file;
|
|
441
|
-
r2.is_dynamic = !0;
|
|
442
|
-
_0xrrxo.add(r2);
|
|
443
|
-
});
|
|
444
|
-
});
|
|
445
|
-
} else {
|
|
446
|
-
if (!route.name.startsWith('/')) {
|
|
447
|
-
route.name = '/' + route.name;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
let exist = !1;
|
|
451
|
-
_0xrrxo.list.forEach((rr) => {
|
|
452
|
-
if (rr.name == route.name && rr.method == route.method) {
|
|
453
|
-
exist = !0;
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
if (!exist) {
|
|
458
|
-
_0xrrxo.list.push(route);
|
|
459
|
-
} else {
|
|
460
|
-
if (route.name.like('*api/*')) {
|
|
461
|
-
____0.log('[ Duplicate API ] ' + route.name);
|
|
462
|
-
} else {
|
|
463
|
-
____0.log('[ Duplicate Route ] ' + route.name + ' || ' + route.path);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
} catch (err) {
|
|
468
|
-
____0.log(err);
|
|
469
|
-
return null;
|
|
605
|
+
} else {
|
|
606
|
+
return res.render(
|
|
607
|
+
____0.strings[12],
|
|
608
|
+
{
|
|
609
|
+
permissions: route.require.permissions.join(','),
|
|
610
|
+
html: `${____0.strings[14]} : ${route.require.permissions.join(',')}`,
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
parser: ____0.strings[17],
|
|
614
|
+
}
|
|
615
|
+
);
|
|
616
|
+
}
|
|
470
617
|
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
route.callback(req, res);
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
_0xrrxo.handleServer = async function (req, res) {
|
|
624
|
+
req.obj = {};
|
|
625
|
+
req.query = {};
|
|
626
|
+
req.queryRaw = {};
|
|
627
|
+
req.data = req.body = {};
|
|
628
|
+
req.bodyRaw = '';
|
|
629
|
+
req.params = {};
|
|
630
|
+
req.paramsRaw = {};
|
|
631
|
+
req.features = [];
|
|
632
|
+
req.addFeature = function (name) {
|
|
633
|
+
req.features.push(name);
|
|
471
634
|
};
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
}
|
|
480
|
-
let route = {};
|
|
481
|
-
if (typeof r == 'string') {
|
|
482
|
-
route = {
|
|
483
|
-
name: r,
|
|
484
|
-
method: type,
|
|
485
|
-
callback: callback || _0xrrxo.defaultCallback,
|
|
486
|
-
};
|
|
487
|
-
} else {
|
|
488
|
-
route = r;
|
|
489
|
-
|
|
490
|
-
if (Array.isArray(r.name)) {
|
|
491
|
-
r.name.forEach((n) => {
|
|
492
|
-
let sub_route = { ...route };
|
|
493
|
-
sub_route.name = n;
|
|
494
|
-
_0xrrxo.onREQUEST(type, sub_route, callback);
|
|
495
|
-
});
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
498
|
-
route.callback = route.callback || callback || _0xrrxo.defaultCallback;
|
|
635
|
+
req.hasFeature = function (name) {
|
|
636
|
+
return req.features.some((f) => f.like(name));
|
|
637
|
+
};
|
|
638
|
+
req.removeFeature = function (name) {
|
|
639
|
+
req.features.forEach((f, i) => {
|
|
640
|
+
if (f.like(name)) {
|
|
641
|
+
req.features.splice(i, 1);
|
|
499
642
|
}
|
|
500
|
-
|
|
501
|
-
_0xrrxo.add(route);
|
|
643
|
+
});
|
|
502
644
|
};
|
|
503
645
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
646
|
+
res.code = null;
|
|
647
|
+
req.socket.remoteAddress = req.socket.remoteAddress || '';
|
|
648
|
+
req.acceptEncoding = req.headers[____0.strings[5]] ? req.headers[____0.strings[5]] : '';
|
|
649
|
+
res.ip = req.ip = req.headers[____0.strings[6]] ? req.headers[____0.strings[6]] : req.socket.remoteAddress.replace('::ffff:', '');
|
|
650
|
+
res.ip2 = req.ip2 = req.socket.localAddress.replace('::ffff:', '');
|
|
651
|
+
res.port = req.port = req.socket.remotePort;
|
|
652
|
+
res.port2 = req.port2 = req.socket.localPort;
|
|
653
|
+
res.cookies = res.cookie = req.cookies = req.cookie = ____0.cookie(req, res, ____0);
|
|
654
|
+
|
|
655
|
+
req.urlRaw = req.url;
|
|
656
|
+
req.urlParserRaw = ____0.url.parse(req.urlRaw, !0);
|
|
657
|
+
req.urlParser = ____0.url.parse(req.urlRaw.toLowerCase(), !0);
|
|
658
|
+
|
|
659
|
+
res.set = (a, b, c) => {
|
|
660
|
+
if (res.writeHeadEnabled === !1 || res.finished === !0 || res.headersSent) {
|
|
661
|
+
return res;
|
|
662
|
+
}
|
|
663
|
+
if (typeof b == 'string') {
|
|
664
|
+
res.headers = res.headers || [];
|
|
665
|
+
res.headers[a] = b.toLowerCase();
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
res.setHeader(a, b, c);
|
|
669
|
+
return res;
|
|
512
670
|
};
|
|
513
|
-
|
|
514
|
-
|
|
671
|
+
res.delete = res.remove = res.removeHeader;
|
|
672
|
+
res.writeHead0 = res.writeHead;
|
|
673
|
+
res.writeHeadEnabled = !0;
|
|
674
|
+
res.writeHead = (code, obj) => {
|
|
675
|
+
if (res.writeHeadEnabled === !1 || res.finished === !0) {
|
|
676
|
+
return res;
|
|
677
|
+
}
|
|
678
|
+
res.cookie.write();
|
|
679
|
+
res.writeHeadEnabled = !1;
|
|
680
|
+
res.writeHead0(code, obj);
|
|
681
|
+
return res;
|
|
515
682
|
};
|
|
516
683
|
|
|
517
|
-
|
|
518
|
-
|
|
684
|
+
res.ending = (time, ...data) => {
|
|
685
|
+
if (!time) {
|
|
686
|
+
time = 0;
|
|
687
|
+
}
|
|
688
|
+
setTimeout(function () {
|
|
689
|
+
res.end(...data);
|
|
690
|
+
}, time);
|
|
519
691
|
};
|
|
520
692
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
693
|
+
res.end0 = res.end;
|
|
694
|
+
res.end = function (arg1, arg2, arg3, arg4) {
|
|
695
|
+
if (typeof arg1 === 'number') {
|
|
696
|
+
res.writeHead(arg1);
|
|
697
|
+
return res.end0();
|
|
698
|
+
} else {
|
|
699
|
+
if (
|
|
700
|
+
arg1 &&
|
|
701
|
+
res.headers &&
|
|
702
|
+
res.headers[____0.strings[7]] &&
|
|
703
|
+
(res.headers[____0.strings[7]].like('*text/css*') || res.headers[____0.strings[7]].like('*application/javascript*') || res.headers[____0.strings[7]].like('*text/html*') || res.headers[____0.strings[7]].like('*text/plain*') || res.headers[____0.strings[7]].like('*application/json*'))
|
|
704
|
+
) {
|
|
705
|
+
if (req.acceptEncoding.match(/\bdeflate\b/) && typeof arg1 === 'string') {
|
|
706
|
+
res.set(____0.strings[8], 'deflate');
|
|
707
|
+
res.set('Vary', ____0.strings[5]);
|
|
708
|
+
arg1 = ____0.zlib.deflateSync(Buffer.from(arg1));
|
|
709
|
+
} else if (req.acceptEncoding.match(/\bgzip\b/) && typeof arg1 === 'string') {
|
|
710
|
+
res.set(____0.strings[8], 'gzip');
|
|
711
|
+
res.set('Vary', ____0.strings[5]);
|
|
712
|
+
arg1 = ____0.zlib.gzipSync(Buffer.from(arg1));
|
|
713
|
+
} else {
|
|
714
|
+
// ____0.log(typeof arg1)
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
if (res.headers === undefined || res.headers[____0.strings[7]] === undefined) {
|
|
719
|
+
res.set(____0.strings[7], 'text/plain');
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
res.writeHead(res.code || res.statusCode || 200);
|
|
723
|
+
arg1 = arg1 || ' ';
|
|
724
|
+
return res.end0(arg1, arg2, arg3, arg4);
|
|
725
|
+
}
|
|
553
726
|
};
|
|
554
727
|
|
|
555
|
-
|
|
556
|
-
|
|
728
|
+
res.status = (code) => {
|
|
729
|
+
if (!res.code) {
|
|
730
|
+
res.code = code || 200;
|
|
731
|
+
}
|
|
732
|
+
return res;
|
|
557
733
|
};
|
|
558
734
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
let ok = !0;
|
|
563
|
-
route.require.features.forEach((feature) => {
|
|
564
|
-
if (!req.hasFeature(feature)) {
|
|
565
|
-
ok = !1;
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
if (!ok) {
|
|
569
|
-
res.status(401);
|
|
570
|
-
if (route.name.contains(____0.strings[16])) {
|
|
571
|
-
return res.json({
|
|
572
|
-
done: !1,
|
|
573
|
-
error: ____0.strings[13],
|
|
574
|
-
features: route.require.features,
|
|
575
|
-
});
|
|
576
|
-
} else
|
|
577
|
-
return res.render(
|
|
578
|
-
____0.strings[11],
|
|
579
|
-
{
|
|
580
|
-
features: route.require.features.join(','),
|
|
581
|
-
html: ` ${____0.strings[13]} : ${route.require.features.join(',')}`,
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
parser: ____0.strings[17],
|
|
585
|
-
},
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
735
|
+
res.error = (code) => {
|
|
736
|
+
res.status(code || 404).end();
|
|
737
|
+
};
|
|
589
738
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
permissions: route.require.permissions.join(','),
|
|
610
|
-
html: `${____0.strings[14]} : ${route.require.permissions.join(',')}`,
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
parser: ____0.strings[17],
|
|
614
|
-
},
|
|
615
|
-
);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
}
|
|
739
|
+
res.download2 = (path, name) => {
|
|
740
|
+
if (____0.isFileExistsSync(path)) {
|
|
741
|
+
var stat = ____0.fileStatSync(path);
|
|
742
|
+
if (stat && stat.isFile()) {
|
|
743
|
+
res.writeHead(200, {
|
|
744
|
+
'Content-Type': ____0.getContentType(path),
|
|
745
|
+
'Content-Length': stat.size,
|
|
746
|
+
'Content-Disposition': 'attachment; filename=' + (name || ____0.path.basename(path)),
|
|
747
|
+
});
|
|
748
|
+
var readStream = ____0.fs.createReadStream(path);
|
|
749
|
+
readStream.on('end', function () {
|
|
750
|
+
readStream.close();
|
|
751
|
+
});
|
|
752
|
+
res.on(____0.strings[10], function () {
|
|
753
|
+
readStream.close();
|
|
754
|
+
});
|
|
755
|
+
readStream.pipe(res);
|
|
756
|
+
} else {
|
|
757
|
+
res.error();
|
|
619
758
|
}
|
|
620
|
-
|
|
759
|
+
} else {
|
|
760
|
+
res.error();
|
|
761
|
+
}
|
|
621
762
|
};
|
|
622
763
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
req.removeFeature = function (name) {
|
|
639
|
-
req.features.forEach((f, i) => {
|
|
640
|
-
if (f.like(name)) {
|
|
641
|
-
req.features.splice(i, 1);
|
|
642
|
-
}
|
|
764
|
+
res.download = function (path, name) {
|
|
765
|
+
if (____0.isFileExistsSync(path)) {
|
|
766
|
+
const stat = ____0.fileStatSync(path);
|
|
767
|
+
if (stat && stat.isFile()) {
|
|
768
|
+
const fileSize = stat.size;
|
|
769
|
+
const range = req.headers.range;
|
|
770
|
+
if (range) {
|
|
771
|
+
const parts = range.replace(/bytes=/, '').split('-');
|
|
772
|
+
const start = parseInt(parts[0], 10);
|
|
773
|
+
const end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
|
|
774
|
+
|
|
775
|
+
const chunksize = end - start + 1;
|
|
776
|
+
const readStream = ____0.fs.createReadStream(path, {
|
|
777
|
+
start,
|
|
778
|
+
end,
|
|
643
779
|
});
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
res.code = null;
|
|
647
|
-
req.acceptEncoding = req.headers[____0.strings[5]] ? req.headers[____0.strings[5]] : '';
|
|
648
|
-
res.ip = req.ip = req.headers[____0.strings[6]] ? req.headers[____0.strings[6]] : req.socket.remoteAddress.replace('::ffff:', '');
|
|
649
|
-
res.ip2 = req.ip2 = req.socket.localAddress.replace('::ffff:', '');
|
|
650
|
-
res.port = req.port = req.socket.remotePort;
|
|
651
|
-
res.port2 = req.port2 = req.socket.localPort;
|
|
652
|
-
res.cookies = res.cookie = req.cookies = req.cookie = ____0.cookie(req, res, ____0);
|
|
653
|
-
|
|
654
|
-
req.urlRaw = req.url;
|
|
655
|
-
req.urlParserRaw = ____0.url.parse(req.urlRaw, !0);
|
|
656
|
-
req.urlParser = ____0.url.parse(req.urlRaw.toLowerCase(), !0);
|
|
657
|
-
|
|
658
|
-
res.set = (a, b, c) => {
|
|
659
|
-
if (res.writeHeadEnabled === !1 || res.finished === !0 || res.headersSent) {
|
|
660
|
-
return res;
|
|
661
|
-
}
|
|
662
|
-
if (typeof b == 'string') {
|
|
663
|
-
res.headers = res.headers || [];
|
|
664
|
-
res.headers[a] = b.toLowerCase();
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
res.setHeader(a, b, c);
|
|
668
|
-
return res;
|
|
669
|
-
};
|
|
670
|
-
res.delete = res.remove = res.removeHeader;
|
|
671
|
-
res.writeHead0 = res.writeHead;
|
|
672
|
-
res.writeHeadEnabled = !0;
|
|
673
|
-
res.writeHead = (code, obj) => {
|
|
674
|
-
if (res.writeHeadEnabled === !1 || res.finished === !0) {
|
|
675
|
-
return res;
|
|
676
|
-
}
|
|
677
|
-
res.cookie.write();
|
|
678
|
-
res.writeHeadEnabled = !1;
|
|
679
|
-
res.writeHead0(code, obj);
|
|
680
|
-
return res;
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
res.ending = (time, ...data) => {
|
|
684
|
-
if (!time) {
|
|
685
|
-
time = 0;
|
|
686
|
-
}
|
|
687
|
-
setTimeout(function () {
|
|
688
|
-
res.end(...data);
|
|
689
|
-
}, time);
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
res.end0 = res.end;
|
|
693
|
-
res.end = function (arg1, arg2, arg3, arg4) {
|
|
694
|
-
if (typeof arg1 === 'number') {
|
|
695
|
-
res.writeHead(arg1);
|
|
696
|
-
return res.end0();
|
|
697
|
-
} else {
|
|
698
|
-
if (
|
|
699
|
-
arg1 &&
|
|
700
|
-
res.headers &&
|
|
701
|
-
res.headers[____0.strings[7]] &&
|
|
702
|
-
(res.headers[____0.strings[7]].like('*text/css*') ||
|
|
703
|
-
res.headers[____0.strings[7]].like('*application/javascript*') ||
|
|
704
|
-
res.headers[____0.strings[7]].like('*text/html*') ||
|
|
705
|
-
res.headers[____0.strings[7]].like('*text/plain*') ||
|
|
706
|
-
res.headers[____0.strings[7]].like('*application/json*'))
|
|
707
|
-
) {
|
|
708
|
-
if (req.acceptEncoding.match(/\bdeflate\b/) && typeof arg1 === 'string') {
|
|
709
|
-
res.set(____0.strings[8], 'deflate');
|
|
710
|
-
res.set('Vary', ____0.strings[5]);
|
|
711
|
-
arg1 = ____0.zlib.deflateSync(Buffer.from(arg1));
|
|
712
|
-
} else if (req.acceptEncoding.match(/\bgzip\b/) && typeof arg1 === 'string') {
|
|
713
|
-
res.set(____0.strings[8], 'gzip');
|
|
714
|
-
res.set('Vary', ____0.strings[5]);
|
|
715
|
-
arg1 = ____0.zlib.gzipSync(Buffer.from(arg1));
|
|
716
|
-
} else {
|
|
717
|
-
// ____0.log(typeof arg1)
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
if (res.headers === undefined || res.headers[____0.strings[7]] === undefined) {
|
|
722
|
-
res.set(____0.strings[7], 'text/plain');
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
res.writeHead(res.code || res.statusCode || 200);
|
|
726
|
-
arg1 = arg1 || ' ';
|
|
727
|
-
return res.end0(arg1, arg2, arg3, arg4);
|
|
728
|
-
}
|
|
729
|
-
};
|
|
730
|
-
|
|
731
|
-
res.status = (code) => {
|
|
732
|
-
if (!res.code) {
|
|
733
|
-
res.code = code || 200;
|
|
734
|
-
}
|
|
735
|
-
return res;
|
|
736
|
-
};
|
|
737
|
-
|
|
738
|
-
res.error = (code) => {
|
|
739
|
-
res.status(code || 404).end();
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
res.download2 = (path, name) => {
|
|
743
|
-
if (____0.isFileExistsSync(path)) {
|
|
744
|
-
var stat = ____0.fileStatSync(path);
|
|
745
|
-
if (stat && stat.isFile()) {
|
|
746
|
-
res.writeHead(200, {
|
|
747
|
-
'Content-Type': ____0.getContentType(path),
|
|
748
|
-
'Content-Length': stat.size,
|
|
749
|
-
'Content-Disposition': 'attachment; filename=' + (name || ____0.path.basename(path)),
|
|
750
|
-
});
|
|
751
|
-
var readStream = ____0.fs.createReadStream(path);
|
|
752
|
-
readStream.on('end', function () {
|
|
753
|
-
readStream.close();
|
|
754
|
-
});
|
|
755
|
-
res.on(____0.strings[10], function () {
|
|
756
|
-
readStream.close();
|
|
757
|
-
});
|
|
758
|
-
readStream.pipe(res);
|
|
759
|
-
} else {
|
|
760
|
-
res.error();
|
|
761
|
-
}
|
|
762
|
-
} else {
|
|
763
|
-
res.error();
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
res.download = function (path, name) {
|
|
768
|
-
if (____0.isFileExistsSync(path)) {
|
|
769
|
-
const stat = ____0.fileStatSync(path);
|
|
770
|
-
if (stat && stat.isFile()) {
|
|
771
|
-
const fileSize = stat.size;
|
|
772
|
-
const range = req.headers.range;
|
|
773
|
-
if (range) {
|
|
774
|
-
const parts = range.replace(/bytes=/, '').split('-');
|
|
775
|
-
const start = parseInt(parts[0], 10);
|
|
776
|
-
const end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
|
|
777
|
-
|
|
778
|
-
const chunksize = end - start + 1;
|
|
779
|
-
const readStream = ____0.fs.createReadStream(path, {
|
|
780
|
-
start,
|
|
781
|
-
end,
|
|
782
|
-
});
|
|
783
|
-
readStream.on('end', function () {
|
|
784
|
-
readStream.close();
|
|
785
|
-
});
|
|
786
|
-
res.on(____0.strings[10], function () {
|
|
787
|
-
readStream.close();
|
|
788
|
-
});
|
|
789
|
-
res.writeHead(206, {
|
|
790
|
-
'Content-Range': `bytes ${start}-${end}/${fileSize}`,
|
|
791
|
-
'Accept-Ranges': 'bytes',
|
|
792
|
-
'Content-Length': chunksize,
|
|
793
|
-
'Content-Type': ____0.getContentType(path),
|
|
794
|
-
});
|
|
795
|
-
readStream.pipe(res);
|
|
796
|
-
} else {
|
|
797
|
-
const readStream = ____0.fs.createReadStream(path);
|
|
798
|
-
readStream.on('end', function () {
|
|
799
|
-
readStream.close();
|
|
800
|
-
});
|
|
801
|
-
res.on(____0.strings[10], function () {
|
|
802
|
-
readStream.close();
|
|
803
|
-
});
|
|
804
|
-
|
|
805
|
-
res.writeHead(200, {
|
|
806
|
-
'Content-Length': fileSize,
|
|
807
|
-
'Content-Type': ____0.getContentType(path),
|
|
808
|
-
'Content-Disposition': 'attachment; filename=' + (name || ____0.path.basename(path)),
|
|
809
|
-
});
|
|
810
|
-
____0.fs.createReadStream(path).pipe(res);
|
|
811
|
-
}
|
|
812
|
-
} else {
|
|
813
|
-
res.error();
|
|
814
|
-
}
|
|
815
|
-
} else {
|
|
816
|
-
res.error();
|
|
817
|
-
}
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
res.html = res.render = function (name, _data, options) {
|
|
821
|
-
____0.fsm.getContent(name, (content) => {
|
|
822
|
-
if (!content) {
|
|
823
|
-
if (_data && _data.html) {
|
|
824
|
-
return res.status(404).htmlContent(_data.html);
|
|
825
|
-
} else {
|
|
826
|
-
return res.status(404).end();
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
options = options || {};
|
|
831
|
-
req.content = content;
|
|
832
|
-
req.data = { ...req.data, ..._data };
|
|
833
|
-
req.route = req.route || {};
|
|
834
|
-
req.route = { ...req.route, ...options };
|
|
835
|
-
if (req.route.parser) {
|
|
836
|
-
req.content = ____0.parser(req, res, ____0, req.route).html(req.content);
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
res.status(200);
|
|
840
|
-
|
|
841
|
-
if (req.route.compress) {
|
|
842
|
-
req.content = req.content.replace(/\r?\n|\r/g, ' ').replace(/\s+/g, ' ');
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
if (name.endsWith('.css')) {
|
|
846
|
-
res.set(____0.strings[7], 'text/css');
|
|
847
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
848
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.css);
|
|
849
|
-
}
|
|
850
|
-
} else if (name.endsWith('.js')) {
|
|
851
|
-
res.set(____0.strings[7], 'application/javascript');
|
|
852
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
853
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
|
|
854
|
-
}
|
|
855
|
-
} else if (name.endsWith('.html')) {
|
|
856
|
-
res.set(____0.strings[7], 'text/html');
|
|
857
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
858
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
|
|
859
|
-
}
|
|
860
|
-
} else if (name.endsWith('.txt')) {
|
|
861
|
-
res.set(____0.strings[7], 'text/plain');
|
|
862
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
863
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
|
|
864
|
-
}
|
|
865
|
-
} else if (name.endsWith('.json')) {
|
|
866
|
-
res.set(____0.strings[7], 'application/json');
|
|
867
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
868
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
|
|
869
|
-
}
|
|
870
|
-
} else if (name.endsWith('.xml')) {
|
|
871
|
-
res.set(____0.strings[7], 'text/xml');
|
|
872
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
873
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
|
|
874
|
-
}
|
|
875
|
-
} else if (name.endsWith('.woff2')) {
|
|
876
|
-
res.set(____0.strings[7], 'application/font-woff2');
|
|
877
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
878
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
879
|
-
}
|
|
880
|
-
} else if (name.endsWith('.woff')) {
|
|
881
|
-
res.set(____0.strings[7], 'application/font-woff');
|
|
882
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
883
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
884
|
-
}
|
|
885
|
-
} else if (name.endsWith('.ttf')) {
|
|
886
|
-
res.set(____0.strings[7], 'application/font-ttf');
|
|
887
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
888
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
889
|
-
}
|
|
890
|
-
} else if (name.endsWith('.svg')) {
|
|
891
|
-
res.set(____0.strings[7], 'application/font-svg');
|
|
892
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
893
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
894
|
-
}
|
|
895
|
-
} else if (name.endsWith('.otf')) {
|
|
896
|
-
res.set(____0.strings[7], 'application/font-otf');
|
|
897
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
898
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
899
|
-
}
|
|
900
|
-
} else if (name.endsWith('.eot')) {
|
|
901
|
-
res.set(____0.strings[7], 'application/font-eot');
|
|
902
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
903
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
904
|
-
}
|
|
905
|
-
} else if (name.endsWith('.gif')) {
|
|
906
|
-
res.set(____0.strings[7], 'image/gif');
|
|
907
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
908
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
909
|
-
}
|
|
910
|
-
} else if (name.endsWith('.png')) {
|
|
911
|
-
res.set(____0.strings[7], 'image/png');
|
|
912
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
913
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
914
|
-
}
|
|
915
|
-
} else if (name.endsWith('.jpg')) {
|
|
916
|
-
res.set(____0.strings[7], 'image/jpg');
|
|
917
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
918
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
919
|
-
}
|
|
920
|
-
} else if (name.endsWith('.jpeg')) {
|
|
921
|
-
res.set(____0.strings[7], 'image/jpeg');
|
|
922
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
923
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
924
|
-
}
|
|
925
|
-
} else if (name.endsWith('.ico')) {
|
|
926
|
-
res.set(____0.strings[7], 'image/ico');
|
|
927
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
928
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
929
|
-
}
|
|
930
|
-
} else if (name.endsWith('.bmp')) {
|
|
931
|
-
res.set(____0.strings[7], 'image/bmp');
|
|
932
|
-
if (____0.options.cache.enabled && req.route.cache) {
|
|
933
|
-
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
res.end(req.content, ____0.getFileEncode(name));
|
|
780
|
+
readStream.on('end', function () {
|
|
781
|
+
readStream.close();
|
|
937
782
|
});
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
res.css = (name, _data) => {
|
|
941
|
-
____0.fsm.getContent(name, (content) => {
|
|
942
|
-
if (!content) {
|
|
943
|
-
return res.status(404).end();
|
|
944
|
-
}
|
|
945
|
-
req.route.content = content;
|
|
946
|
-
if (req.route.encript && req.route.encript === '123') {
|
|
947
|
-
req.route.content = ____0.f1(req.route.content);
|
|
948
|
-
}
|
|
949
|
-
req.data = { ...req.data, ..._data };
|
|
950
|
-
req.route.parser = 'css';
|
|
951
|
-
let out = ____0.parser(req, res, ____0, req.route).css(req.route.content);
|
|
952
|
-
res.set(____0.strings[7], 'text/css');
|
|
953
|
-
res.status(200).end(out);
|
|
783
|
+
res.on(____0.strings[10], function () {
|
|
784
|
+
readStream.close();
|
|
954
785
|
});
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
return res.status(404).end();
|
|
961
|
-
}
|
|
962
|
-
req.route.content = content;
|
|
963
|
-
if (req.route.encript && req.route.encript === '123') {
|
|
964
|
-
req.route.content = ____0.f1(req.route.content);
|
|
965
|
-
}
|
|
966
|
-
req.data = { ...req.data, ..._data };
|
|
967
|
-
req.route.parser = 'js';
|
|
968
|
-
let out = ____0.parser(req, res, ____0, req.route).js(req.route.content);
|
|
969
|
-
res.set(____0.strings[7], 'text/js');
|
|
970
|
-
res.status(200).end(out);
|
|
786
|
+
res.writeHead(206, {
|
|
787
|
+
'Content-Range': `bytes ${start}-${end}/${fileSize}`,
|
|
788
|
+
'Accept-Ranges': 'bytes',
|
|
789
|
+
'Content-Length': chunksize,
|
|
790
|
+
'Content-Type': ____0.getContentType(path),
|
|
971
791
|
});
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
if (req.route.encript && req.route.encript === '123') {
|
|
981
|
-
req.route.content = ____0.f1(req.route.content);
|
|
982
|
-
}
|
|
983
|
-
req.data = { ...req.data, ..._data };
|
|
984
|
-
req.route.parser = 'json';
|
|
985
|
-
let out = ____0.parser(req, res, ____0, req.route).html(req.route.content);
|
|
986
|
-
res.set(____0.strings[7], 'application/json');
|
|
987
|
-
res.status(200).end(out);
|
|
792
|
+
readStream.pipe(res);
|
|
793
|
+
} else {
|
|
794
|
+
const readStream = ____0.fs.createReadStream(path);
|
|
795
|
+
readStream.on('end', function () {
|
|
796
|
+
readStream.close();
|
|
797
|
+
});
|
|
798
|
+
res.on(____0.strings[10], function () {
|
|
799
|
+
readStream.close();
|
|
988
800
|
});
|
|
989
|
-
};
|
|
990
|
-
|
|
991
|
-
res.htmlContent = res.send = (text) => {
|
|
992
|
-
if (typeof text === 'string') {
|
|
993
|
-
res.set(____0.strings[7], 'text/html');
|
|
994
|
-
res.status(200).end(text);
|
|
995
|
-
} else {
|
|
996
|
-
res.json(text);
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
|
|
1000
|
-
res.json = (obj, time) => {
|
|
1001
|
-
if (typeof obj === 'string') {
|
|
1002
|
-
return res.jsonFile(obj);
|
|
1003
|
-
} else {
|
|
1004
|
-
res.set(____0.strings[7], 'application/json');
|
|
1005
|
-
return res.status(200).ending(time || 0, ____0.toJson(obj));
|
|
1006
|
-
}
|
|
1007
|
-
};
|
|
1008
|
-
|
|
1009
|
-
res.redirect = (url) => {
|
|
1010
|
-
res.set('Location', url);
|
|
1011
|
-
res.status(302).end();
|
|
1012
|
-
};
|
|
1013
801
|
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
802
|
+
res.writeHead(200, {
|
|
803
|
+
'Content-Length': fileSize,
|
|
804
|
+
'Content-Type': ____0.getContentType(path),
|
|
805
|
+
'Content-Disposition': 'attachment; filename=' + (name || ____0.path.basename(path)),
|
|
806
|
+
});
|
|
807
|
+
____0.fs.createReadStream(path).pipe(res);
|
|
808
|
+
}
|
|
809
|
+
} else {
|
|
810
|
+
res.error();
|
|
1021
811
|
}
|
|
812
|
+
} else {
|
|
813
|
+
res.error();
|
|
814
|
+
}
|
|
815
|
+
};
|
|
1022
816
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
res.set(____0.strings[1], 'true');
|
|
1032
|
-
res.status(402);
|
|
1033
|
-
if (req.url.like('*api')) {
|
|
1034
|
-
return res.json({
|
|
1035
|
-
done: false,
|
|
1036
|
-
error: ____0.strings[3],
|
|
1037
|
-
});
|
|
1038
|
-
} else {
|
|
1039
|
-
return res.render(
|
|
1040
|
-
____0.strings[2],
|
|
1041
|
-
{
|
|
1042
|
-
html: ____0.strings[3],
|
|
1043
|
-
},
|
|
1044
|
-
{
|
|
1045
|
-
parser: ____0.strings[17],
|
|
1046
|
-
},
|
|
1047
|
-
);
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
817
|
+
res.html = res.render = function (name, _data, options) {
|
|
818
|
+
____0.fsm.getContent(name, (content) => {
|
|
819
|
+
if (!content) {
|
|
820
|
+
if (_data && _data.html) {
|
|
821
|
+
return res.status(404).htmlContent(_data.html);
|
|
822
|
+
} else {
|
|
823
|
+
return res.status(404).end();
|
|
824
|
+
}
|
|
1050
825
|
}
|
|
1051
826
|
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
res.set('help-request-count', r.count);
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
req.route = r;
|
|
1064
|
-
|
|
1065
|
-
req.urlParser.arr = req.urlParser.pathname.split('/');
|
|
1066
|
-
req.urlParserRaw.arr = req.urlParserRaw.pathname.split('/');
|
|
827
|
+
options = options || {};
|
|
828
|
+
req.content = content;
|
|
829
|
+
req.data = { ...req.data, ..._data };
|
|
830
|
+
req.route = req.route || {};
|
|
831
|
+
req.route = { ...req.route, ...options };
|
|
832
|
+
if (req.route.parser) {
|
|
833
|
+
req.content = ____0.parser(req, res, ____0, req.route).html(req.content);
|
|
834
|
+
}
|
|
1067
835
|
|
|
1068
|
-
|
|
1069
|
-
let map = req.route.map[i];
|
|
1070
|
-
req.params[map.name] = req.urlParser.arr[map.index];
|
|
1071
|
-
req.paramsRaw[map.name] = req.urlParserRaw.arr[map.index];
|
|
1072
|
-
}
|
|
836
|
+
res.status(200);
|
|
1073
837
|
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/urlencoded/i)) {
|
|
1078
|
-
req.on('data', function (data) {
|
|
1079
|
-
req.bodyRaw += data;
|
|
1080
|
-
});
|
|
1081
|
-
req.on('end', function () {
|
|
1082
|
-
req.dataRaw = req.bodyRaw;
|
|
1083
|
-
req.data = req.body = ____0.querystring.parse(req.bodyRaw);
|
|
1084
|
-
if (____0.options.session.enabled) {
|
|
1085
|
-
____0.session(req, res, ____0, function (session) {
|
|
1086
|
-
req.session = session;
|
|
1087
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1088
|
-
});
|
|
1089
|
-
} else {
|
|
1090
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
1093
|
-
} else if (req.method.contains('post') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].contains('multipart')) {
|
|
1094
|
-
let form = ____0.formidable({
|
|
1095
|
-
multiples: !0,
|
|
1096
|
-
uploadDir: ____0.options.upload_dir,
|
|
1097
|
-
});
|
|
1098
|
-
|
|
1099
|
-
form.parse(req, (err, fields, files) => {
|
|
1100
|
-
if (err) {
|
|
1101
|
-
____0.log(err);
|
|
1102
|
-
}
|
|
1103
|
-
req.form = { err, fields, files };
|
|
1104
|
-
req.data = req.body = fields || {};
|
|
1105
|
-
req.files = files;
|
|
1106
|
-
if (____0.options.session.enabled) {
|
|
1107
|
-
____0.session(req, res, ____0, function (session) {
|
|
1108
|
-
req.session = session;
|
|
1109
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1110
|
-
});
|
|
1111
|
-
} else {
|
|
1112
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1113
|
-
}
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1116
|
-
return;
|
|
1117
|
-
} else if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/json/i)) {
|
|
1118
|
-
req.on('data', function (data) {
|
|
1119
|
-
req.bodyRaw += data;
|
|
1120
|
-
});
|
|
1121
|
-
req.on('end', function () {
|
|
1122
|
-
req.dataRaw = req.bodyRaw;
|
|
1123
|
-
req.data = req.body = ____0.fromJson(req.bodyRaw);
|
|
1124
|
-
if (____0.options.session.enabled) {
|
|
1125
|
-
____0.session(req, res, ____0, function (session) {
|
|
1126
|
-
req.session = session;
|
|
1127
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1128
|
-
});
|
|
1129
|
-
} else {
|
|
1130
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1131
|
-
}
|
|
1132
|
-
});
|
|
1133
|
-
} else if (!req.method.toLowerCase().like('get')) {
|
|
1134
|
-
req.on('data', function (data) {
|
|
1135
|
-
req.bodyRaw += data;
|
|
1136
|
-
});
|
|
1137
|
-
req.on('end', function () {
|
|
1138
|
-
req.dataRaw = req.bodyRaw;
|
|
1139
|
-
req.data = req.body = ____0.fromJson(req.bodyRaw);
|
|
1140
|
-
if (____0.options.session.enabled) {
|
|
1141
|
-
____0.session(req, res, ____0, function (session) {
|
|
1142
|
-
req.session = session;
|
|
1143
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1144
|
-
});
|
|
1145
|
-
} else {
|
|
1146
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1149
|
-
} else {
|
|
1150
|
-
req.body = req.data = req.query;
|
|
1151
|
-
req.bodyRaw = req.dataRaw = req.queryRaw;
|
|
1152
|
-
|
|
1153
|
-
if (____0.options.session.enabled) {
|
|
1154
|
-
____0.session(req, res, ____0, function (session) {
|
|
1155
|
-
req.session = session;
|
|
1156
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1157
|
-
});
|
|
1158
|
-
} else {
|
|
1159
|
-
_0xrrxo.handleRoute(req, res, r);
|
|
1160
|
-
}
|
|
1161
|
-
return;
|
|
1162
|
-
}
|
|
838
|
+
if (req.route.compress) {
|
|
839
|
+
req.content = req.content.replace(/\r?\n|\r/g, ' ').replace(/\s+/g, ' ');
|
|
840
|
+
}
|
|
1163
841
|
|
|
1164
|
-
|
|
842
|
+
if (name.endsWith('.css')) {
|
|
843
|
+
res.set(____0.strings[7], 'text/css');
|
|
844
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
845
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.css);
|
|
846
|
+
}
|
|
847
|
+
} else if (name.endsWith('.js')) {
|
|
848
|
+
res.set(____0.strings[7], 'application/javascript');
|
|
849
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
850
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.js);
|
|
851
|
+
}
|
|
852
|
+
} else if (name.endsWith('.html')) {
|
|
853
|
+
res.set(____0.strings[7], 'text/html');
|
|
854
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
855
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.html);
|
|
856
|
+
}
|
|
857
|
+
} else if (name.endsWith('.txt')) {
|
|
858
|
+
res.set(____0.strings[7], 'text/plain');
|
|
859
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
860
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.txt);
|
|
861
|
+
}
|
|
862
|
+
} else if (name.endsWith('.json')) {
|
|
863
|
+
res.set(____0.strings[7], 'application/json');
|
|
864
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
865
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.json);
|
|
866
|
+
}
|
|
867
|
+
} else if (name.endsWith('.xml')) {
|
|
868
|
+
res.set(____0.strings[7], 'text/xml');
|
|
869
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
870
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.xml);
|
|
871
|
+
}
|
|
872
|
+
} else if (name.endsWith('.woff2')) {
|
|
873
|
+
res.set(____0.strings[7], 'application/font-woff2');
|
|
874
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
875
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
876
|
+
}
|
|
877
|
+
} else if (name.endsWith('.woff')) {
|
|
878
|
+
res.set(____0.strings[7], 'application/font-woff');
|
|
879
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
880
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
881
|
+
}
|
|
882
|
+
} else if (name.endsWith('.ttf')) {
|
|
883
|
+
res.set(____0.strings[7], 'application/font-ttf');
|
|
884
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
885
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
886
|
+
}
|
|
887
|
+
} else if (name.endsWith('.svg')) {
|
|
888
|
+
res.set(____0.strings[7], 'application/font-svg');
|
|
889
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
890
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
891
|
+
}
|
|
892
|
+
} else if (name.endsWith('.otf')) {
|
|
893
|
+
res.set(____0.strings[7], 'application/font-otf');
|
|
894
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
895
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
896
|
+
}
|
|
897
|
+
} else if (name.endsWith('.eot')) {
|
|
898
|
+
res.set(____0.strings[7], 'application/font-eot');
|
|
899
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
900
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.fonts);
|
|
901
|
+
}
|
|
902
|
+
} else if (name.endsWith('.gif')) {
|
|
903
|
+
res.set(____0.strings[7], 'image/gif');
|
|
904
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
905
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
906
|
+
}
|
|
907
|
+
} else if (name.endsWith('.png')) {
|
|
908
|
+
res.set(____0.strings[7], 'image/png');
|
|
909
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
910
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
911
|
+
}
|
|
912
|
+
} else if (name.endsWith('.jpg')) {
|
|
913
|
+
res.set(____0.strings[7], 'image/jpg');
|
|
914
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
915
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
916
|
+
}
|
|
917
|
+
} else if (name.endsWith('.jpeg')) {
|
|
918
|
+
res.set(____0.strings[7], 'image/jpeg');
|
|
919
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
920
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
921
|
+
}
|
|
922
|
+
} else if (name.endsWith('.ico')) {
|
|
923
|
+
res.set(____0.strings[7], 'image/ico');
|
|
924
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
925
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
926
|
+
}
|
|
927
|
+
} else if (name.endsWith('.bmp')) {
|
|
928
|
+
res.set(____0.strings[7], 'image/bmp');
|
|
929
|
+
if (____0.options.cache.enabled && req.route.cache) {
|
|
930
|
+
res.set('Cache-Control', 'public, max-age=' + 60 * ____0.options.cache.images);
|
|
931
|
+
}
|
|
1165
932
|
}
|
|
933
|
+
res.end(req.content, ____0.getFileEncode(name));
|
|
934
|
+
});
|
|
935
|
+
};
|
|
1166
936
|
|
|
1167
|
-
|
|
1168
|
-
|
|
937
|
+
res.css = (name, _data) => {
|
|
938
|
+
____0.fsm.getContent(name, (content) => {
|
|
939
|
+
if (!content) {
|
|
940
|
+
return res.status(404).end();
|
|
941
|
+
}
|
|
942
|
+
req.route.content = content;
|
|
943
|
+
if (req.route.encript && req.route.encript === '123') {
|
|
944
|
+
req.route.content = ____0.f1(req.route.content);
|
|
1169
945
|
}
|
|
946
|
+
req.data = { ...req.data, ..._data };
|
|
947
|
+
req.route.parser = 'css';
|
|
948
|
+
let out = ____0.parser(req, res, ____0, req.route).css(req.route.content);
|
|
949
|
+
res.set(____0.strings[7], 'text/css');
|
|
950
|
+
res.status(200).end(out);
|
|
951
|
+
});
|
|
952
|
+
};
|
|
1170
953
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
res.htmlContent("<h1 align='center'>Base Route / Not Set</h1>");
|
|
1176
|
-
return;
|
|
954
|
+
res.js = (name, _data) => {
|
|
955
|
+
____0.fsm.getContent(name, (content) => {
|
|
956
|
+
if (!content) {
|
|
957
|
+
return res.status(404).end();
|
|
1177
958
|
}
|
|
959
|
+
req.route.content = content;
|
|
960
|
+
if (req.route.encript && req.route.encript === '123') {
|
|
961
|
+
req.route.content = ____0.f1(req.route.content);
|
|
962
|
+
}
|
|
963
|
+
req.data = { ...req.data, ..._data };
|
|
964
|
+
req.route.parser = 'js';
|
|
965
|
+
let out = ____0.parser(req, res, ____0, req.route).js(req.route.content);
|
|
966
|
+
res.set(____0.strings[7], 'text/js');
|
|
967
|
+
res.status(200).end(out);
|
|
968
|
+
});
|
|
969
|
+
};
|
|
1178
970
|
|
|
1179
|
-
|
|
1180
|
-
|
|
971
|
+
res.jsonFile = (name, _data) => {
|
|
972
|
+
____0.fsm.getContent(name, (content) => {
|
|
973
|
+
if (!content) {
|
|
974
|
+
return res.status(404).end();
|
|
1181
975
|
}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
976
|
+
req.route.content = content;
|
|
977
|
+
if (req.route.encript && req.route.encript === '123') {
|
|
978
|
+
req.route.content = ____0.f1(req.route.content);
|
|
1185
979
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
980
|
+
req.data = { ...req.data, ..._data };
|
|
981
|
+
req.route.parser = 'json';
|
|
982
|
+
let out = ____0.parser(req, res, ____0, req.route).html(req.route.content);
|
|
983
|
+
res.set(____0.strings[7], 'application/json');
|
|
984
|
+
res.status(200).end(out);
|
|
985
|
+
});
|
|
1188
986
|
};
|
|
1189
987
|
|
|
1190
|
-
|
|
1191
|
-
|
|
988
|
+
res.htmlContent = res.send = (text) => {
|
|
989
|
+
if (typeof text === 'string') {
|
|
990
|
+
res.set(____0.strings[7], 'text/html');
|
|
991
|
+
res.status(200).end(text);
|
|
992
|
+
} else {
|
|
993
|
+
res.json(text);
|
|
994
|
+
}
|
|
995
|
+
};
|
|
1192
996
|
|
|
1193
|
-
|
|
1194
|
-
|
|
997
|
+
res.json = (obj, time) => {
|
|
998
|
+
if (typeof obj === 'string') {
|
|
999
|
+
return res.jsonFile(obj);
|
|
1000
|
+
} else {
|
|
1001
|
+
res.set(____0.strings[7], 'application/json');
|
|
1002
|
+
return res.status(200).ending(time || 0, ____0.toJson(obj));
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1195
1005
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
ports.some((p0) => p0 == p) || ports.push(p);
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1006
|
+
res.redirect = (url) => {
|
|
1007
|
+
res.set('Location', url);
|
|
1008
|
+
res.status(302).end();
|
|
1009
|
+
};
|
|
1203
1010
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1011
|
+
res.setHeader('CharSet', 'UTF-8');
|
|
1012
|
+
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
1013
|
+
res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'Origin, X-Requested-With, Content-Type, Accept , Access-Token , Authorization');
|
|
1014
|
+
res.setHeader('Access-Control-Allow-Methods', req.headers['access-control-request-method'] || 'POST,GET,DELETE,PUT,OPTIONS,VIEW,HEAD,CONNECT,TRACE');
|
|
1015
|
+
res.setHeader('Access-Control-Allow-Origin', req.headers.host || req.headers.referer || '*');
|
|
1016
|
+
if (req.headers.origin) {
|
|
1017
|
+
res.setHeader('Access-Control-Allow-Origin', req.headers.origin);
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
if (!req.urlParser.pathname.like(____0.strings[0])) {
|
|
1021
|
+
if (!____0._0_a405) {
|
|
1022
|
+
res.status(405);
|
|
1023
|
+
res.end();
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
if (!____0._0_ar2_0_) {
|
|
1028
|
+
res.set(____0.strings[1], 'true');
|
|
1029
|
+
res.status(402);
|
|
1030
|
+
if (req.url.like('*api')) {
|
|
1031
|
+
return res.json({
|
|
1032
|
+
done: false,
|
|
1033
|
+
error: ____0.strings[3],
|
|
1034
|
+
});
|
|
1035
|
+
} else {
|
|
1036
|
+
return res.render(
|
|
1037
|
+
____0.strings[2],
|
|
1038
|
+
{
|
|
1039
|
+
html: ____0.strings[3],
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
parser: ____0.strings[17],
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1210
1045
|
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
let matched_routes = _0xrrxo.list.filter((r) => req.method.toLowerCase().like(r.method.toLowerCase()) && req.urlParser.pathname.like(r.name));
|
|
1050
|
+
if (matched_routes.length > 0) {
|
|
1051
|
+
let r = matched_routes[0];
|
|
1052
|
+
if (!r.count) {
|
|
1053
|
+
r.count = 0;
|
|
1054
|
+
}
|
|
1055
|
+
r.count++;
|
|
1056
|
+
if (____0.options.help) {
|
|
1057
|
+
res.set('help-request-count', r.count);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
req.route = r;
|
|
1061
|
+
|
|
1062
|
+
req.urlParser.arr = req.urlParser.pathname.split('/');
|
|
1063
|
+
req.urlParserRaw.arr = req.urlParserRaw.pathname.split('/');
|
|
1064
|
+
|
|
1065
|
+
for (let i = 0; i < req.route.map.length; i++) {
|
|
1066
|
+
let map = req.route.map[i];
|
|
1067
|
+
req.params[map.name] = req.urlParser.arr[map.index];
|
|
1068
|
+
req.paramsRaw[map.name] = req.urlParserRaw.arr[map.index];
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
req.query = req.urlParser.query;
|
|
1072
|
+
req.queryRaw = req.urlParserRaw.query;
|
|
1073
|
+
|
|
1074
|
+
if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/urlencoded/i)) {
|
|
1075
|
+
req.on('data', function (data) {
|
|
1076
|
+
req.bodyRaw += data;
|
|
1077
|
+
});
|
|
1078
|
+
req.on('end', function () {
|
|
1079
|
+
req.dataRaw = req.bodyRaw;
|
|
1080
|
+
req.data = req.body = ____0.querystring.parse(req.bodyRaw);
|
|
1081
|
+
if (____0.options.session.enabled) {
|
|
1082
|
+
____0.session(req, res, ____0, function (session) {
|
|
1083
|
+
req.session = session;
|
|
1084
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1085
|
+
});
|
|
1086
|
+
} else {
|
|
1087
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
} else if (req.method.contains('post') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].contains('multipart')) {
|
|
1091
|
+
let form = ____0.formidable({
|
|
1092
|
+
multiples: !0,
|
|
1093
|
+
uploadDir: ____0.options.upload_dir,
|
|
1094
|
+
});
|
|
1211
1095
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1096
|
+
form.parse(req, (err, fields, files) => {
|
|
1097
|
+
if (err) {
|
|
1098
|
+
____0.log(err);
|
|
1099
|
+
}
|
|
1100
|
+
req.form = { err, fields, files };
|
|
1101
|
+
req.data = req.body = fields || {};
|
|
1102
|
+
req.files = files;
|
|
1103
|
+
if (____0.options.session.enabled) {
|
|
1104
|
+
____0.session(req, res, ____0, function (session) {
|
|
1105
|
+
req.session = session;
|
|
1106
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1107
|
+
});
|
|
1108
|
+
} else {
|
|
1109
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1110
|
+
}
|
|
1225
1111
|
});
|
|
1226
1112
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1113
|
+
return;
|
|
1114
|
+
} else if (!req.method.toLowerCase().like('get') && req.headers[____0.strings[18]] && req.headers[____0.strings[18]].match(/json/i)) {
|
|
1115
|
+
req.on('data', function (data) {
|
|
1116
|
+
req.bodyRaw += data;
|
|
1117
|
+
});
|
|
1118
|
+
req.on('end', function () {
|
|
1119
|
+
req.dataRaw = req.bodyRaw;
|
|
1120
|
+
req.data = req.body = ____0.fromJson(req.bodyRaw);
|
|
1121
|
+
if (____0.options.session.enabled) {
|
|
1122
|
+
____0.session(req, res, ____0, function (session) {
|
|
1123
|
+
req.session = session;
|
|
1124
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1125
|
+
});
|
|
1126
|
+
} else {
|
|
1127
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
} else if (!req.method.toLowerCase().like('get')) {
|
|
1131
|
+
req.on('data', function (data) {
|
|
1132
|
+
req.bodyRaw += data;
|
|
1133
|
+
});
|
|
1134
|
+
req.on('end', function () {
|
|
1135
|
+
req.dataRaw = req.bodyRaw;
|
|
1136
|
+
req.data = req.body = ____0.fromJson(req.bodyRaw);
|
|
1137
|
+
if (____0.options.session.enabled) {
|
|
1138
|
+
____0.session(req, res, ____0, function (session) {
|
|
1139
|
+
req.session = session;
|
|
1140
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1243
1141
|
});
|
|
1142
|
+
} else {
|
|
1143
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
} else {
|
|
1147
|
+
req.body = req.data = req.query;
|
|
1148
|
+
req.bodyRaw = req.dataRaw = req.queryRaw;
|
|
1149
|
+
|
|
1150
|
+
if (____0.options.session.enabled) {
|
|
1151
|
+
____0.session(req, res, ____0, function (session) {
|
|
1152
|
+
req.session = session;
|
|
1153
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1154
|
+
});
|
|
1155
|
+
} else {
|
|
1156
|
+
_0xrrxo.handleRoute(req, res, r);
|
|
1244
1157
|
}
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
if (matched_routes.length > 0) {
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
if (req.urlParser.pathname == '/') {
|
|
1169
|
+
if (____0.options.help) {
|
|
1170
|
+
res.set('help-eror-message', 'unhandled route ' + req.urlParser.pathname);
|
|
1171
|
+
}
|
|
1172
|
+
res.htmlContent("<h1 align='center'>Base Route / Not Set</h1>");
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
if (____0.options.help) {
|
|
1177
|
+
res.set('help-eror-message', 'unhandled route ' + req.urlParser.pathname);
|
|
1178
|
+
}
|
|
1179
|
+
if (req.method.toLowerCase().like('options') || req.method.toLowerCase().like('head')) {
|
|
1180
|
+
res.status(200).end();
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
res.set('help-eror-message', 'unhandled route ' + req.urlParser.pathname);
|
|
1184
|
+
res.status(404).end();
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
____0.servers = [];
|
|
1188
|
+
____0.server = null;
|
|
1189
|
+
|
|
1190
|
+
_0xrrxo.start = function (_ports, callback) {
|
|
1191
|
+
const ports = [];
|
|
1192
|
+
|
|
1193
|
+
if (_ports && ____0.typeof(_ports) !== 'Array') {
|
|
1194
|
+
ports.some((p0) => p0 == _ports) || ports.push(_ports);
|
|
1195
|
+
} else if (_ports && ____0.typeof(_ports) == 'Array') {
|
|
1196
|
+
_ports.forEach((p) => {
|
|
1197
|
+
ports.some((p0) => p0 == p) || ports.push(p);
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
if (____0.options.port && ____0.typeof(____0.options.port) !== 'Array') {
|
|
1202
|
+
ports.some((p0) => p0 == ____0.options.port) || ports.push(____0.options.port);
|
|
1203
|
+
} else if (____0.options.port && ____0.typeof(____0.options.port) == 'Array') {
|
|
1204
|
+
____0.options.port.forEach((p) => {
|
|
1205
|
+
ports.some((p0) => p0 == p) || ports.push(p);
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
ports.forEach((p, i) => {
|
|
1210
|
+
try {
|
|
1211
|
+
let server = ____0.http.createServer(_0xrrxo.handleServer);
|
|
1212
|
+
server.listen(p, function () {
|
|
1213
|
+
let index = ____0.servers.length;
|
|
1214
|
+
____0.servers[index] = server;
|
|
1215
|
+
____0.log('\n-----------------------------------------');
|
|
1216
|
+
____0.log(` ( ${____0.options.name} ) Running on : http://${____0.options.hostname}:${p} `);
|
|
1217
|
+
____0.log('-----------------------------------------\n');
|
|
1218
|
+
});
|
|
1219
|
+
} catch (error) {
|
|
1220
|
+
console.error(error);
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1245
1223
|
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1224
|
+
if (____0.options.https.enabled) {
|
|
1225
|
+
const https_options = {
|
|
1226
|
+
key: ____0.fs.readFileSync(____0.options.https.key || __dirname + '/../ssl/key.pem'),
|
|
1227
|
+
cert: ____0.fs.readFileSync(____0.options.https.cert || __dirname + '/../ssl/cert.pem'),
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
____0.options.https.ports.forEach((p, i) => {
|
|
1231
|
+
let index = ____0.servers.length;
|
|
1232
|
+
____0.servers[index] = ____0.https.createServer(https_options, _0xrrxo.handleServer);
|
|
1233
|
+
____0.servers[index].listen(p, function () {
|
|
1234
|
+
____0.log('');
|
|
1235
|
+
____0.log('-----------------------------------------');
|
|
1236
|
+
____0.log(' ' + ____0.options.name + ' [ https ] Running on Port : ' + p);
|
|
1237
|
+
____0.log('-----------------------------------------');
|
|
1238
|
+
____0.log('');
|
|
1249
1239
|
});
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
____0.servers.forEach((s) => {
|
|
1244
|
+
s.maxHeadersCount = 0;
|
|
1245
|
+
s.timeout = 1000 * 30;
|
|
1246
|
+
});
|
|
1250
1247
|
|
|
1251
|
-
|
|
1248
|
+
____0.server = ____0.servers[0];
|
|
1252
1249
|
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1250
|
+
setTimeout(() => {
|
|
1251
|
+
if (callback) {
|
|
1252
|
+
callback(____0.servers);
|
|
1253
|
+
}
|
|
1254
|
+
____0.call(____0.strings[9]);
|
|
1255
|
+
}, 1000 * 1);
|
|
1259
1256
|
|
|
1260
|
-
|
|
1261
|
-
|
|
1257
|
+
return ____0.server;
|
|
1258
|
+
};
|
|
1262
1259
|
|
|
1263
|
-
|
|
1260
|
+
return _0xrrxo;
|
|
1264
1261
|
};
|