Files
NeoBot/web_static/changelog_generator/generate.py
K2cr2O1 c05ac03af1 feat: 更新配置和功能,修复B站解析问题
- 将WebSocket地址改为本地127.0.0.1
- 修改命令前缀为"/"
- 延长B站视频解析时长限制至2小时
- 更新版本号至v1.0.1并生成变更日志
- 完全重写依赖项列表
- 新增HTML格式的变更日志页面
2026-03-07 17:39:01 +08:00

72 lines
2.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import os
import sys
from datetime import datetime
from jinja2 import Environment, FileSystemLoader
# ==========================================
# 配置区域
# ==========================================
# 输出文件路径 (相对于当前脚本或绝对路径)
OUTPUT_FILE = "../changelog.html"
# 更新日志数据
# 格式说明:
# version: 版本号
# date: 日期 (YYYY-MM-DD)
# description: 版本描述 (可选)
# changes: 变更列表
# - type: 类型 (add, update, fix)
# - content: 变更内容
changelogs = [
{
"version": "v1.0.1",
"date": "2026-3-1",
"description": "大fix",
"changes": [
{"type": "add", "content": "镜像表情包支持GIf"},
{"type": "update", "content": "优化了 Web Parser 的解析速度"},
{"type": "fix", "content": "修复了在某些特定网络环境下图片加载失败的问题b站解析修复"},
{"type": "update", "content": "支持多实现端连接反向WS此功能并不完善"}
]
}
]
# ==========================================
# 生成逻辑 (通常不需要修改)
# ==========================================
def generate_changelog():
# 获取当前脚本所在目录
base_dir = os.path.dirname(os.path.abspath(__file__))
# 设置 Jinja2 环境
env = Environment(loader=FileSystemLoader(base_dir))
template = env.get_template("template.html")
# 获取最新版本号
latest_version = changelogs[0]["version"] if changelogs else "v0.0.0"
# 渲染模板
html_content = template.render(
log=changelogs[0] if changelogs else None,
latest_version=latest_version,
generated_at=datetime.now().strftime("%Y-%m-%d %H:%M:%S")
)
# 确定输出路径
output_path = os.path.join(base_dir, OUTPUT_FILE)
# 写入文件
try:
with open(output_path, "w", encoding="utf-8") as f:
f.write(html_content)
print(f"✅ 成功生成更新日志: {os.path.abspath(output_path)}")
except Exception as e:
print(f"❌ 生成失败: {e}")
if __name__ == "__main__":
generate_changelog()