Commit graph

157 commits

Author SHA1 Message Date
Emi Tatsuo 13b1eddd00
Allow serving a single file 2020-11-24 17:28:54 -05:00
Emi Tatsuo 970813f295
Added FilesHandler 2020-11-24 17:22:47 -05:00
Emi Tatsuo 3e07e24e41
Added automatic clearing of ratelimit keys 2020-11-24 16:45:30 -05:00
Emi Tatsuo 5ae6f578e3
Merge branch 'routes' into rate-limiting 2020-11-24 15:27:27 -05:00
Emi Tatsuo 560760c489
Added another test for RoutingNode 2020-11-24 15:08:05 -05:00
Emi Tatsuo b2a671993e
Add ability to iterate over a routing node 2020-11-24 14:51:21 -05:00
Emi Tatsuo df2350a8bb
Switch to a much lighter in-house rate-limiting solution, and use consistant naming of ratelimiting 2020-11-24 13:58:18 -05:00
Emi Tatsuo c3d7381860
Added a static handler type. Impl AsRef<Body> for Response
im so tired i havent slept enough in so long but also i havent done any productive work like do you think im using this project as an excuse or like a bad coping mechanism for my mental health or something like that cause thats what its starting to feel like
2020-11-23 23:34:11 -05:00
Emi Tatsuo 7990739884
Move the handler type to it's own mod, change to an enum
The new enum can be converted to from anything that could previously be passed to
add_route, so this is not a breaking change.  If fact, from the end user's perspective,
nothing changed, but internally, this gives us a lot of potential as far as having
multiple types of routes.
2020-11-23 11:55:40 -05:00
Emi Tatsuo 2400ef8796
Move user management routes to their seperate feature 2020-11-23 11:37:47 -05:00
Emi Tatsuo f572209dfa
Merge branch 'reduce-arcs' into routes 2020-11-23 10:55:48 -05:00
Emi Tatsuo 48c0783e36
Improve error handling for serve_dir
Specifically:
 - Serve NOT_FOUND when file or directory doesn't exist
 - Serve NOT_FOUND and warn in log when permission denied for file or directory
 - Serve SERVER_ERROR and warn in log when permission denied or not found for path to serve from
 - Serve SERVER_ERROR and warn in log with a link to the GH if an unexpected error happens
