fix: Windows兼容 + Textual 8.x + MD3 SVG图标替代emoji
1. Windows: reuse_port 仅非win32平台启用 2. Textual 8.2.7: refresh() 加 **kwargs 兼容 repaint 参数 3. WebUI: 设置页/插件页 emoji → SVG (fill:currentColor 日夜间适配) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -48,11 +48,15 @@ class InternetService:
|
||||
self.http_runner = web.AppRunner(self.http_app)
|
||||
await self.http_runner.setup()
|
||||
|
||||
# SO_REUSEPORT: Linux/macOS only, Windows 不支持
|
||||
import sys as _sys
|
||||
_reuse_port = _sys.platform != "win32"
|
||||
|
||||
# 1. 启动 HTTP 站点
|
||||
try:
|
||||
self.site = web.TCPSite(
|
||||
self.http_runner, self.http_host, self.http_port,
|
||||
reuse_address=True, reuse_port=True
|
||||
self.http_runner, self.http_host, self.http_port,
|
||||
reuse_address=True, reuse_port=_reuse_port,
|
||||
)
|
||||
await self.site.start()
|
||||
logger.info(f"✅ HTTP 服务已绑定: {self.http_host}:{self.http_port}")
|
||||
@@ -60,12 +64,12 @@ class InternetService:
|
||||
logger.error(f"❌ HTTP 端口 {self.http_port} 绑定失败: {e}")
|
||||
await self.http_runner.cleanup()
|
||||
return False
|
||||
|
||||
|
||||
# 2. 启动 WebSocket 站点 (独立端口)
|
||||
try:
|
||||
self.ws_site = web.TCPSite(
|
||||
self.http_runner, self.ws_host, self.ws_port,
|
||||
reuse_address=True, reuse_port=True
|
||||
self.http_runner, self.ws_host, self.ws_port,
|
||||
reuse_address=True, reuse_port=_reuse_port,
|
||||
)
|
||||
await self.ws_site.start()
|
||||
logger.info(f"✅ WebSocket 服务已绑定: {self.ws_host}:{self.ws_port}")
|
||||
|
||||
@@ -425,7 +425,7 @@ class SystemMonitor(Static):
|
||||
def set_collector(self, c):
|
||||
self._collector = c
|
||||
|
||||
def refresh(self):
|
||||
def refresh(self, **kwargs):
|
||||
"""由外部 asyncio task 驱动刷新(比 set_interval 更抗 Android 挂起)"""
|
||||
self._refresh_stats()
|
||||
try:
|
||||
@@ -479,7 +479,7 @@ class PluginStatusPanel(Static):
|
||||
def set_plugin_service(self, svc):
|
||||
self._plugin_service = svc
|
||||
|
||||
def refresh(self):
|
||||
def refresh(self, **kwargs):
|
||||
"""由外部 asyncio task 驱动刷新"""
|
||||
self._refresh()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user