|
1 | 1 | ;(function(window) { |
2 | | - /** |
3 | | - * Add parameter to url search |
4 | | - * for switch users groups |
5 | | - * |
6 | | - * Possible options: |
7 | | - * https://examples.com?users=prod |
8 | | - * https://examples.com?users=dev |
9 | | - * https://examples.com - for qa by default |
10 | | - */ |
11 | | - var usersQuery = _getQueryVar('users'); |
12 | | - |
13 | | - var CONFIG = { |
14 | | - debug: true, |
15 | | - webrtc: { |
16 | | - answerTimeInterval: 30, |
17 | | - dialingTimeInterval: 5, |
18 | | - disconnectTimeInterval: 30, |
19 | | - statsReportTimeInterval: 5 |
20 | | - } |
21 | | - }; |
22 | | - |
23 | | - /** |
24 | | - * QBAppDefault for qa and dev |
25 | | - * QBAppProd for production |
26 | | - */ |
27 | | - var QBAppProd = { |
28 | | - appId: 92, |
29 | | - authKey: 'wJHdOcQSxXQGWx5', |
30 | | - authSecret: 'BTFsj7Rtt27DAmT' |
31 | | - }, |
32 | | - QBAppDefault = { |
33 | | - appId: 28287, |
34 | | - authKey: 'XydaWcf8OO9xhGT', |
35 | | - authSecret: 'JZfqTspCvELAmnW' |
36 | | - }; |
37 | | - |
38 | | - /** set QBApp */ |
39 | | - var QBApp = usersQuery === 'qa' ? QBAppDefault : usersQuery === 'dev' ? QBAppDefault : QBAppProd; |
40 | | - |
41 | | - var QBUsersQA = [ |
42 | | - { |
43 | | - id: 5395743, |
44 | | - login: 'webuser111', |
45 | | - password: 'webuser111', |
46 | | - full_name: 'User 1', |
47 | | - colour: 'FD8209' |
48 | | - }, |
49 | | - { |
50 | | - id: 5395747, |
51 | | - login: 'webuser112', |
52 | | - password: 'webuser112', |
53 | | - full_name: 'User 2', |
54 | | - colour: '11a209' |
55 | | - }, |
56 | | - { |
57 | | - id: 5681538, |
58 | | - login: 'webuser113', |
59 | | - password: 'webuser113', |
60 | | - full_name: 'User 3', |
61 | | - colour: '11a2a9' |
62 | | - }, |
63 | | - { |
64 | | - id: 5719859, |
65 | | - login: 'webuser114', |
66 | | - password: 'webuser114', |
67 | | - full_name: 'User 4', |
68 | | - colour: '51c209' |
69 | | - }, |
70 | | - { |
71 | | - id: 5719860, |
72 | | - login: 'webuser115', |
73 | | - password: 'webuser115', |
74 | | - full_name: 'User 5', |
75 | | - colour: '511209' |
76 | | - }, |
77 | | - { |
78 | | - id: 5719866, |
79 | | - login: 'webuser116', |
80 | | - password: 'webuser116', |
81 | | - full_name: 'User 6', |
82 | | - colour: '01e209' |
83 | | - } |
84 | | - ], |
85 | | - QBUsersDev = [ |
86 | | - { |
87 | | - id: 6970356, |
88 | | - login: 'dev_user_1', |
89 | | - password: 'dev_user_1', |
90 | | - full_name: 'User 1', |
91 | | - colour: 'ffaa00' |
92 | | - }, |
93 | | - { |
94 | | - id: 6970368, |
95 | | - login: 'dev_user_2', |
96 | | - password: 'dev_user_2', |
97 | | - full_name: 'User 2', |
98 | | - colour: '0890ff' |
99 | | - }, |
100 | | - { |
101 | | - id: 6970375, |
102 | | - login: 'dev_user_3', |
103 | | - password: 'dev_user_3', |
104 | | - full_name: 'User 3', |
105 | | - colour: 'ff03a6' |
106 | | - }, |
107 | | - { |
108 | | - id: 6970379, |
109 | | - login: 'dev_user_4', |
110 | | - password: 'dev_user_4', |
111 | | - full_name: 'User 4', |
112 | | - colour: '60e27a' |
113 | | - } |
114 | | - ], |
115 | | - QBUsersProd = [ |
116 | | - { |
117 | | - id: 2436251, |
118 | | - login: 'webrtc_user1', |
119 | | - password: 'x6Bt0VDy5', |
120 | | - full_name: 'User 1', |
121 | | - colour: 'FD8209' |
122 | | - }, |
123 | | - { |
124 | | - id: 2436254, |
125 | | - login: 'webrtc_user2', |
126 | | - password: 'x6Bt0VDy5', |
127 | | - full_name: 'User 2', |
128 | | - colour: '1765FB' |
129 | | - }, |
130 | | - { |
131 | | - id: 2436257, |
132 | | - login: 'webrtc_user3', |
133 | | - password: 'x6Bt0VDy5', |
134 | | - full_name: 'User 3', |
135 | | - colour: 'F81480' |
136 | | - }, |
137 | | - { |
138 | | - id: 2436258, |
139 | | - login: 'webrtc_user4', |
140 | | - password: 'x6Bt0VDy5', |
141 | | - full_name: 'User 4', |
142 | | - colour: '39A345' |
143 | | - }, |
144 | | - { |
145 | | - id: 2436259, |
146 | | - login: 'webrtc_user5', |
147 | | - password: 'x6Bt0VDy5', |
148 | | - full_name: 'User 5', |
149 | | - colour: '921392' |
150 | | - }, |
151 | | - { |
152 | | - id: 2436262, |
153 | | - login: 'webrtc_user6', |
154 | | - password: 'x6Bt0VDy5', |
155 | | - full_name: 'User 6', |
156 | | - colour: '6594C5' |
157 | | - }, |
158 | | - { |
159 | | - id: 2436263, |
160 | | - login: 'webrtc_user7', |
161 | | - password: 'x6Bt0VDy5', |
162 | | - full_name: 'User 7', |
163 | | - colour: 'C1061E' |
164 | | - }, |
165 | | - { |
166 | | - id: 2436265, |
167 | | - login: 'webrtc_user8', |
168 | | - password: 'x6Bt0VDy5', |
169 | | - full_name: 'User 8', |
170 | | - colour: '898989' |
171 | | - }, |
172 | | - { |
173 | | - id: 2436266, |
174 | | - login: 'webrtc_user9', |
175 | | - password: 'x6Bt0VDy5', |
176 | | - full_name: 'User 9', |
177 | | - colour: 'C7B325' |
178 | | - }, |
179 | | - { |
180 | | - id: 2436269, |
181 | | - login: 'webrtc_user10', |
182 | | - password: 'x6Bt0VDy5', |
183 | | - full_name: 'User 10', |
184 | | - colour: 'BDA0CA' |
185 | | - } |
186 | | - ]; |
187 | | - |
188 | | - /** set QBUsers */ |
189 | | - var QBUsers = usersQuery === 'qa' ? QBUsersQA : usersQuery === 'dev' ? QBUsersDev : QBUsersProd; |
190 | | - |
191 | | - var MESSAGES = { |
192 | | - 'login': 'Login as any user on this computer and another user on another computer.', |
193 | | - 'create_session': 'Creating a session...', |
194 | | - 'connect': 'Connecting...', |
195 | | - 'connect_error': 'Something wrong with connect to chat. Check internet connection or user info and trying again.', |
196 | | - 'login_as': 'Logged in as ', |
197 | | - 'title_login': 'Choose a user to login with:', |
198 | | - 'title_callee': 'Choose users to call:', |
199 | | - 'calling': 'Calling...', |
200 | | - 'webrtc_not_avaible': 'WebRTC is not available in your browser', |
201 | | - 'no_internet': 'Please check your Internet connection and try again' |
202 | | - }; |
203 | | - |
204 | | - /** |
205 | | - * PRIVATE |
206 | | - */ |
207 | | - /** |
208 | | - * [_getQueryVar get value of key from search string of url] |
209 | | - * @param {[string]} q [name of query] |
210 | | - * @return {[string]} [value of query] |
211 | | - */ |
212 | | - function _getQueryVar(q) { |
213 | | - var query = window.location.search.substring(1), |
214 | | - vars = query.split("&"), |
215 | | - answ = false; |
216 | | - |
217 | | - vars.forEach(function(el, i){ |
218 | | - var pair = el.split('='); |
219 | | - |
220 | | - if(pair[0] === q) { |
221 | | - answ = pair[1]; |
222 | | - } |
223 | | - }); |
224 | | - |
225 | | - return answ; |
226 | | - } |
227 | | - |
228 | | - /** |
229 | | - * set configuration variables in global |
230 | | - */ |
231 | | - window.QBApp = QBApp; |
232 | | - window.CONFIG = CONFIG; |
233 | | - window.QBUsers = QBUsers; |
234 | | - window.MESSAGES = MESSAGES; |
| 2 | + var CONFIG = { |
| 3 | + debug: true, |
| 4 | + webrtc: { |
| 5 | + answerTimeInterval: 30, |
| 6 | + dialingTimeInterval: 5, |
| 7 | + disconnectTimeInterval: 30, |
| 8 | + statsReportTimeInterval: 5 |
| 9 | + } |
| 10 | + }; |
| 11 | + |
| 12 | + var CREDENTIALS = { |
| 13 | + 'prod': { |
| 14 | + 'appId': 40718, |
| 15 | + 'authKey': 'AnB-JpA6r4y6RmS', |
| 16 | + 'authSecret': '3O7Sr5Pg4Qjexwn' |
| 17 | + }, |
| 18 | + 'test': { |
| 19 | + 'appId': 39854, |
| 20 | + 'authKey': 'JtensAa9y4AM5Yk', |
| 21 | + 'authSecret': 'AsDFwwwxpr3LN5w' |
| 22 | + } |
| 23 | + }; |
| 24 | + |
| 25 | + var MESSAGES = { |
| 26 | + 'login': 'Login as any user on this computer and another user on another computer.', |
| 27 | + 'create_session': 'Creating a session...', |
| 28 | + 'connect': 'Connecting...', |
| 29 | + 'connect_error': 'Something went wrong with the connection. Check internet connection or user info and try again.', |
| 30 | + 'login_as': 'Logged in as ', |
| 31 | + 'title_login': 'Choose a user to login with:', |
| 32 | + 'title_callee': 'Choose users to call:', |
| 33 | + 'calling': 'Calling...', |
| 34 | + 'webrtc_not_avaible': 'WebRTC is not available in your browser', |
| 35 | + 'no_internet': 'Please check your Internet connection and try again' |
| 36 | + }; |
| 37 | + |
| 38 | + window.CONFIG = { |
| 39 | + 'CREDENTIALS': CREDENTIALS, |
| 40 | + 'APP_CONFIG': CONFIG, |
| 41 | + 'MESSAGES': MESSAGES |
| 42 | + }; |
235 | 43 | }(window)); |
0 commit comments