-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsts.js
147 lines (146 loc) · 3.07 KB
/
consts.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
const fs = require('fs');
const consts = {
version:"0.1.51",
http:{
origin:"https://sau-lab.keeer.net",
logFile:"access.log",
realIpHeader:"x-real-ip",
port:50082,
staticDir:__dirname+"/source/",
staticFiles:[
"index.html",
"styles.css"
],
staticDirs:[
"img/"
],
ejsRoot:__dirname+"/source/",
ejsFiles:[
"home",
"home-settings",
"inbox",
"report/new",
"application/new",
"message/new",
"settings",
"messages",
"about",
"associations",
"events",
"users",
"user/new"
],
errorMessage:{
501:"The server has encountered some strange error. Maybe a monster ate the server?",
404:"404. The page wasn't found by any means.",
403:"403 Unauthorized. You are not authorized to view this page.",
400:"400. Your browser has sent us an invalid request, thich we cannot resolve."
}
},
session:{
file:"session.json",
name:"SAUSESSID",
length:64,
expires:20 * 60 * 1000, // 20 min,
clearTimeout:10 * 60 * 1000, //20 min
csrfLength:8,
csrfEncoding:"base64"
},
user:{
file:"users.json",
roles:[
"admin",
"officer",
"association"
],
types:[
"voluntary", //公益
"academic", //学术
"scitech", //科技
"culture", //文化
"art", //艺术
"sports", //体育
"activity", //活动
"room" //定教室
],
typesReverse:{
"voluntary":"公益",
"academic":"学术",
"scitech":"科技",
"culture":"文化",
"art":"艺术",
"sports":"体育",
"activity":"活动",
"room":"定教室"
},
hashMethod:"sha256",
encoding:"base64",
saltSize:64,
defaultOptions:{
admin:{
name:"管理员",
id:"admin",
passwd:"guanli"
},
officer:{
name:"张三",
id:"zhangsan",
type:"room",
passwd:"ganshi"
},
association:{
name:"xx社",
id:"xxclub",
type:"voluntary",
passwd:"shetuan",
contact:{
"社长":"班级 姓名 10086",
"副社长1":"班级 姓名 110",
"副社长2":"班级 姓名 911"
}
}
}
},
report:{
file:"reports.json",
length:16
},
application:{
file:"applications.json",
length:16
},
message:{
file:"messages.json",
length:16
},
files:{
dir:__dirname + "/files/",
file:"files.json",
ext:".file",
idSize:32,
idEncoding:"hex",
maxlength:32 * 1024 * 1024 //32MiB, also change source/partial/upload.ejs
},
home:{
file:"home.json"
},
event:{
logFile:"events.log"
},
db:{
saveInterval:5000 //5 secs
},
wechat:{
sessionFile:__dirname + "/wechat-session.json",
verifyMsg:"sau32nd",
loginTimeout:10000
}
};
const {staticDir,staticFiles} = consts.http;
consts.http.staticDirs.forEach(dir => {
const files = fs.readdirSync(staticDir + dir);
files.forEach(file => {
staticFiles.push(dir + file);
});
});
module.exports = consts;