See Zarel/Pokemon-Showdown@d5c622b493
New system is backwards-compatible with old one. This also slightly
refactors some other stuff, for an overall simpler system.
When attempting to go on an unregistered server when there is already
another registered server sharing the same IP/Port pair (such as in
virtual hosting), you get redirected to the registered server, which
is undesirable
So in theory, a user hosting PS on their own computer should be able
to visit their server with their IP. For some reason, certain routers
don't allow this, and force them to use localhost or 127.0.0.1.
This commit makes it so we do this for them, so they can still use
their server's official address [serverid].psim.us to connect to
their server.
This drops support for the pre-challenge-response authentication scheme
(i.e. the scheme in use before Zarel/Pokemon-Showdown@7dbd8cfec5 on
February 8, 2013), and, by doing so, simplifies quite a bit of the
authentication code.
In particular, it is no longer necessary to make any database queries in
index.php, which reduces our database use significantly and also moves us
closer to the goal of the index page being static HTML.
This commit allows the new psim.us domain to use the cookies and
`localStorage` of play.pokemonshowdown.com. Teams and prefs are
initially loaded from the play.pokemonshowdown.com `localStorage` and
changes to teams and prefs are written back to the
play.pokemonshowdown.com `localStorage`.
This commit also implements a few other things for the new psim.us
domain (implemented by Zarel):
- URIs of the form serverid.psim.us load the server `serverid`
- the naked domain now loads the lobby