Commit Graph

284 Commits

Author SHA1 Message Date
shockrah
4f71e566c3 Removed sql_traits module as it was merely a stepping stone module
Channel struct now adpots a from_tup method and can be seen in use in get_channels_vec
2020-06-02 22:10:28 -07:00
shockrah
08e5b87ba4 Helper functionality
InviteRow now has some utilities built into it to help with translating values from various types needed throughout the codebase
+from_tuple -> because mysql is used to grab tuples before structs
+as_json_str -> because we respond primarily with json payloads
list_channels is considered a main entry point from the dispather and thus handles errors  itself
2020-06-02 22:04:54 -07:00
shockrah
528d7502d1 removed perms and limit on channels until channels module is done 2020-06-02 22:01:21 -07:00
shockrah
d2eb0597c3 new route regarding invite creation being built 2020-06-02 17:50:23 -07:00
shockrah
b2a6da2561 auth::wall_entry now follows the same error system as invites module
Result of function forwards to its caller so we dont deal w/ mysql so much
2020-06-02 17:05:54 -07:00
shockrah
2400b89b12 added result return types to invites module functions
this lets us cut down on worrying about mysql errors
Mysql error responsibility is now the route dispatchers problem
Route dispatcher itself can easily dispatch to another handler
2020-06-02 17:05:14 -07:00
shockrah
20f6273ad7 Fixed compile issue regardign :: vs . typo 2020-06-02 03:45:54 -07:00
shockrah
dd3bbeabd8 InviteRow structure has some methods listed below:
+ new() -> create a new ready to insert invite
+ from_tuple -> helps us translate db responses into a struct
+ as_json_str -> String which we can use as a json payload(jank but whatever it works with proper headers)

