Commit graph

40 commits

Author SHA1 Message Date
John "Elwin" Edwards
bec02aea9e RLG-Web server: send status events over WebSockets.
A WebSocket connection to /status will be sent periodic listings, along
with notifications of the beginning and end of games.
2012-07-13 22:26:20 -07:00
John "Elwin" Edwards
4174840c3e RLG-Web server: refactor statusmsg() to work with WebSockets.
Separate the game-listing and http-responding components of statusmsg()
so the listing function can be reused for WebSockets.
2012-07-13 09:17:05 -07:00
John "Elwin" Edwards
031bc239f8 RLG-Web server: code cleanup.
Delete some TermSession code left over from the first attempt at
Websockets.  Also don't bother logging the disconnection of watchers
after the game has ended.
2012-07-13 08:52:17 -07:00
John "Elwin" Edwards
f4c4f5e0f1 RLG-Web: Complete the WebSocket watcher.
Watching via WebSockets now takes into account terminal size, player
name, etc.
2012-07-13 08:39:39 -07:00
John "Elwin" Edwards
aee00a29d5 RLG-Web: begin converting to WebSockets.
Use WebSockets for watching, if the browser supports it.  Functionality
is not complete yet.
2012-07-12 22:16:15 -07:00
John "Elwin" Edwards
2828b5f33c RLG-Web: Allow games to be taken over.
Make it possible to reconnect to a game if the user has left the page
without saving.
2012-07-11 10:30:33 -07:00
John "Elwin" Edwards
24879b8123 RLG-Web: improve game-starting messages.
Include the name of the player and game when watching or playing.
2012-07-10 16:32:49 -07:00
John "Elwin" Edwards
06614ac0aa RLG-Web: make /pstatus/* differentiate between dgl and RLG-Web games.
The /pstatus/ API now responds with "p" for games being played in
RLG-Web and "d" for games being played in dgamelaunch.
2012-07-09 12:51:12 -07:00
John "Elwin" Edwards
9c45f52722 RLG-Web: use the pty module.
Convert the RLG-Web server to use the pty.js module instead of the
ptyhelper binary.
2012-07-09 12:24:03 -07:00
John "Elwin" Edwards
286626df57 rlgwebd.js: Unlink control socket at startup.
Unlinking at shutdown doesn't work because at that time, the process is
chroot'ed and unprivileged.
2012-07-08 17:49:43 -07:00
John "Elwin" Edwards
d0ea0471c0 rlgwebd.js: set the width and height on Player objects.
Fixes the client not being informed of the pty size.
2012-07-08 08:40:08 -07:00
John "Elwin" Edwards
e3dd70ce08 Switch to node v0.8.
In node v0.8, path.exists() has been moved to the fs module.
2012-07-08 08:02:17 -07:00
John "Elwin" Edwards
2d9c8bd011 Display idle time of games in progress.
statusmsg() now includes games' idle times, and the client displays
them using getcurrent().
2012-06-20 11:37:05 -07:00
John "Elwin" Edwards
f711cdb591 Some status improvements.
Status messages now consistently use the game's uname, and the table
of choices puts the games in the right order.
2012-06-20 08:49:10 -07:00
John "Elwin" Edwards
674f570b63 rlgwebd.js: fix failure to respond.
The codepath for a watcher requesting to quit did not lead to any
response being sent.
2012-06-20 07:37:15 -07:00
John "Elwin" Edwards
5f914901d1 Make sure watchers start with completely drawn screens.
TermSessions now buffer all data since the last screen clear, so new
Watchers can start with complete screens.
2012-06-19 19:11:59 -07:00
John "Elwin" Edwards
1ffb72866a RLG-Web: make multiple watchers possible.
Split the TermSession class into the new TermSession, which handles the
PTY, and client classes, which handle HTTP sessions.  These are Player
and Watcher.  This allows multiple watchers per game, and other
improvements.
2012-06-18 13:43:51 -07:00
John "Elwin" Edwards
c7cb905b29 RLG-Web: delay removing TermSessions until the client is informed.
Add a TermSession.sendq flag that indicates whether a type q message
has been sent to the client.  Don't immediately destroy the TermSession
on child exit if the message hasn't been sent.

This is an ugly hack until the TermSession class is separated into an
EventEmitter to handle the PTY and a listening object that handles
communication with the client.  That will also allow other clients to
watch the game.
2012-06-11 09:15:33 -07:00
John "Elwin" Edwards
20d72fc066 RLG-Web: make login sessions time out.
After enough inactivity, log the user out automatically.
2012-06-09 21:20:14 -07:00
John "Elwin" Edwards
a00bd32552 rlgwebd.js: remove some debugging.
Remove some residual debugging lines.
2012-06-09 13:04:46 -07:00
John "Elwin" Edwards
43f30438ed rlgwebd.js: add a player status interface.
Give information on a player's current status at "/pstatus/<name>".
Also fix some shift()/unshift() confusion in checkprogress().
2012-06-09 11:46:58 -07:00
John "Elwin" Edwards
e0a70e4b0e rlgwebd.js: refactor some game-starting code.
Separate things like checking for games in progress, starting a new
game, and figuring out where the lockfile and ttyrec should go.  This
allows e.g. the games-in-progress check to be used to create status
messages.  It also keeps the argument list for the TermSession
constructor to a sensible size.
2012-06-08 18:11:47 -07:00
John "Elwin" Edwards
012c86faa8 RLG-Web: separate logging in and starting a game.
The user now logs in with a username and password, receiving a token
which is then used for any actions requiring authentication.  Starting
a game is one such action.  Games use a different set of id keys.
This allows users to supply their passwords once and then play any
number of successive games.  Also, newly registered users do not need
to supply their passwords again.
2012-06-07 15:43:06 -07:00
John "Elwin" Edwards
fbc86e7e12 rlgwebd.js: remove dead code.
Remove functions that dealt with HTML forms and other obsolete code.
2012-06-06 10:08:31 -07:00
John "Elwin" Edwards
07c7ea3515 RLG-Web: autosave idle games.
If a game has been idle for too long, close it.
2012-06-06 10:01:18 -07:00
John "Elwin" Edwards
dec7bc108a rlgwebd.js: handle HTTP HEAD properly.
Prevent a message body from being sent in response to HTTP HEAD.
2012-06-05 20:13:47 -07:00
John "Elwin" Edwards
e0bbee0242 rlgwebd.js: add a status interface.
The RLG-Web server now makes its status and the list of current games
available to a GET on /status.
2012-06-05 14:51:42 -07:00
John "Elwin" Edwards
37e6447094 rlgwebd.js: improve MIME types.
Respond with the proper MIME type for JSON, and identify HTML as using
the UTF-8 charset.
2012-06-05 09:31:49 -07:00
John "Elwin" Edwards
6b209976d6 rlgwebd.js: listen on any address
The RLG-Web server now binds to any address instead of 127.0.0.1 only.
2012-06-05 09:22:17 -07:00
John "Elwin" Edwards
7e352fcc20 rlgwebd.js: fix reference error
httpServer needs to be in the global scope so shutdown() can find it.
2012-06-04 21:34:57 -07:00
John "Elwin" Edwards
bb17dd58a2 rlgwebd.js: become a real daemon.
The RLG-Web server now forks off, writes to a logfile, and reads from a
control socket.  Unfortunately it can't handle the problem of another
rlgwebd process already running.  Maybe a lockfile would help.
2012-06-04 20:45:27 -07:00
John "Elwin" Edwards
d0e3b1da2f rlgwebd.js: read commands from the console
The RLG-Web server can now be controlled with commands sent to stdin.
Currently, the only one implemented is "quit".  Some improvements to
the shutdown process were also made.
2012-06-04 14:21:41 -07:00
John "Elwin" Edwards
8599ec081d rlgwebd.js: add timestamps to log messages.
Wrap console.log() with the tslog() function, which prepends timestamps.
Clean up some of the messages as well.
2012-06-04 10:19:36 -07:00
John "Elwin" Edwards
53d5e7dd0d Implement message order correction on the server side.
rlgwebd can now correct for the client's messages arriving in the wrong
order, in theory.  I haven't found a good way of testing it yet.
2012-05-24 11:36:57 -07:00
John "Elwin" Edwards
c1856a6184 Fix some typos.
Some code copied and pasted without updating the variable names was
causing crashes.
2012-05-23 14:28:47 -07:00
John "Elwin" Edwards
2d86b63c98 RLG-Web: set up user directories on registration
Have RLG-Web create various user directories when a new user registers,
as dgamelaunch does.  Also add some debugging messages if registration
fails.
2012-05-22 21:44:38 -07:00
John "Elwin" Edwards
e36f058daf RLG-Web: add user registration
Update the server and client sides of RLG-Web to make use of the new
registration feature of sqlickrypt.
2012-05-22 20:54:33 -07:00
John "Elwin" Edwards
e7bcd4be4a rlgwebd: switch to dgamelaunch's SQLite database.
The quickrypt utility is replaced with sqlickrypt, which takes a username
and password pair and checks them against the SQLite password database
used by dgamelaunch.  This will be more extensible to using rlgwebd to
register, change passwords, etc.
2012-05-20 15:52:07 -07:00
John "Elwin" Edwards
94f8630eb4 RLGWeb: switch to JSON protocol.
Port the JSON communication from WebTTY to RLGWeb.  Fixing out-of-order
messages is still not implemented on the server side.  Terminal size is
still hard-coded.  Unused code is still lying around.
2012-05-17 09:32:19 -07:00
John "Elwin" Edwards
5b0be4c820 Call the dgl replacement rlgwebd instead of webttyd. 2012-05-07 16:08:59 -07:00
Renamed from webttyd.js (Browse further)