HALP Backend

How to run in dev env

First make sure you have the appropriate packages installed.

Normal

Install dependencies

Python 3.9.5 is required

pip install -r requirements.txt

Run

python3 main.py

Docker

Building docker file

sudo docker build -t halp-backend .

Running with normal docker

sudo docker run -it -p 8080:8080 halp-backend 

REST API


http://ip:8080/get_sessions [POST]

About

Returns all the currently configured sessions

Form Data

auth: One of the accepted authorization tokens

Error codes

Invalid Auth 403: Auth is not one of the accepted


http://ip:8080/submit_playercount [POST]

About

Submit playercount is the api to upload the raw player count or an image of the playerlist following the internal standard.

Form Data

auth: One of the accepted authorization tokens.
mode: either OCR or rawCount, case sensative.
session: One of the configured sessions.
playercount [rawCount]: number of players in session.
playerlist [OCR]: png file of the playerlist sent by screenshotter application, exclusively the name+crewtag
count_img [OCR]: png file of the playercount, e.g. "GTA Online (Public, X)"

Playerlist image example
playerlist example

Count image example
count example

Error codes

Invalid Auth 403: Auth is not one of the accepted
Session not found 400: The provided session name is not in configured session list.
No Playercount 400 [rawCount]: No playercount variable has been entered
Invalid Playercount 400 [rawCount]: playercount should only consist of numbers
Invalid images 400 [OCR]: something is wrong with either the playerlist image or count image


http://ip:8080/uploads/<name> [GET]

About

File from uploads folder with specified name.


http://ip:8080/read_player_list [POST]

About

Returns json with data for the/each session

{
  "clifford": {
    "matched": [
      "capt_capslock"
    ],
    "unmatched": {
      "CliffordGTAV": {
        "matchChance": 24,
        "matchName": "capt_capslock",
        "subMatchChance": 24,
        "subMatchName": "capt_capslock"
      },
      "SpadgeVEVO": {
        "matchChance": 26,
        "matchName": "capt_capslock",
        "subMatchChance": 26,
        "subMatchName": "capt_capslock"
      },
      "blazeroman": {
        "matchChance": 17,
        "matchName": "capt_capslock",
        "subMatchChance": 17,
        "subMatchName": "capt_capslock"
      }
    }
  }
}

For the test, we only tried matching against capt_capslock

Form Data

auth: One of the accepted authorization tokens.
session: One of the configured sessions.
playerList: Comma separated list with names to match against. Example: name1,name2,name3

Error codes

Invalid Auth 403: Auth is not one of the accepted.
Session not found 400: The provided session name is not in configured session list.


http://ip:8080/uploads/<name> [GET]

About

Returns the file with name specified

Form Data

auth: One of the accepted authorization tokens.

Error codes

Invalid Auth 403: Auth is not one of the accepted.