Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/api/account_search.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from fastapi import APIRouter, Form, Request
from fastapi.responses import HTMLResponse

from src.core.config import BD_API, CONFIG, templates
from src.core.config import BD_API, templates

router = APIRouter()


@router.get("/account-search")
async def account_search(request: Request) -> HTMLResponse:
async def get_account_search(request: Request) -> HTMLResponse:
return templates.TemplateResponse("pages/account_search.html", {"request": request})


@router.post("/account-search")
async def account_search(request: Request, username: str = Form(...)) -> HTMLResponse:
async def post_account_search(request: Request, username: str = Form(...)) -> HTMLResponse:
# You can access the submitted username using the "username" variable
prediction = await BD_API.get_prediction(name=username)
response = {"request": request, "prediction": prediction}
Expand Down
2 changes: 1 addition & 1 deletion src/api/contact.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse

from src.core.config import CONFIG, templates
from src.core.config import templates

router = APIRouter()

Expand Down
2 changes: 1 addition & 1 deletion src/api/contributors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter, Request

from src.core.config import CONFIG, templates
from src.core.config import templates

router = APIRouter()

Expand Down
2 changes: 1 addition & 1 deletion src/api/cookies.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse

from src.core.config import CONFIG, templates
from src.core.config import templates

router = APIRouter()

Expand Down
2 changes: 1 addition & 1 deletion src/api/faq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter, Request

from src.core.config import CONFIG, templates
from src.core.config import templates

router = APIRouter()

Expand Down
2 changes: 1 addition & 1 deletion src/api/home.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fastapi import APIRouter, Request
from pydantic import BaseModel

from src.core.config import BD_API, CONFIG, templates
from src.core.config import BD_API, templates

router = APIRouter()

Expand Down
32 changes: 16 additions & 16 deletions src/app/controllers/bot_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ def __init__(
self.token = token

async def get_prediction(self, name: str):
url = f"{self.base_url}/v1/prediction?name={name}"
url = f"{self.base_url}/v2/player/prediction?name={name}&breakdown=true"
async with self.session.get(url) as response:
data = await response.json()
return data

async def get_xp_change(self, player_id: str):
url = f"{self.base_url}/v1/hiscore/XPChange?token={self.token}&player_id={player_id}"
async with self.session.get(url) as response:
data = await response.json()
return data
# async def get_xp_change(self, player_id: str):
# url = f"{self.base_url}/v1/hiscore/XPChange?token={self.token}&player_id={player_id}"
# async with self.session.get(url) as response:
# data = await response.json()
# return data

async def get_highscore_latest(self, player_id: str):
url = f"{self.base_url}/v1/hiscore/Latest?token={self.token}&player_id={player_id}"
async with self.session.get(url) as response:
data = await response.json()
return data
# async def get_highscore_latest(self, player_id: str):
# url = f"{self.base_url}/v1/hiscore/Latest?token={self.token}&player_id={player_id}"
# async with self.session.get(url) as response:
# data = await response.json()
# return data

async def get_player(self, player_name: str):
url = f"{self.base_url}/v1/player?token={self.token}&player_name={player_name}"
async with self.session.get(url) as response:
data = await response.json()
return data
# async def get_player(self, player_name: str):
# url = f"{self.base_url}/v1/player?token={self.token}&player_name={player_name}"
# async with self.session.get(url) as response:
# data = await response.json()
# return data

async def get_project_stats(self):
url = f"{self.base_url}/site/dashboard/projectstats"
Expand Down
4 changes: 2 additions & 2 deletions src/core/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def create_app() -> FastAPI:
app = create_app()

@app.head("/")
def root(request: Request):
def head_root(request: Request):
return {"hello":"world"}

@app.get("/")
def root(request: Request):
def get_root(request: Request):
return RedirectResponse(request.url_for("home"))
Loading