9 Commits

Author SHA1 Message Date
d477972c68 Add origin checks to web sockets (#6048)
* Move splitOnFirstEquals to util

I will be making use of this to parse the forwarded header.

* Type splitOnFirstEquals with two items

Also add some test cases.

* Check origin header on web sockets

* Update changelog with origin check

* Fix web sockets not closing with error code
2023-03-03 03:12:34 -06:00
91589fd106 chore(deps): update dependency @types/node to v16 (#5170)
* Update Node types to 16

* Update Express core types

Fixes a number of conflicts it has with Node 16.

* Fix websocket router types

It seems req was `any` before so now we have to handle the types.  Also
it seems the socket is of type `stream.Duplex`, not `net.Socket`.

The ws types had to be updated to support the new type.

Unfortunately Code still uses the old type so cast for now.

In the web socket router just use a cast for the extra properties we
add.  We could add the types to the Express namespace but I am not sure
we really want these commonly accessible so keep with the casts for now.
Likely we should use Express's `locals` or something instead.

* Add missing return

Not sure why it only just now started complaining though.

Co-authored-by: Asher <ash@coder.com>
2022-08-10 16:15:52 -05:00
6c9c84090e chore: replace eslint-import-resolver-alias with eslint-import-resolver-typescript (#4546)
Co-authored-by: Joe Previte <jjprevite@gmail.com>
2021-12-07 14:39:01 -07:00
b13db3124b Add health websocket
This is used by some of our services.
2021-02-09 13:09:33 -06:00
f136a60093 Note that we immediately pause websockets 2021-02-09 13:09:32 -06:00
055e0ef9ec Provide WsRouter to plugins 2021-02-09 13:09:27 -06:00
e1702a1d21 Merge branch master into code-asher/ch1385 2020-11-12 11:52:02 -06:00
b8340a2ae9 Close sockets correctly 2020-11-10 17:55:04 -06:00
7b2752a62c Move websocket routes into a separate app
This is mostly so we don't have to do any wacky patching but it also
makes it so we don't have to keep checking if the request is a web
socket request every time we add middleware.
2020-11-05 15:08:09 -06:00