From f37a38dc58d8fca4c5f906bd91c17dfb17e37a80 Mon Sep 17 00:00:00 2001 From: Iam54r1n4 Date: Fri, 24 Jan 2025 11:07:09 +0000 Subject: [PATCH] Fix a small bug in cli_api.py --- core/cli_api.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/cli_api.py b/core/cli_api.py index 6fc1044..cdab689 100644 --- a/core/cli_api.py +++ b/core/cli_api.py @@ -2,7 +2,7 @@ import os import subprocess from enum import Enum from datetime import datetime - +import json import traffic DEBUG = False @@ -149,18 +149,20 @@ def backup_hysteria(): # region User -def list_users() -> str | None: +def list_users() -> dict | None: """ Lists all users. """ - return run_cmd(['bash', Command.LIST_USERS.value]) + if res := run_cmd(['bash', Command.LIST_USERS.value]): + return json.loads(res) -def get_user(username: str) -> str | None: +def get_user(username: str) -> dict | None: """ Retrieves information about a specific user. """ - return run_cmd(['bash', Command.GET_USER.value, '-u', str(username)]) + if res := run_cmd(['bash', Command.GET_USER.value, '-u', str(username)]): + return json.loads(res) def add_user(username: str, traffic_limit: int, expiration_days: int, password: str, creation_date: str):