Commit Graph

22 Commits

Author SHA1 Message Date
MrEconomical
dea8411ad3 Fix file extensions in comments (#6062)
Update the extensions of a bunch of files that were migrated to TypeScript in comments
2019-11-24 12:57:12 +13:00
Waleed Hassan
a518cf102a Take steps to statically type Config (#5920)
This commit changes the TypeScript global variable of `Config` from
`AnyObject` to `Config & AnyObject`.

It still falls back to `AnyObject` (hence the 'Take steps') because of
the main-specific `Config` properties that are used without being in the
`Config` object itself.

These can be added by someone with access to the PS main server.

Regardlesss, this is an improvement as IntelliSense can display and
autocomplete the known properies.

In addition, the TypeScript compiler will now report bugs
concerning the types of the properties, which I have fixed in this
commit.
2019-10-30 18:45:20 +10:30
Ben Davies
0a98132e1b Track connection times and log probable ghosts (#5768)
This logs connections that have been around for longer than a week,
every week.
2019-09-17 21:02:57 -07:00
TheJetOU
f2783c642d Add a RoomID type (#5759) 2019-09-07 14:15:27 -05:00
Ben Davies
3eb70cdd90 Update the server WRT SockJS desktop client fix (#5757) 2019-09-04 14:54:11 -05:00
Ben Davies
2e586e0a58 Update the server WRT client connection timeouts (#5751)
* Remove the new xhr-streaming ghost connection hack

Once the client uses timeouts, this is no longer necessary.

* Update SockJS client to v1.4.0

This fixes an issue where it would attempt to parse the entire HTTP
response received as JSON, not the response's body alone.
2019-09-03 21:32:06 -05:00
Ben Davies
ae023212b5 Clean up sockets on process exit too, not just process disconnect
Sometimes when the server gets killed, the TCP closing handshake on
sockets currently open never actually gets completed, screwing with
things like bots that don't implement keepalive/timeouts of any kind.
2019-08-26 15:20:07 -03:00
Ben Davies
dc5a26a347 Remove old hack for xhr-streaming connections
This was actually closing open connections instead.
2019-08-25 13:13:32 -03:00
Guangcong Luo
e0a2cf07e1 Correctly define global types for .ts files
Global types are defined differently for `.ts` files than for `.js`
files, leading to some confusion for past refactors.

This commit defines them correctly.

I'm also considering making certain global types only available under
namespaces, but I don't want to do that to `User` or `Room`, so for
now, there are no changes there, besides putting streams in the
`Streams` namespace (so `WriteStream` is now `Streams.WriteStream`).
2019-08-23 09:33:49 -07:00
Kirk Scheibelhut
a61c10eeb8
Remove hardcoded URLs in favor of Config.routes (#5557) 2019-07-01 10:19:21 -07:00
Guangcong Luo
7436c1f0f2 Remove import = and export =
`import =` and `export =` are really only intended for backwards
compatibility with CommonJS. While I really don't like the new module
system TC39 has designed for us, it's what we should be using, and
consistency is important.
2019-05-16 01:27:07 +04:00
Guangcong Luo
e1c364fb79 Refactor DNSBL -> IPTools
This is mostly a TypeScript refactor, but it does come with several
renames:

Dnsbl -> IPTools
Dnsbl.query -> IPTools.queryDnsbl
Dnsbl.reverse -> IPTools.getHost
2019-05-14 10:57:08 +10:00
Kirk Scheibelhut
7e4929a39f Change protocol for '|split' message type (#5331) (#5332) 2019-04-22 09:20:47 +09:30
Kirk Scheibelhut
081ce82d15 Revert "Sockets: Refactor event handlers" instead of sockjs. (#5378)
* Revert "Sockets: Refactor event handlers"

This reverts commit d1242593f3.

* Revert "Switch back to sockjs 0.3.18 (#5376)"

This reverts commit 880ded4ed8.
2019-03-30 00:52:02 +08:00
Ivo Julca
d1242593f3 Sockets: Refactor event handlers
Define them early for better performance
2019-03-18 00:53:09 -05:00
Kirk Scheibelhut
6e122d5d74 Refactor lib/ to be native Typescript (#5217) 2019-03-02 11:12:24 -06:00
Guangcong Luo
135746cbdc Fix crash in ghost connection fix 2019-02-17 11:46:28 -06:00
Ben Davies
58fd10f6cb Tweak ghost connection timeout, log their connection status 2019-02-10 01:13:10 -04:00
Guangcong Luo
70b3e9a525 Rename channel -> room, subchannel -> channel
"channel" is just a fancy way of saying "room, but in sockets".
Renaming them like this should make it clearer exactly what's going
on in sockets.
2019-02-05 16:55:37 -06:00
Guangcong Luo
ffdcff3abc TypeScript globals
A few globals: Monitor, LoginServer, etc weren't being correctly
TypeScripted. This should change that.
2019-02-04 18:04:13 -06:00
HoeenHero
68131906ca Fix StaticServer and loading rooms 2019-02-04 11:17:44 -05:00
Guangcong Luo
f3e45fbb72 Move server code to server/
Also move mods/ to data/mods/

This makes PS more monorepo-like. The intent is to further separate
the sim and the server code, but without fully committing to splitting
the repository itself.

We now support `./pokemon-showdown start` in addition to
`./pokemon-showdown`. I'm not clear which I want to be the default
yet.
2019-02-03 16:07:06 -06:00