-
-
Notifications
You must be signed in to change notification settings - Fork 125
/
impress.constants.js
129 lines (115 loc) · 3.43 KB
/
impress.constants.js
1
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
'use strict';
impress.name = 'Impress Application Server';
impress.TPL_NOT_FOUND = 'Warning: template not found: ';
impress.CANT_READ_FILE = 'Can not read file: ';
impress.CANT_READ_DIR = 'Can not read directory: ';
impress.ALREADY_STARTED = 'Status: server is already started';
impress.FILE_EXISTS = 10;
impress.FILE_NOT_FOUND = 11;
impress.FILE_IS_EMPTY = 12;
impress.FILE_PARSE_ERROR = 13;
impress.HTTP_VEBS = [ 'get', 'post', 'put', 'delete' ];
impress.MIME_TYPES = {
html: 'text/html; charset=UTF-8',
txt: 'text/plain; charset=UTF-8',
json: 'application/json; charset=UTF-8',
jsonp: 'application/javascript; charset=UTF-8',
sse: 'text/event-stream; charset=UTF-8',
xml: 'text/xml; charset=UTF-8',
kml: 'application/vnd.google-earth.kml+xml',
csv: 'text/csv; charset=UTF-8',
ajax: 'text/html; charset=UTF-8',
js: 'application/javascript; charset=UTF-8',
wav: 'audio/wav',
mp3: 'audio/mpeg3',
mp4: 'video/mp4',
mid: 'audio/midi',
css: 'text/css',
png: 'image/png',
gif: 'image/gif',
jpg: 'image/jpeg',
jpeg: 'image/jpeg',
ogg: 'audio/ogg',
ico: 'image/x-icon',
manifest: 'text/cache-manifest',
svg: 'image/svg+xml',
svgz: 'image/svg+xml',
tif: 'image/tiff',
tiff: 'image/tiff',
pdf: 'application/pdf',
rtf: 'application/rtf',
'7z': 'application/x-7z-compressed',
rar: 'application/x-rar-compressed',
zip: 'application/zip'
};
impress.COMPRESSED_EXT = [
'gif','jpg','jpe','jpeg','png','svgz',
'docx','xlsx','pptx','dotx','odm','odt','ott','odp','otp','djvu','djv',
'zip','rar','z7','gz','jar','arj',
'iso','nrg','img','apk',
'mp2','mp3','mp4','avi','flv','fla','swf','3gp','mkv','mpeg','mpg','mpe','mov','asf','wmv','vob','ogg'
];
impress.COMPRESS_ABOVE = 256; // static files above this size should be gzipped
impress.STATUS_CODES = api.http.STATUS_CODES;
if (!impress.STATUS_CODES[508]) impress.STATUS_CODES[508] = 'Loop Detected';
impress.DEFAULT_ACCESS = {
guests: true, // allow access for non-authenticated connections (no SID cookie)
logged: true, // allow access for authenticated connections
http: true, // allow via HTTP
https: true, // allow via HTTPS
intro: false, // allow API introspection
virtual: false, // allow virtual folders if true or reply 404 if false
groups: [] // allow access for certain groups (ampty list allows to all)
};
impress.DEFAULT_SANDBOX_MODULES = [
// Node.js modules:
'require',
'console',
'Buffer',
'process',
'setTimeout',
'clearTimeout',
'setInterval',
'clearInterval',
'setImmediate',
'clearImmediate',
// Impress global names:
'db',
'impress',
];
impress.CONFIG_FILES_PRIORITY = [
'sandbox.js',
'log.js',
'scale.js',
'servers.js',
'databases.js',
'sessions.js',
'tasks.js',
'application.js',
'files.js',
'filestorage.js',
'mail.js',
'hosts.js',
'routes.js',
'passport.js'
];
impress.API_ALIASES = {
'geoip': 'geoip-lite',
'zipstream': 'zip-stream',
'stringify': 'json-stringify-safe'
};
impress.ALPHA_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
impress.ALPHA_LOWER = 'abcdefghijklmnopqrstuvwxyz';
impress.ALPHA = impress.ALPHA_UPPER + impress.ALPHA_LOWER;
impress.DIGIT = '0123456789';
impress.ALPHA_DIGIT = impress.ALPHA + impress.DIGIT;
impress.HANDLER_TYPES = {
'': 'dir',
json: 'JSON Handler',
jsonp: 'JSONP Handler',
csv: 'CSV Data',
ajax: 'AJAX Template',
sse: 'Server-Sent Events',
ws: 'WebSocket',
rpc: 'Impress RPC'
};