nonebot-plugin-shiro-web-console 0.1.18__tar.gz → 0.1.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of nonebot-plugin-shiro-web-console might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-shiro-web-console
3
- Version: 0.1.18
3
+ Version: 0.1.19
4
4
  Summary: 一个用于 NoneBot2 的网页控制台插件,支持通过浏览器查看日志和发送消息
5
5
  Project-URL: Homepage, https://github.com/luojisama/nonebot-plugin-shiro-web-console
6
6
  Project-URL: Bug Tracker, https://github.com/luojisama/nonebot-plugin-shiro-web-console/issues
@@ -61,6 +61,9 @@ web_console_password=your_password # 设置固定登录密码
61
61
 
62
62
  ## 更新日志
63
63
 
64
+ ### v0.1.19
65
+ - **修复**:优化插件版本检测逻辑,增加对连字符命名和 PyPI 包名的兼容性匹配,解决更新后版本号不刷新的问题。
66
+
64
67
  ### v0.1.18
65
68
  - **修复**:尝试通过清理工作流配置来解决 GitHub Actions 触发失效问题。
66
69
  - **修复**:修复 WebSocket 连接清理时的竞争条件(KeyError),解决偶发的 500 错误。
@@ -30,6 +30,9 @@ web_console_password=your_password # 设置固定登录密码
30
30
 
31
31
  ## 更新日志
32
32
 
33
+ ### v0.1.19
34
+ - **修复**:优化插件版本检测逻辑,增加对连字符命名和 PyPI 包名的兼容性匹配,解决更新后版本号不刷新的问题。
35
+
33
36
  ### v0.1.18
34
37
  - **修复**:尝试通过清理工作流配置来解决 GitHub Actions 触发失效问题。
35
38
  - **修复**:修复 WebSocket 连接清理时的竞争条件(KeyError),解决偶发的 500 错误。
@@ -35,7 +35,7 @@ __plugin_meta__ = PluginMetadata(
35
35
  supported_adapters={"~onebot.v11"},
36
36
  extra={
37
37
  "author": "luojisama",
38
- "version": "0.1.18",
38
+ "version": "0.1.19",
39
39
  "pypi_test": "nonebot-plugin-shiro-web-console",
40
40
  },
41
41
  )
@@ -646,17 +646,27 @@ if app:
646
646
  # 获取版本号
647
647
  ver = "0.0.0"
648
648
  # 优先尝试从 importlib 获取真实安装版本
649
- try:
650
- # 尝试将包名中的下划线替换为连字符(常见 PyPI 命名规范)
651
- pkg_name = module_name.replace("_", "-")
652
- ver = version(pkg_name)
653
- except PackageNotFoundError:
649
+ # 插件包名通常与模块名一致,或者将下划线替换为连字符
650
+ pkg_names_to_try = [
651
+ module_name,
652
+ module_name.replace("_", "-"),
653
+ f"nonebot-plugin-{module_name.split('.')[-1]}"
654
+ ]
655
+
656
+ # 如果是 nb_cli 安装的插件,可能需要读取 pyproject.toml (这里简化处理,依赖 importlib)
657
+ for pkg_name in pkg_names_to_try:
654
658
  try:
655
- ver = version(module_name)
659
+ ver = version(pkg_name)
660
+ break
656
661
  except PackageNotFoundError:
657
- # 如果获取失败,回退到元数据中的版本
658
- if metadata and metadata.extra and "version" in metadata.extra:
659
- ver = metadata.extra.get("version", "0.0.0")
662
+ continue
663
+
664
+ # 如果 importlib 失败,回退到元数据
665
+ if ver == "0.0.0" and metadata:
666
+ if metadata.extra and "version" in metadata.extra:
667
+ ver = metadata.extra.get("version", "0.0.0")
668
+ elif hasattr(metadata, "version") and metadata.version:
669
+ ver = metadata.version
660
670
 
661
671
  plugins.append({
662
672
  "id": p.name,
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-shiro-web-console"
3
- version = "0.1.18"
3
+ version = "0.1.19"
4
4
  description = "一个用于 NoneBot2 的网页控制台插件,支持通过浏览器查看日志和发送消息"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"