Closed jayceslesar closed 5 months ago
@carterwward ping for review
So from my understanding this PR adds API authentication and a demo stream endpoint to the anti-cheat developer API, does that sound right @jayceslesar ? Wanting to make sure I understand what I am looking at and reading.
So from my understanding this PR adds API authentication and a demo stream endpoint to the anti-cheat developer API, does that sound right @jayceslesar ? Wanting to make sure I understand what I am looking at and reading.
Yeah that is correct -- some auth existed but this formalizes into litestar guards, which are executed before any code actually described in the endpoint(s) they belong to. I would argue the same thing that flask offers in decorators but no funny explicit names needed
So from my understanding this PR adds API authentication and a demo stream endpoint to the anti-cheat developer API, does that sound right @jayceslesar ? Wanting to make sure I understand what I am looking at and reading.
Yeah that is correct -- some auth existed but this formalizes into litestar guards, which are executed before any code actually described in the endpoint(s) they belong to. I would argue the same thing that flask offers in decorators but no funny explicit names needed
Makes sense, the litestar docs are much appreciated.
Closes #18
This is a slightly beefy PR, but formalizes the API into authenticating, and validating the user is authenticated in all steps possible as well as enables users to stream demos to the db...
First we need to install.
Clone and CD into the repo and then install:
Ensure you have docker installed. Export the following environment variables: (The docker-compose.yml will pick up on these)
Run database migrations, this will ensure that the DB in docker is up to date with the current revision:
Run the litestar app and head to the
provision
Then open it in your browser of choice and head to
http://127.0.0.1:8000/provision
, sign in with steam, and save your API key that it spits out. You will need this.In a new file, paste in the following:
Paste the
session_id
in the response into yoursession_id
variable aboveGo ahead and connect to the database, I use
pgcli
but you can use whateversome sample queries:
Now, go ahead and either add to the existing python file you made or make a new one:
Once this is done, you will see your byte data in the
demo
field of thedemo_sessions
table!I would eventually like to add tests back but anything at this point is a full integration test which is fine, but will just suck 2 hours of my time up to write...