Mercurial > hg > rlgwebd
diff shterm.js @ 10:d051aad3e95f
webtty: begin experimenting with JSON protocol.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Wed, 09 May 2012 16:36:11 -0700 |
parents | 826a7ced69f8 |
children | 481dcee353c9 |
line wrap: on
line diff
--- a/shterm.js Wed May 09 13:38:05 2012 -0700 +++ b/shterm.js Wed May 09 16:36:11 2012 -0700 @@ -302,13 +302,13 @@ req.onreadystatechange = function () { if (req.readyState == 4 && req.status == 200) { var datalines = req.responseText.split("\n"); - if (datalines[0] == 'l1') { + var logindict = JSON.parse(req.responseText); + if (logindict.login) { /* Success */ - // FIXME extract the size from the response instead of hardcoding - termemu.resize(25, 80); + termemu.resize(logindict.h, logindict.w); termemu.alive = true; setTitle("Logged in"); - debug(1, "Logged in with id " + datalines[1]); + debug(1, "Logged in with id " + logindict.id); getData(); return; }