mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
🐛 自检html修正
This commit is contained in:
parent
3b4c206a24
commit
db9153f42c
@ -161,12 +161,15 @@ body {
|
||||
.status-text {
|
||||
font-family: 'fzrzFont';
|
||||
color: #EC859F;
|
||||
height: 90px;
|
||||
display: flex;
|
||||
height: 185px;
|
||||
}
|
||||
|
||||
.status-text-title {
|
||||
height: 25%;
|
||||
/* height: 25%; */
|
||||
display: flex;
|
||||
/* justify-content: center; */
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
|
||||
@ -68,18 +68,10 @@
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="status-text">
|
||||
<div>
|
||||
<p class="status-text-title">CPU</p>
|
||||
<p class="status-text-title">SYSTEM</p>
|
||||
<p class="status-text-title">VERSION</p>
|
||||
<p class="status-text-title">PLUGINS</p>
|
||||
</div>
|
||||
<div style="margin-left: 37px;">
|
||||
<p class="status-text-title" style="font-size: 14px;line-height: 18.5px;">{{data.brand_raw}}</p>
|
||||
<p class="status-text-title">{{data.system}}</p>
|
||||
<p class="status-text-title">{{data.version}}</p>
|
||||
<p class="status-text-title">{{data.plugin_count}} loaded</p>
|
||||
</div>
|
||||
<p class="status-text-title">CPU <span style="font-size: 12px;line-height: 18.5px;">{{data.brand_raw}}</span></p>
|
||||
<p class="status-text-title">SYSTEM <span style="font-size: 13px;line-height: 18.5px;">{{data.system}}</span></p>
|
||||
<p class="status-text-title">VERSION <span>{{data.version}}</span></p>
|
||||
<p class="status-text-title">PLUGINS <span>{{data.plugin_count}} loaded</span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tip">Create By Zhenxun</div>
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
from nonebot.rule import to_me
|
||||
from nonebot.permission import SUPERUSER
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot_plugin_session import EventSession
|
||||
from nonebot_plugin_htmlrender import template_to_pic
|
||||
from nonebot.rule import to_me
|
||||
from nonebot_plugin_alconna import Alconna, Arparma, on_alconna
|
||||
from nonebot_plugin_htmlrender import template_to_pic
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.path_config import TEMPLATE_PATH
|
||||
from zhenxun.configs.utils import PluginExtraData
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.configs.utils import PluginExtraData
|
||||
from zhenxun.configs.path_config import TEMPLATE_PATH
|
||||
|
||||
from .data_source import get_status_info
|
||||
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
import platform
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import psutil
|
||||
import cpuinfo
|
||||
import nonebot
|
||||
from pydantic import BaseModel
|
||||
import psutil
|
||||
from httpx import ConnectTimeout, NetworkError
|
||||
from nonebot.utils import run_sync
|
||||
from httpx import NetworkError, ConnectTimeout
|
||||
from pydantic import BaseModel
|
||||
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.configs.config import BotConfig
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.http_utils import AsyncHttpx
|
||||
|
||||
BAIDU_URL = "https://www.baidu.com/"
|
||||
@ -105,11 +105,17 @@ class SystemInfo(BaseModel):
|
||||
"cpu_info": f"{self.cpu.usage}% - {self.cpu.freq}Ghz [{self.cpu.core} core]",
|
||||
"cpu_process": psutil.cpu_percent(),
|
||||
"ram_info": f"{self.ram.usage} / {self.ram.total} GB",
|
||||
"ram_process": self.ram.usage / self.ram.total * 100,
|
||||
"ram_process": (
|
||||
0 if self.ram.total == 0 else (self.ram.usage / self.ram.total * 100)
|
||||
),
|
||||
"swap_info": f"{self.swap.usage} / {self.swap.total} GB",
|
||||
"swap_process": self.swap.usage / self.swap.total * 100,
|
||||
"swap_process": (
|
||||
0 if self.swap.total == 0 else (self.swap.usage / self.swap.total * 100)
|
||||
),
|
||||
"disk_info": f"{self.disk.usage} / {self.disk.total} GB",
|
||||
"disk_process": self.disk.usage / self.disk.total * 100,
|
||||
"disk_process": (
|
||||
0 if self.disk.total == 0 else (self.disk.usage / self.disk.total * 100)
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@ -142,10 +148,11 @@ async def __get_network_info():
|
||||
|
||||
def __get_version() -> str | None:
|
||||
"""获取版本信息"""
|
||||
with open(VERSION_FILE, encoding="utf-8") as f:
|
||||
if text := f.read():
|
||||
text.split(":")[-1]
|
||||
return None
|
||||
if VERSION_FILE.exists():
|
||||
with open(VERSION_FILE, encoding="utf-8") as f:
|
||||
if text := f.read():
|
||||
return text.split(":")[-1]
|
||||
return None
|
||||
|
||||
|
||||
async def get_status_info() -> dict:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user