2020-11-23 09:39:45 -05:00
Emi Tatsuo 71c1ac0fab
Fix serve_dir feature 2020-11-23 08:44:45 -05:00
Emi Tatsuo 28a4d64c5f
Segregate features surrounding multiple certificates & passwords to a seperate feature 2020-11-22 22:24:36 -05:00
Emi Tatsuo 9916770bd2
Added add_authenticated_input_route 2020-11-22 20:56:15 -05:00
Emi Tatsuo edbfd3ed78
Merge branch 'reduce-arcs' into user-management 2020-11-22 20:35:47 -05:00
panicbit eebf7119fb
Merge branch 'master' into routes 2020-11-22 21:00:33 +01:00
panicbit 3a999a16fe
Merge pull request #30 from Alch-Emi/doc-into-req
Allow direct conversion for Document -> Response
2020-11-22 20:54:08 +01:00
Emi Tatsuo 95a4a8d75d
Reduce number of required Arcs
Should improve performance because cloning an `Arc` is expensive
2020-11-22 11:55:33 -05:00
Emi Tatsuo 7854a2a4c4
Add the add_authenticated_route method
I'm really proud of how small the user_management example has gotten
2020-11-22 02:56:41 -05:00
Emi Tatsuo 916ac1009c
Add docs for add_um_routes 2020-11-22 01:05:34 -05:00
Emi Tatsuo 0756dd7394
Update a few pages 2020-11-22 00:46:32 -05:00
Emi Tatsuo b03fe0e5f7
Add password management facilities 2020-11-22 00:46:24 -05:00
Emi Tatsuo 2b5ee33762
Fixed bug where user password was never saved 2020-11-22 00:42:26 -05:00
Emi Tatsuo 3c7d3457ef
Added has_password to RegisteredUser 2020-11-22 00:33:57 -05:00
Emi Tatsuo abe3c00fbf
Merge branch 'fix-kristall' into user-management 2020-11-21 23:57:35 -05:00
Ben Aaron Goldberg 4d0b0521d6
Include a workaround for a bug with rustls & webpki 2020-11-21 23:45:05 -05:00
Emi Tatsuo 6e82ae059d
Add user management routes 2020-11-21 23:03:56 -05:00
Emi Tatsuo a9b347a8c9
Merge branch 'rework-success' into user-management 2020-11-21 17:34:08 -05:00
Emi Tatsuo 115d0aa120
Merge branch 'doc-into-req' into user-management 2020-11-21 17:19:49 -05:00
Emi Tatsuo 0b4fca2c69
Merge branch 'allow-async-handlers' into user-management 2020-11-21 16:55:36 -05:00
Emi Tatsuo cd7af1025a
Cleanup typos in routes docs
I should really use spellcheck more often
2020-11-20 23:51:22 -05:00
Emi Tatsuo e678e45b78
Merge branch 'routes' into user-management 2020-11-20 21:53:00 -05:00
Emi Tatsuo 349f6da698
Add rate limiting feature
ugghhhhhh I hate how big the governer crate is but there's no alternative besides DIY
2020-11-20 21:15:37 -05:00
Emi Tatsuo 5254c17e36
Rework Request::success methods 2020-11-20 14:18:11 -05:00
Emi Tatsuo 2604b02e2b
Merge branch 'routes' into allow-async-handlers 2020-11-20 14:00:49 -05:00
Emi Tatsuo 536e404fdf
Make RoutingNode generic 2020-11-20 13:54:24 -05:00
Emi Tatsuo 59e3222ce8
Add trailing segments to request 2020-11-20 13:22:34 -05:00
Emi Tatsuo 3296d00ec3
Add From<Borrow<Document>> to Response
This allows users to call &mut Document.into() in order to create a response, so that you
can do it right in the middle of one of those builder call chain thingies
2020-11-20 09:51:37 -05:00
Emi Tatsuo 435330b415
Made Request::document a bit more generic
Also how did I not know about the Borrow trait until now???
2020-11-20 09:40:57 -05:00
Emi Tatsuo 5612ce1085
Removed unnecessary dependency on futures-rs 2020-11-19 23:51:25 -05:00
Emi Tatsuo 29c831649d
Changed the add_route API to allow the use of simpler, async handlers 2020-11-19 23:48:55 -05:00
Emi Tatsuo 54816e1f67
Fixed bug where root handler was never hit for requests other than exact matches 2020-11-19 23:34:45 -05:00
Emi Tatsuo 10c957aee5
Re-restrict Handler & HandlerResponse 2020-11-19 22:35:35 -05:00
Emi Tatsuo dc18bf2d1c
Fix examples (& also bugs with args in lib.rs)
I thought I was clever with Into<Handler> :(
2020-11-19 22:33:44 -05:00
Emi Tatsuo 4a0d07c2ca
Switched Builder & Server to routes from a single handler 2020-11-19 22:11:31 -05:00
Emi Tatsuo e6c66ed9e7
Don't feature gate routing
I really thought this was gonna be more complicated when I was planning it.  Well,
"planning" it.
2020-11-19 21:45:41 -05:00
Emi Tatsuo 26e0fd2702
Added some routing classes 2020-11-19 21:37:02 -05:00
Emi Tatsuo 0bcce9fd6f
Appease clippy
Please my compiler is so angry ;-;
2020-11-19 18:03:10 -05:00
Emi Tatsuo 766c472cbf
Added the add_certificate and attach methods 2020-11-19 17:41:32 -05:00
Emi Tatsuo cdc3921a83
Refix docs
Oh so /that's/ how you disable a lint
2020-11-19 17:07:33 -05:00
Emi Tatsuo 79b06b08ba
Refactor SignedInUser -> RegisteredUser 2020-11-19 17:00:32 -05:00
Emi Tatsuo 2f1196228f
Return a full SignedInUser from lookup_user(), restrict access to PartialUser
Okay this is a much nicer API tbh.  Why didn't I do this from the start?  'cause I'm bad
at planning that's why.  We got there eventually though!
2020-11-19 16:54:29 -05:00
Emi Tatsuo 1908d0a0d7
Implement the set password method 2020-11-19 16:39:02 -05:00
Emi Tatsuo fb205cd397
Switched from bcrypt to argon 2020-11-19 16:07:52 -05:00
Emi Tatsuo ff5f294dae
Restricted access to several fields of SignedInUser 2020-11-19 15:21:26 -05:00
Emi Tatsuo 4996ae99d2
Merge remote-tracking branch 'upstream/master' into user-management 2020-11-19 14:41:18 -05:00
Emi Tatsuo abcb296574
Cleaned up some warnings in user_management
*sweep sweep sweep sweep sweep*
2020-11-19 14:27:36 -05:00
Emi Tatsuo 18228bb1c5
Save SignedInUser on drop, and make changes necessary to that end
Which was a surprisingly large number of changes /shrug
2020-11-19 14:25:36 -05:00
panicbit 46ab84ba04 streamline send_response 2020-11-19 19:34:48 +01:00
Emi Tatsuo e7cf782a60
Improve user management docs 2020-11-19 13:20:14 -05:00
Emi Tatsuo b50a5e3244
Merge remote-tracking branch 'upstream/master' into timeout-override 2020-11-19 12:36:42 -05:00
panicbit 4e251d0cb6
Merge pull request #25 from Alch-Emi/trim-deps
Trim dependencies & move directory serving utils to feature
2020-11-19 18:29:52 +01:00
Emi Tatsuo c69cf49d99
Removed over-zeleous feature gating 2020-11-19 11:31:10 -05:00
Emi Tatsuo 475db6af79
Adapted a type from futures-util allowing us to drop the dep and remove a big chunk of the dep tree 2020-11-19 11:09:53 -05:00
Emi Tatsuo 3da18ca530
Reduced tokio featureset 2020-11-19 10:21:32 -05:00
Emi Tatsuo e0abe6344b
Reduced dependency on futures-rs 2020-11-19 02:54:45 -05:00
Emi Tatsuo 753ecf708d
Isolate directory serving methods behind feature, incl mime_guess. Remove itertools 2020-11-19 02:49:41 -05:00
Emi Tatsuo df362d1bc3
Fixed bug where incorrect timeout was used. I got the mime types backwards haha pretend you didnt see that 2020-11-19 01:43:57 -05:00
Emi Tatsuo 25d575bee7
Shorten references to tokio::time::timeout because I forgot I used an import for that woops sorry 2020-11-19 01:30:08 -05:00
Emi Tatsuo 94d7a5ab4f
Added complex timeout override option to builder 2020-11-19 01:25:34 -05:00
Emi Tatsuo a778774189
Added note about short timeouts to set_timeout docs 2020-11-18 23:29:00 -05:00
Emi Tatsuo 4e3417fb41
Added ability to customize certificate path 2020-11-18 23:10:48 -05:00
panicbit f2b27665c2 correctly ignore doctest 2020-11-18 23:01:10 +01:00
panicbit 5a92d8d28f use mime_guess for guessing mime 2020-11-18 23:00:46 +01:00
panicbit fffada14e3 increase default timeout from 1 to 30 seconds 2020-11-18 22:46:18 +01:00
panicbit 931c3fbbc2 add temporary redirects and bad requests 2020-11-18 21:26:27 +01:00
panicbit 4eae63ac4e
Merge pull request #17 from Alch-Emi/timeout
Add timeouts to response handling
2020-11-18 21:04:48 +01:00
Emi Tatsuo 343de637c4
Added ability to load from custom key and certificate paths 2020-11-18 09:24:22 -05:00
Emi Tatsuo 6a78b2f31a
Added Response::success_with_body 2020-11-17 21:41:18 -05:00
Emi Tatsuo aa2dbbf67a
Fixed typo in timeout docs 2020-11-17 21:01:54 -05:00
Emi Tatsuo 71cf4d33f2
Added ability to set the timeout in the Server builder 2020-11-17 20:45:57 -05:00
Emi Tatsuo 3245396682
Add basic timeout with hardcoded durations 2020-11-17 20:38:10 -05:00
panicbit 387ca06611 fix visibility of URIReference in crate root 2020-11-17 01:50:35 +01:00
Emi Tatsuo 0a67c1d672
Rename UserInner -> PartialUser, expose for access outside of crate 2020-11-16 09:21:24 -05:00
Emi Tatsuo 0e2f8d5f62
Added user management API [WIP] 2020-11-16 01:13:16 -05:00
panicbit 987621cca9 support gmi extension when guessing mime types
Closes #12
2020-11-15 22:03:50 +01:00
panicbit add2f30ca6 remove unused function 2020-11-15 21:42:13 +01:00
panicbit bbeb697bb1 complete document documentation 2020-11-15 21:40:16 +01:00
panicbit ec6a0af782 keep document internals private 2020-11-15 21:17:22 +01:00
panicbit ae803a55d2 do not escape heading text 2020-11-15 21:14:53 +01:00
panicbit 45c808d0d0 document more Document methods 2020-11-15 21:14:41 +01:00
panicbit 46077739b3 document some Document methods 2020-11-15 07:01:38 +01:00
panicbit 0425bf2cf3 add Cowy util trait 2020-11-14 22:46:29 +01:00
panicbit 0c05d6d162 implement document API 2020-11-14 09:55:21 +01:00
panicbit 28162bde5c move split types module into submodules 2020-11-14 04:43:29 +01:00
panicbit bfb6282a9b improve error messages 2020-11-14 03:58:57 +01:00
panicbit 82dc34b2c5 respect meta max len of 1024 in constructors 2020-11-14 02:54:34 +01:00
panicbit af614a06aa reduce number of functions that return Result 2020-11-14 01:55:47 +01:00
panicbit 1a145c922c add Meta::new_lossy 2020-11-14 01:45:16 +01:00