74 Commits

Author SHA1 Message Date
c0e123a801 fix(http): escape req.query.to in replaceTemplates 2021-07-01 10:43:37 -07:00
2ba03c3424 docs: clarify redirect function in http.ts usage 2021-07-01 10:43:37 -07:00
3b50bfc17d fix: sanitize password and cookie key 2021-06-08 14:33:17 -07:00
8c2bb61af9 refactor: parse options with multiple = in cli
There was a case with the hashed-password which had multiple equal signs in the
value and it wasn't being parsed correctly. This uses a new function and adds a
few tests.
2021-06-08 14:33:17 -07:00
517aaf71c5 docs: update FAQ with new hashing instructions 2021-06-08 14:33:16 -07:00
923761cd78 refactor: password logic in http w/ isCookieValid 2021-06-08 14:33:16 -07:00
0cdbd33b46 refactor: make authenticated async everywhere
Since this checks if they are authenticated using the hash/password and it's
async, we need to update authenticated to be async, which means we have to
update it everywhere it's used.
2021-06-08 14:33:14 -07:00
aaf044728f refactor: add functions to check hash password 2021-06-08 14:33:12 -07:00
36aad9bdab Move global express args definition
This way tests that import the http utilities but not the routes won't
error due to missing types.
2021-02-09 13:09:36 -06:00
60c270aef5 cli: hashedPassword -> hashed-password (#2454)
Capital letters in the CLI are evil.

cc @code-asher
2020-12-18 12:20:38 -05:00
1dd7e4b4e1 Add hashedPassword config (#2409)
Resolve #2225.
2020-12-08 14:54:17 -06:00
79478eb89f Clarify some points around the cookie domain
Also add a check that the domain has a dot. This covers the localhost
case as well, so remove that.
2020-11-10 18:53:38 -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
9e09c1f92b Upgrade to Express 5
Now async routes are handled!
2020-11-05 15:08:08 -06:00
34225e2bdf Use ensureAuthenticated as middleware 2020-11-04 17:07:40 -06:00
476379a77e Fix cookie domain
Had double Domain=
2020-11-04 17:07:39 -06:00
8066da12fe Remove unused Locals interface 2020-11-03 15:37:22 -06:00
112eda4605 Convert routes to Express 2020-10-26 17:56:13 -05:00
2928d362fa Move heart and AuthType out of http
This file is going to get blasted in favor of Express.
2020-10-20 16:18:24 -05:00
dcb303a437 Move argument defaults into setDefaults 2020-10-20 16:15:13 -05:00
2d1de749f4 Unlink socket before using (#2181)
See https://stackoverflow.com/a/34881585/4283659

Closes #1538
2020-10-09 12:34:52 -04:00
11eaf0b470 Fix being unable to use [::] for the host
Fixes #1582.
2020-09-30 12:49:36 -05:00
9d87c5328c Add robots.txt (#2080)
Closes #1886.
2020-09-14 17:34:48 -05:00
75c8fdeed2 Added /healthz JSON response for heartbeat data. #1940 (#1984) 2020-08-31 10:29:12 -05:00
de568d446b Add cookie domain debug logs
To help debug login issues.
2020-08-13 17:06:32 -05:00
7d02f34f71 Merge pull request #1934 from cdr/plugin
Add plugin system for adding http endpoints
2020-08-13 16:59:44 -05:00
6e27869c09 Add str param to plural util
Adds a str param to common/util::plural for pluralizing a string.
Applies plural to entry.ts.
2020-08-09 00:06:18 -05:00
361e7103ea Enable loading external plugins 2020-07-31 17:42:48 -05:00
bac948ea6f Add plugin system 2020-07-31 15:08:02 -05:00
e86c066438 Add helper functions to make some code clearer 2020-07-30 12:14:31 -05:00
7c2ca7d03e Add the ability to prepend to the proxy path
This is for applications like Jupyter that aren't base path agnostic.
2020-07-29 18:48:06 -05:00
c67d31580f Include details if any in JSON requests 2020-07-29 18:48:05 -05:00
58bd7008b4 Make dispose async 2020-07-29 18:48:04 -05:00
e8f6d30055 Make providers endpoint-agnostic
A provider can now be registered on multiple endpoints (or potentially
moved if needed).
2020-07-27 12:00:48 -05:00
00d164b67f Add default config file and improve config/data directory detection 2020-05-12 19:59:54 -04:00
27ba64c7e4 Improve request error handling
See #1532 for more context.

- Errored JSON requests will get back the error in JSON instead of using
  the status text. This seems better to me because it seems more correct
  to utilize the response body over hijacking the status text. The
  caller is expecting JSON anyway. Worst of all I never actually set the
  status text like I thought I did so it wasn't working to begin with.
- Allow the update error to propagate for JSON update requests. It was
  caught to show the error inline instead of an error page when using
  the update page but for JSON requests it meant there was no error and
  no error code so it looked like it succeeded.
- Make errors for failed requests to GitHub less incomprehensible.
  Previously they would just be the code which is no context at all.
2020-04-17 15:16:10 -05:00
28e91ba70c Fix domain issues when setting the cookie
Fixes #1507.
2020-04-13 16:14:40 -05:00
a288351ad4 Respond when proxy errors
Otherwise the request will just hang.
2020-04-08 11:54:18 -05:00
a5d1d3b90e Move proxy logic into main HTTP server
This makes the code much more internally consistent (providers just
return payloads, include the proxy provider).
2020-04-02 13:40:29 -05:00
411c61fb02 Create helper for determining if route is the root 2020-04-02 13:40:26 -05:00
e7e7b0ffb7 Fix redirects through subpath proxy 2020-04-02 13:40:25 -05:00
c0dd29c591 Fix domains with ports & localhost subdomains 2020-04-02 13:40:20 -05:00
8aa5675ba2 Implement the actual proxy 2020-04-02 13:40:19 -05:00
2086648c87 Only handle exact domain matches
This simplifies the logic a bit.
2020-04-02 13:40:18 -05:00
3a98d856a5 Handle authentication with proxy
The cookie will be set for the proxy domain so it'll work for all of its
subdomains.
2020-04-02 13:40:17 -05:00
90fd1f7dd1 Add proxy provider
It'll be able to handle /proxy requests as well as subdomains.
2020-04-02 13:40:16 -05:00
77ad73d579 Set domain on cookie
This allows it to be used in subdomains.
2020-04-02 13:40:15 -05:00
13534fa0c0 Add proxy-domain flag
This will be used for proxying ports.
2020-04-02 13:40:14 -05:00
3463d56114 SSH server & endpoint 2020-03-16 15:14:53 -05:00
d192726e80 Simplify dashboard 2020-03-16 15:14:50 -05:00