The ajaxterm state machine assumed data appears in response to user
actions, which is not true when watching. It now uses different sets
of parameters for playing and watching.
It is now possible to watch games currently being played through
RLG-Web, but not dgamelaunch. Also, there are some deficiencies, like
getting chaos until an absolute cursor addressing happens.
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.
Don't print a debug message for some control sequences that technically
are unimplemented, but would just put the terminal into the only mode
yet implemented. CSI 4l and CSI ?7h are like this.
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.
The RLG-Web client was failing to realize the game was over, because
a test was checking against the entire response instead of the proper
field in the response.
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.
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.
For roguelike games, most output will directly result from and follow
immediately after input from the user. In other situations, data
should not be expected.
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.
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.
When sqlickrypt is run with the option "register", it expects a
username, password, and email, and adds them to the database if the
username is not already in use.
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.
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.
Implement checking the numbers of the client's messages on the server.
Fixing out-of-ordering isn't implemented because the problem hasn't
been observed yet, though it likely will once actual network transit
is involved.
Make sure data from the server is written to the terminal emulator in
the correct order. Out-of-order messages are stored in a queue until
their turn comes.