This commit is contained in:
KaseToatz1337
2024-04-26 14:16:24 +02:00
parent 92e1d3b0c0
commit ce58078280
4 changed files with 4 additions and 6 deletions

4
app.py
View File

@ -13,14 +13,12 @@ import itertools
from argparse import ArgumentParser from argparse import ArgumentParser
from fastapi import FastAPI, Form from fastapi import FastAPI, Form
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from fastapi.middleware.cors import CORSMiddleware
class App(FastAPI): class App(FastAPI):
def __init__(self) -> None: def __init__(self) -> None:
super().__init__(title="Kahoot API", openapi_url=None) super().__init__(title="Kahoot API", openapi_url=None)
self.add_middleware(CORSMiddleware, allow_origins=["*"]) self.semaphore = asyncio.Semaphore(5)
self.semaphore = asyncio.Semaphore(10)
async def connect(self, pin: int, name: str, number: int, namerator: bool = False) -> None: async def connect(self, pin: int, name: str, number: int, namerator: bool = False) -> None:
try: try:

BIN
html/assets/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -45,14 +45,14 @@ window.onload = () => {
formData.append("naming", naming.value) formData.append("naming", naming.value)
formData.append("name", name.value); formData.append("name", name.value);
formData.append("amount", parseInt(amount.value)); formData.append("amount", parseInt(amount.value));
text.value = "Flooding in progress..."; text.innerText = "Flooding in progress...";
text.style.color = "green"; text.style.color = "green";
var request = await fetch("/api/flood", { var request = await fetch("/api/flood", {
method: "POST", method: "POST",
body: formData body: formData
}) })
response = await request.json(); response = await request.json();
text.value = response.message; text.innerText = response.message;
if (response.type == "error") if (response.type == "error")
{ {
text.style.color = "red"; text.style.color = "red";

View File

@ -4,7 +4,7 @@
<title>Kahoot Flooder</title> <title>Kahoot Flooder</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet'> <link rel="icon" href="assets/favicon.ico">
<link rel="stylesheet" href="assets/style.css"> <link rel="stylesheet" href="assets/style.css">
<script type="text/javascript" src="assets/script.js"></script> <script type="text/javascript" src="assets/script.js"></script>
</head> </head>