mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-17 21:40:31 +00:00
[+] Now include the server's version before launching
This commit is contained in:
parent
9756697420
commit
11fcb0f89c
@ -236,10 +236,12 @@ def server_run(user: UserRecord, name: str) -> tuple[HTTPStatus, Union[str, None
|
|||||||
mc_manager.set_cooldown(user_id=user_id)
|
mc_manager.set_cooldown(user_id=user_id)
|
||||||
try:
|
try:
|
||||||
port: int = firebase_manager.get_server_port(user_id)
|
port: int = firebase_manager.get_server_port(user_id)
|
||||||
server_id = mc_manager.start_server(f"users/{user_id}/{name}", port, user_id, name)
|
version: str = firebase_manager.get_server_field(user_id, name, "version")
|
||||||
|
if version is None:
|
||||||
|
return HTTPStatus.NOT_FOUND, f"Server {name} not found."
|
||||||
|
server_id = mc_manager.start_server(f"users/{user_id}/{name}", port, user_id, name, version)
|
||||||
if server_id is None:
|
if server_id is None:
|
||||||
return HTTPStatus.OK, f"You cannot run multiples instances at this time."
|
return HTTPStatus.OK, f"You cannot run multiples instances at this time."
|
||||||
mc_manager.servers[server_id]['port'] = int(port)
|
|
||||||
try:
|
try:
|
||||||
firebase_manager.update_server_running_state(user_id, name, True)
|
firebase_manager.update_server_running_state(user_id, name, True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -324,5 +326,6 @@ def run_command(user: UserRecord, command: str, name: str) -> tuple[HTTPStatus,
|
|||||||
def scheduled_actions() -> None:
|
def scheduled_actions() -> None:
|
||||||
mc_manager.check_servers_idle()
|
mc_manager.check_servers_idle()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user