refactor(plugins): comprehensive code review - ~35 fixes across 14 plugins
Phase 1 - Plugin code review (14/14 plugins): - Security: 3x token leak in print→logger.debug, Bearer prefix handling - Bug: bare except→specific exceptions, HorseState type safety, sync→async - Critical: response_model undefined, route dead code, sync blocking event loop - Quality: 11x print()→logger, variable name shadowing, consistent logging Phase 2 - Deep analysis: - Fix: payout int truncation→max(1, round(amount*odds)) - Fix: room_store get_lock race condition→dict.setdefault() - Verify: data_manager f-string SQL is safe (uses ? placeholders) Infrastructure: review reports generated for all plugins.
This commit is contained in:
@@ -1,42 +1,40 @@
|
||||
"""Danding_QqPush 插件配置模块"""
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Config(BaseModel):
|
||||
"""插件配置"""
|
||||
|
||||
Token: str = "danding-8HkL9xQ2"
|
||||
"""API 访问 Token,用于鉴权"""
|
||||
|
||||
# 图片生成配置
|
||||
ImageWidth: int = 800
|
||||
"""生成的图片宽度(像素)"""
|
||||
|
||||
ImageFontSize: int = 24
|
||||
"""字体大小(像素)"""
|
||||
|
||||
ImagePadding: int = 30
|
||||
"""图片内边距(像素)"""
|
||||
|
||||
ImageLineSpacing: float = 1.4
|
||||
"""行距倍数"""
|
||||
|
||||
ImageBgColor: tuple = (252, 252, 252)
|
||||
"""图片背景颜色 (R, G, B)"""
|
||||
|
||||
ImageTextColor: tuple = (0, 0, 0)
|
||||
"""文本颜色 (R, G, B)"""
|
||||
|
||||
# 文本处理配置
|
||||
MaxTextLength: int = 2000
|
||||
"""最大文本长度(字符数),超过将截断"""
|
||||
|
||||
# 字体路径配置
|
||||
FontPaths: list = [
|
||||
"/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
|
||||
"/usr/share/fonts/wqy-microhei/wqy-microhei.ttc",
|
||||
"/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc",
|
||||
"C:/Windows/Fonts/msyh.ttc",
|
||||
"C:/Windows/Fonts/simhei.ttf",
|
||||
]
|
||||
"""字体文件路径列表"""
|
||||
"""Danding_QqPush 插件配置模块"""
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Config(BaseModel):
|
||||
"""插件配置"""
|
||||
|
||||
Token: str = ""
|
||||
"""API 访问 Token,用于鉴权(必须在 .env 中配置 DANDING_QQPUSH_TOKEN)"""
|
||||
|
||||
# 图片生成配置
|
||||
ImageWidth: int = 800
|
||||
"""生成的图片宽度(像素)"""
|
||||
|
||||
ImageFontSize: int = 24
|
||||
"""字体大小(像素)"""
|
||||
|
||||
ImagePadding: int = 30
|
||||
"""图片内边距(像素)"""
|
||||
|
||||
ImageLineSpacing: float = 1.4
|
||||
"""行距倍数"""
|
||||
|
||||
ImageBgColor: tuple = (252, 252, 252)
|
||||
"""图片背景颜色 (R, G, B)"""
|
||||
|
||||
ImageTextColor: tuple = (0, 0, 0)
|
||||
"""文本颜色 (R, G, B)"""
|
||||
|
||||
# 文本处理配置
|
||||
MaxTextLength: int = 2000
|
||||
"""最大文本长度(字符数),超过将截断"""
|
||||
|
||||
# 字体路径配置
|
||||
FontPaths: list = ("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
|
||||
"/usr/share/fonts/wqy-microhei/wqy-microhei.ttc",
|
||||
"/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc",
|
||||
"C:/Windows/Fonts/msyh.ttc",
|
||||
"C:/Windows/Fonts/simhei.ttf",)
|
||||
"""字体文件路径列表"""
|
||||
|
||||
Reference in New Issue
Block a user