Mercurial > hg > rlgwebd
comparison rlgwebd.js @ 37:353be34de307
rlgwebd.js: remove dead code.
Remove functions that dealt with HTML forms and other obsolete code.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Wed, 06 Jun 2012 10:08:31 -0700 |
parents | a0387f112bcf |
children | e8ac0e3d2614 |
comparison
equal
deleted
inserted
replaced
36:a0387f112bcf | 37:353be34de307 |
---|---|
17 var httpPort = 8080; | 17 var httpPort = 8080; |
18 var chrootDir = "/var/dgl/"; | 18 var chrootDir = "/var/dgl/"; |
19 var dropToUID = 501; | 19 var dropToUID = 501; |
20 var dropToGID = 501; | 20 var dropToGID = 501; |
21 var serveStaticRoot = "/var/www/"; // inside the chroot | 21 var serveStaticRoot = "/var/www/"; // inside the chroot |
22 var passwdfile = "/dgldir/dgl-login"; | |
23 var playtimeout = 3600000; // Idle time before games are autosaved, in ms | 22 var playtimeout = 3600000; // Idle time before games are autosaved, in ms |
24 | 23 |
25 /* Global state */ | 24 /* Global state */ |
26 var sessions = {}; | 25 var sessions = {}; |
27 var allowlogin = true; | 26 var allowlogin = true; |
256 } | 255 } |
257 } | 256 } |
258 return cookies; | 257 return cookies; |
259 } | 258 } |
260 | 259 |
261 function urlDec(encstr) { | |
262 var decstr = ""; | |
263 var tnum; | |
264 for (var i = 0; i < encstr.length; i++) | |
265 { | |
266 if (encstr.charAt(i) == "+") | |
267 decstr += " "; | |
268 else if (encstr.charAt(i) == "%") | |
269 { | |
270 tnum = Number("0x" + encstr.slice(i + 1, 2)); | |
271 if (!isNaN(tnum) && tnum >= 0) | |
272 decstr += String.fromCharCode(tnum); | |
273 i += 2; | |
274 } | |
275 else | |
276 decstr += encstr.charAt(i); | |
277 } | |
278 return decstr; | |
279 } | |
280 | |
281 /* Returns the contents of a form */ | |
282 function getFormValues(formtext) { | |
283 var pairstrs = formtext.split("&"); | |
284 var data = {}; | |
285 for (var i = 0; i < pairstrs.length; i++) | |
286 { | |
287 var eqsign = pairstrs[i].indexOf("="); | |
288 if (eqsign > 0) { | |
289 rawname = pairstrs[i].slice(0, eqsign); | |
290 rawval = pairstrs[i].slice(eqsign + 1); | |
291 name = urlDec(rawname); | |
292 val = urlDec(rawval); | |
293 if (!(name in data)) | |
294 data[name] = []; | |
295 data[name].push(val); | |
296 } | |
297 } | |
298 return data; | |
299 } | |
300 | |
301 function getMsg(posttext) { | 260 function getMsg(posttext) { |
302 var jsonobj; | 261 var jsonobj; |
303 if (!posttext) | 262 if (!posttext) |
304 return {}; | 263 return {}; |
305 try { | 264 try { |
310 return {}; | 269 return {}; |
311 } | 270 } |
312 if (typeof(jsonobj) != "object") | 271 if (typeof(jsonobj) != "object") |
313 return {}; | 272 return {}; |
314 return jsonobj; | 273 return jsonobj; |
315 } | |
316 | |
317 function auth(username, password) { | |
318 // Real authentication not implemented | |
319 return true; | |
320 } | 274 } |
321 | 275 |
322 function reaper() { | 276 function reaper() { |
323 var now = new Date(); | 277 var now = new Date(); |
324 function reapcheck(session) { | 278 function reapcheck(session) { |