From 9ee2cde30d99decdea2b4a01c7bf2bc7cee0e128 Mon Sep 17 00:00:00 2001 From: Kyomotoi <0w0@imki.moe> Date: Sun, 16 Oct 2022 10:12:38 +0800 Subject: =?UTF-8?q?=F0=9F=90=9B=20=E6=B7=BB=E5=8A=A0=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=89=BE=E5=88=B0=E6=96=87=E4=BB=B6=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/console/driver/api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ATRI/plugins/console/driver/api.py b/ATRI/plugins/console/driver/api.py index acdf521..4750148 100644 --- a/ATRI/plugins/console/driver/api.py +++ b/ATRI/plugins/console/driver/api.py @@ -51,7 +51,7 @@ def get_processing_data() -> tuple: PlatformRuntimeInfo( stat_msg=msg, cpu_percent=str(p_cpu), - mem_percent=p_mem, + mem_percent=str(p_mem), disk_percent=str(disk), inte_send=str(inte_send), inte_recv=str(inte_recv), @@ -138,13 +138,18 @@ MANEGE_DIR = Path(".") / "data" / "plugins" / "manege" def get_block_list() -> dict: + u_data = dict() + g_data = dict() + u_f = "block_user.json" path = MANEGE_DIR / u_f - u_data = json.loads(path.read_bytes()) + if path.is_file(): + u_data = json.loads(path.read_bytes()) g_f = "block_group.json" path = MANEGE_DIR / g_f - g_data = json.loads(path.read_bytes()) + if path.is_file(): + g_data = json.loads(path.read_bytes()) return {"user": u_data, "group": g_data} -- cgit v1.2.3