[+] Server deletion safety

Errors are correctly logged in firebase.
User can't break the website anymore.

Signed-off-by: Charles Le Maux <charles.le-maux@epitech.eu>
This commit is contained in:
Charles Le Maux 2024-07-11 16:12:54 +01:00
parent fa9ba6d3e0
commit cef726b3b6

View File

@ -168,6 +168,7 @@ def server_stop(user: UserRecord, name: str) -> tuple[HTTPStatus, str or None]:
user_id: str = user.uid user_id: str = user.uid
if mc_manager.has_cooldown(user_id=user_id): if mc_manager.has_cooldown(user_id=user_id):
return HTTPStatus.FORBIDDEN, f"Wait 30 seconds before stopping '{name}'." return HTTPStatus.FORBIDDEN, f"Wait 30 seconds before stopping '{name}'."
mc_manager.set_cooldown(user_id=user_id)
try: try:
port = firebase_manager.get_server_port(user_id) port = firebase_manager.get_server_port(user_id)
if port is None: if port is None: