-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.js
111 lines (91 loc) · 3.48 KB
/
settings.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
/**
* Created by Pascal on 27.01.2016.
*/
({
define: typeof define === "function"
? define
: function (A, F) {
module.exports = F.apply(null, A.map(require))
}
}).define([], function () {
function SettingsLoader() {
this.settings = {
"httpServerIP": "nodejs2.csg.uzh.ch",
"httpServerPort": "8080",
"httpServerProtocol": "http",
"lecturerName": "Lecturer",
"roomName": "myRoom",
"notificationSound": "http://nodejs2.csg.uzh.ch/sound.mp3",
"lecturerId": "123456789",
"errWrongRoomPassword": "Password for room is not correct",
"errWrongAdminPassword": "Admin password for room is not correct",
"errNoLecturerInRoom": "No lecturer in room",
"errNicknameInUse": "Nickname is already reserved",
"lecturerHTML": "lecturerRun.html",
"studentsHTML": "students.html"
};
} // EOF class
SettingsLoader.prototype = {
constructor: SettingsLoader,
getHttpServerProtocol: function () {
return this.settings.httpServerProtocol;
},
getHttpServerPort: function() {
return this.settings.httpServerPort;
},
getHttpServerIP: function() {
return this.settings.httpServerIP;
},
getLecturerId: function () {
return this.settings.lecturerId;
},
getNotificationSoundURL: function() {
return this.settings.notificationSound;
},
getLecturerName: function(){
return this.settings.lecturerName;
},
getRoomName: function () {
return this.settings.roomName;
},
getErrWrongRoomPassword: function() {
return this.settings.errWrongRoomPassword;
},
getErrWrongAdminPassword: function() {
return this.settings.errWrongAdminPassword;
},
getErrNoLecturerInRoom: function() {
return this.settings.errNoLecturerInRoom;
},
getErrNicknameInUse: function() {
return this.settings.errNicknameInUse;
},
getLecturerPage: function() {
return this.settings.lecturerHTML;
},
getStudentsPage: function() {
return this.settings.studentsHTML;
},
createWebsocketAddress: function () {
var ip = this.getHttpServerIP();
var port = this.getHttpServerPort();
return ip + ":" + port + "/";
},
createHttpAddress: function () {
var protocol = this.getHttpServerProtocol();
var ip = this.getHttpServerIP();
var port = this.getHttpServerPort();
return protocol + "://" + ip + ":" + port + "/";
},
createLecturerRunHttpAddress: function () {
var url = this.createHttpAddress();
return url + this.getLecturerPage();
},
createStudentsHttpAddress: function () {
var url = this.createHttpAddress();
return url + this.getStudentsPage();
}
}; // prototype
return new SettingsLoader();
}
);