nonebot-plugin-shiro-web-console 0.1.12__tar.gz → 0.1.13__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.
- {nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/PKG-INFO +1 -1
- {nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/nonebot_plugin_shiro_web_console/__init__.py +18 -2
- {nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/nonebot_plugin_shiro_web_console/static/index.html +15 -2
- {nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/pyproject.toml +1 -1
- {nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/.gitignore +0 -0
- {nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/LICENSE +0 -0
- {nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/README.md +0 -0
- {nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/nonebot_plugin_shiro_web_console/config.py +0 -0
{nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nonebot-plugin-shiro-web-console
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.13
|
|
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
|
|
@@ -35,7 +35,7 @@ __plugin_meta__ = PluginMetadata(
|
|
|
35
35
|
supported_adapters={"~onebot.v11"},
|
|
36
36
|
extra={
|
|
37
37
|
"author": "luojisama",
|
|
38
|
-
"version": "0.1.
|
|
38
|
+
"version": "0.1.13",
|
|
39
39
|
"pypi_test": "nonebot-plugin-shiro-web-console",
|
|
40
40
|
},
|
|
41
41
|
)
|
|
@@ -611,6 +611,7 @@ if app:
|
|
|
611
611
|
@app.get("/web_console/api/plugins", dependencies=[Depends(check_auth)])
|
|
612
612
|
async def get_plugins():
|
|
613
613
|
from nonebot import get_loaded_plugins
|
|
614
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
614
615
|
import os
|
|
615
616
|
plugins = []
|
|
616
617
|
for p in get_loaded_plugins():
|
|
@@ -627,11 +628,26 @@ if app:
|
|
|
627
628
|
elif module_name.startswith("nonebot_plugin_"):
|
|
628
629
|
plugin_type = "store"
|
|
629
630
|
|
|
631
|
+
# 获取版本号
|
|
632
|
+
ver = "0.0.0"
|
|
633
|
+
# 优先尝试从 importlib 获取真实安装版本
|
|
634
|
+
try:
|
|
635
|
+
# 尝试将包名中的下划线替换为连字符(常见 PyPI 命名规范)
|
|
636
|
+
pkg_name = module_name.replace("_", "-")
|
|
637
|
+
ver = version(pkg_name)
|
|
638
|
+
except PackageNotFoundError:
|
|
639
|
+
try:
|
|
640
|
+
ver = version(module_name)
|
|
641
|
+
except PackageNotFoundError:
|
|
642
|
+
# 如果获取失败,回退到元数据中的版本
|
|
643
|
+
if metadata and metadata.extra and "version" in metadata.extra:
|
|
644
|
+
ver = metadata.extra.get("version", "0.0.0")
|
|
645
|
+
|
|
630
646
|
plugins.append({
|
|
631
647
|
"id": p.name,
|
|
632
648
|
"name": metadata.name if metadata else p.name,
|
|
633
649
|
"description": metadata.description if metadata else "暂无描述",
|
|
634
|
-
"version":
|
|
650
|
+
"version": ver,
|
|
635
651
|
"type": plugin_type,
|
|
636
652
|
"module": module_name,
|
|
637
653
|
"homepage": metadata.homepage if metadata else None
|
|
@@ -1092,6 +1092,19 @@
|
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
1094
|
|
|
1095
|
+
function compareVersions(v1, v2) {
|
|
1096
|
+
const parts1 = v1.split('.').map(p => parseInt(p, 10) || 0);
|
|
1097
|
+
const parts2 = v2.split('.').map(p => parseInt(p, 10) || 0);
|
|
1098
|
+
|
|
1099
|
+
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
1100
|
+
const n1 = parts1[i] || 0;
|
|
1101
|
+
const n2 = parts2[i] || 0;
|
|
1102
|
+
if (n1 > n2) return 1;
|
|
1103
|
+
if (n1 < n2) return -1;
|
|
1104
|
+
}
|
|
1105
|
+
return 0;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1095
1108
|
async function openUpdates() {
|
|
1096
1109
|
const listEl = document.getElementById('updates-list');
|
|
1097
1110
|
const countEl = document.getElementById('updates-count');
|
|
@@ -1122,12 +1135,12 @@
|
|
|
1122
1135
|
const storePlugin = storeData.find(s => s.module_name === local.module || s.project_link === local.id);
|
|
1123
1136
|
|
|
1124
1137
|
if (storePlugin) {
|
|
1125
|
-
// 简单版本比较: 如果字符串不相等,且 store 版本通常较新
|
|
1126
1138
|
// 移除 'v' 前缀进行比较
|
|
1127
1139
|
const v1 = (local.version || '0.0.0').replace(/^v/, '');
|
|
1128
1140
|
const v2 = (storePlugin.version || '0.0.0').replace(/^v/, '');
|
|
1129
1141
|
|
|
1130
|
-
|
|
1142
|
+
// 只显示商店版本大于本地版本的情况
|
|
1143
|
+
if (compareVersions(v2, v1) > 0) {
|
|
1131
1144
|
updates.push({
|
|
1132
1145
|
local: local,
|
|
1133
1146
|
store: storePlugin
|
{nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/.gitignore
RENAMED
|
File without changes
|
|
File without changes
|
{nonebot_plugin_shiro_web_console-0.1.12 → nonebot_plugin_shiro_web_console-0.1.13}/README.md
RENAMED
|
File without changes
|