FUnctions:
get_invite_by_code: as the name implies grabs an invite assuming its in our db otherwise None
record_invite_usage: blindly modifies the row in the schema, assumes that if we get to this point we're ok to ignore erroneous possibilities
join_invite_code: main dispatcher for joining using the /invite/join route
create_invite: meant to the be the route handler for creating invites later on
Needed: test module since we've basically reworked the whole auth/invite system in one day
2020-06-02 03:44:33 -07:00
shockrah
43a122b855 Removing old unused files from project 2020-06-02 03:39:39 -07:00
shockrah
d1cfc4284c child calls from main_responder (see route_dipatcher + route handlers) now borrow a connection for the sql db 2020-06-02 03:25:11 -07:00
shockrah
19ad0eee9f OpenAuth + Good both have the same kind of dispatcher response
route dispatcher work begins with dispatching to invites::join_invite_code
Fixed the non mutable ref borrowing in funcs that required mutable references like most that get called by route_dispatcher
2020-06-02 01:32:43 -07:00
shockrah
68aeb50175 checking for open routes which require no aut in wall_entry 2020-06-02 01:29:05 -07:00
shockrah
d02f2d9eb7 conatiner module for routes 2020-06-02 01:28:40 -07:00
shockrah
c7c6f530a0 handling ctrl-c 2020-06-02 00:50:09 -07:00
shockrah
9033c80369 Exhaustive response to various authentication failures
response route_dispatcher now guaranteed to fire on proper authentication only
2020-06-02 00:47:28 -07:00
shockrah
e2abc49087 added counter to keys table
this lets us increment uses when a key is going to be used
2020-06-02 00:44:53 -07:00
shockrah
8360efced5 auth::wall_entry now verifies keys upon request
We can now decide what kind of authorization result triggers what kind of responses to the users
Further more error handling has to happen closer to application logic which is the main trade-off of our architecture
2020-06-02 00:32:15 -07:00
shockrah
5ad23eed8c adding mysql_async to dependancy list 2020-06-01 23:05:06 -07:00
shockrah
125a728674 new keys table to let auth::wall_entry check for api access 2020-06-01 23:02:53 -07:00
shockrah
83576f1126 basic query string parser function used to generate hashmaps of parameters
This hashmap is then borrowed by child functions down to the route handlers themselves if they need it
2020-06-01 22:50:58 -07:00
shockrah
e48720d6ac removing basically everything since almost nothing is going to translate over very easily from the auth module
for now we're only going to use two methods to
auth::wall_entry is what allows to impose rate on a per user basic, not per route, although this feature can be configured later
2020-06-01 22:28:06 -07:00
shockrah
c1f8ebee1d slight typo in parameters fixed 2020-06-01 22:25:21 -07:00
shockrah
b3289ca9bd Basic router skeleton for freechat's new auth/dispatch model 2020-06-01 22:25:01 -07:00
shockrah
c98d6dc503 Dependancies moving to full asynchronous libraries 2020-06-01 22:19:06 -07:00
shockrah
5a2a87fff7 /channels/list/voice + text now implemted and ready for testing 2020-05-27 21:29:57 -07:00
shockrah
e99e30b45c Moved VOICE_CHANNEL & TEXT_CHANNEL const's to channels module 2020-05-27 21:29:27 -07:00
shockrah
4e61ddbe11 New smol note regarding state of API server 2020-05-27 20:59:17 -07:00
shockrah
cc22a56538 Removed used Generic error response 2020-05-27 19:59:01 -07:00
shockrah
ea2cccb024 note regarding badges ready for actual badges notes 2020-05-26 02:40:29 -07:00
shockrah
d3bcb5a623 more formatting fixes 2020-05-25 14:00:15 -07:00
shockrah
bcff4f02a7 updated bullet point formatting as gitlab clobbered newlines 2020-05-25 13:51:47 -07:00
shockrah
1cb95cb59e Merging updated docs with updated get_<type>_channels uris 2020-05-25 13:48:23 -07:00
shockrah
db901010b0 prefixed route uri for get_voice_channels and get_text_channels with /list to be more specific to their behavior 2020-05-25 13:48:16 -07:00
shockrah
d9ac6c08a2 experimental generic error handler 2020-05-25 13:46:57 -07:00
shockrahwow
edca7b3a4a new docs builder script to be used by the docker container later 2020-05-25 13:41:03 -07:00
shockrahwow
0cddfc3289 structures section now in its own page 2020-05-25 13:40:19 -07:00
shockrahwow
e945897ac1 removed old outdated docs 2020-05-25 13:39:49 -07:00
shockrahwow
ec25992578 moved structures secction to its own .md + sub sectioned everything to fit into a greater sub context in the full docs 2020-05-25 13:38:24 -07:00
shockrah
b29f9d6934 api::auth route parameters have updated notes regarding types 2020-05-25 13:16:58 -07:00
shockrah
a14b7dd677 removed old web files which are no longer used 2020-05-22 16:26:22 -07:00
shockrah
13ab387a93 new test for encode params 2020-05-20 02:05:43 -07:00
shockrah
97e6b026cc utils::new_key now has a larger entropy pool + is generally smaller/quicker
encode params takes a &[u8] as parameter now instead of &str
utils::decode_params removed for now as it has not real use atm
2020-05-20 02:05:06 -07:00
shockrah
4f64fc3a13 utils::decode_params now uses the same config as utils::encode_params 2020-05-20 01:21:01 -07:00
shockrah
40d4720977 Helper function in test::auth to quickly build fake users
New test to verify correct behavior of '/auth/login' route
2020-05-20 00:50:46 -07:00
shockrah
ab4fe70081 test::auth::mysql_conn helper function for mysql connections
test::auth::feed_n_leave added form header and cleaned up post parameters
test::auth::dummy_leave standalone test for route => /auth/leave
2020-05-19 21:48:13 -07:00
shockrah
f12048b49b utils::encode_param now encodes data without padding 2020-05-19 21:46:17 -07:00
shockrah
84ccfff2aa auth::login now emites a url safe api session key
models::_USER_ONLINE updated to suppress unused var warnings
2020-05-19 20:15:53 -07:00
shockrah
895d7246f0 auth::create_new_session_key => impl not tested
auth::login now generates a 500 on db insertion failure
auth::login returning single json value instead of full struct
2020-05-19 20:13:56 -07:00
shockrah
87fc6700a4 models::InsertableSession added for session creation 2020-05-19 20:10:39 -07:00
shockrah
ec4f9b5302 using secret as primary key 2020-05-19 20:08:26 -07:00