GC, Seed and User management (#52)

* Update sql to map uuid to token

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Fix millis to secs conversion

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add synchronisation to media enpoint DB access

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change error code for rate limiter

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* move prepared statements to Thread Local Storage

* Change test end points

* init GC

* Add GC

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change status return

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Auto generate token in db

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Remove user management and rate limiting

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add seed for random number generator

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Store random instance as class member

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update locustfile

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add API documentation

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Move updateTimeStamp to getChallenge methdod
Remove user tables for the DB

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update Timestamp when creating mapId entry

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add request method type

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Minor fixes

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
Rahul Rudragoudar
2020-09-23 22:58:42 +05:30
committed by GitHub
parent 2b02d49e4f
commit 5c3bdfeb83
4 changed files with 193 additions and 143 deletions

View File

@@ -44,6 +44,55 @@ An image of a word is blurred before being shown to the user.
### LabelCaptcha
An image that has a pair of words is created. The answer to one of the words is known and to that of the other is unknown. The user is tested on the known word, and their answer to the unknown word is recorded. If a sufficient number of users agree on their answer to the unknown word, it is transferred to the list of known words.
***
## HTTP API
### - `/captcha`: `POST`
- Parameters:
- `level`: `String` -
The difficulty level of a captcha
- easy
- medium
- hard
- `input_type`: `String` -
The type of input option for a captcha
- text
- click (choose)
- `media`: `String` -
The type of media of a captcha
- image
- audio
- gif
- `size`: `dict` -
The dimensions of a captcha (Optional). It needs two more fields nested in this parameter
- `height`: `Int`
- `width`: `Int`
- Return type:
- `id`: `String` - The uuid of the captcha generated
### - `/media`: `POST`,`GET`
- Parameters:
- `id`: `String` - The uuid of the captcha
- Return type:
- `image`: `Array[Byte]` - The requested media as bytes
### - `/answer`: `POST`
- Parameter:
- `id`: `String` - The uuid of the captcha that needs to be solved
- `answer`: `String` - The answer to the captcha that needs to be validated
- Return Type:
- `result`: `String` - The result after validation/checking of the answer
- True - If the answer is correct
- False - If the answer is incorrect
- Expired - If the time limit to solve the captcha exceeds
***
## Roadmap
Things to do in the future: