From 857e58d635014e1811b8531cd074c67a31024c4e Mon Sep 17 00:00:00 2001 From: snowy Date: Fri, 26 Apr 2024 12:39:43 +0800 Subject: [PATCH] =?UTF-8?q?:=20zap:=20=E6=B7=BB=E5=8A=A0api=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E8=B6=85=E6=97=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/liteyuki_main/loader.py | 5 +++-- liteyuki/resources/templates/js/status.js | 1 + liteyuki/utils/__init__.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/liteyuki/liteyuki_main/loader.py b/liteyuki/liteyuki_main/loader.py index 2333ce80..4510806a 100644 --- a/liteyuki/liteyuki_main/loader.py +++ b/liteyuki/liteyuki_main/loader.py @@ -10,11 +10,10 @@ load_resources() init_log() nonebot.plugin.load_plugins("liteyuki/plugins") - # 从数据库读取已安装的插件 if not get_config("safe_mode", False): # 安全模式下,不加载插件 - nonebot.plugin.load_plugins("plugins") + installed_plugins: list[InstalledPlugin] = plugin_db.all(InstalledPlugin()) if installed_plugins: for installed_plugin in installed_plugins: @@ -22,5 +21,7 @@ if not get_config("safe_mode", False): nonebot.logger.error(f"{installed_plugin.module_name} not installed, but in loading database. please run `npm fixup` in chat to reinstall it.") else: nonebot.load_plugin(installed_plugin.module_name) + + nonebot.plugin.load_plugins("plugins") else: nonebot.logger.info("Safe mode is on, no plugin loaded.") diff --git a/liteyuki/resources/templates/js/status.js b/liteyuki/resources/templates/js/status.js index 4bf5a170..6d59c7c4 100644 --- a/liteyuki/resources/templates/js/status.js +++ b/liteyuki/resources/templates/js/status.js @@ -189,6 +189,7 @@ function main() { `${localData['free']} ${convertSize(swapData['free'])}`, `${localData['total']} ${convertSize(swapData['total'])}` ] + console.log(cpuTagArray, memTagArray, swapTagArray) } diff --git a/liteyuki/utils/__init__.py b/liteyuki/utils/__init__.py index 2dc9f155..13d7f188 100644 --- a/liteyuki/utils/__init__.py +++ b/liteyuki/utils/__init__.py @@ -30,7 +30,7 @@ def register_bot(): } try: nonebot.logger.info("Waiting for register to Liteyuki...") - resp = requests.post(url, json=data) + resp = requests.post(url, json=data, timeout=(10, 15)) if resp.status_code == 200: data = resp.json() if liteyuki_id := data.get("liteyuki_id"):