feat: 设备卡片显示系统名+版本 + 项目根 version.json
- SystemInfoCollector.platform 新增 release 字段 (内核版本)
- Sentinel 卡片每台设备显示: Linux 6.12.23 | aarch64
- 数据刷新时同步更新系统信息行
- 项目根 version.json: 本地版本清单
当前版本检测:
UpdateService 每6h从 {repo}/raw/branch/{branch}/version.json 拉取
对比 base_config.yaml 的 framework.version
远程 > 本地 → 顶栏绿色按钮 + 设置页更新提示
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -570,5 +570,27 @@
|
||||
"framework.command.execute"
|
||||
],
|
||||
"timestamp": 36524.109265649
|
||||
},
|
||||
"870510a6": {
|
||||
"plugin_name": "example_plugin",
|
||||
"permissions": [
|
||||
"plugin.example.read",
|
||||
"plugin.example.write",
|
||||
"plugin.example.execute",
|
||||
"framework.event.subscribe",
|
||||
"framework.command.execute"
|
||||
],
|
||||
"timestamp": 36655.276166328
|
||||
},
|
||||
"42d38ced": {
|
||||
"plugin_name": "sentinel",
|
||||
"permissions": [
|
||||
"plugin.sentinel.read",
|
||||
"plugin.sentinel.write",
|
||||
"plugin.network.access",
|
||||
"framework.event.subscribe",
|
||||
"framework.command.execute"
|
||||
],
|
||||
"timestamp": 36655.279458412
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ commands:
|
||||
permissions:
|
||||
- framework.command.test
|
||||
source: internal
|
||||
last_updated: 36524.082908878
|
||||
last_updated: 36655.235712682
|
||||
plugin_commands:
|
||||
example_plugin:
|
||||
echo: *id001
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
http_port: 4200
|
||||
last_updated: 36524.106284503
|
||||
last_updated: 36655.277279818
|
||||
plugin_routes:
|
||||
example_plugin:
|
||||
- methods:
|
||||
|
||||
@@ -103,6 +103,7 @@ class Plugin(PluginWebMixin):
|
||||
"enabled": n.get("enabled", True),
|
||||
"online": c.get("online", False),
|
||||
"system": c.get("system", {}),
|
||||
"platform": c.get("platform", {}),
|
||||
"last_seen": c.get("last_seen", 0),
|
||||
"error": c.get("error", ""),
|
||||
})
|
||||
@@ -186,6 +187,7 @@ class Plugin(PluginWebMixin):
|
||||
_NODE_CACHE[node.get("id", "")] = {
|
||||
"online": online,
|
||||
"system": sys_info or {},
|
||||
"platform": (sys_info or {}).get("platform", {}),
|
||||
"last_seen": time.time(),
|
||||
"error": err if not online else "",
|
||||
}
|
||||
@@ -225,6 +227,7 @@ class Plugin(PluginWebMixin):
|
||||
"enabled": n.get("enabled", True),
|
||||
"online": c.get("online", False),
|
||||
"system": c.get("system", {}),
|
||||
"platform": c.get("platform", {}),
|
||||
"last_seen": c.get("last_seen", 0),
|
||||
"error": c.get("error", ""),
|
||||
})
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
.node-card.offline { border-left:3px solid var(--error, #f44336); opacity:.7 }
|
||||
.node-card.flash { animation:card-flash .6s ease-out }
|
||||
@keyframes card-flash { 0%{background:var(--md-sys-color-surface-container-highest)} 100%{background:var(--md-sys-color-surface-container)} }
|
||||
.node-name { font-weight:600; font-size:1rem; margin-bottom:4px }
|
||||
.node-name { font-weight:600; font-size:1rem; margin-bottom:2px }
|
||||
.node-sys { font-size:.75rem; color:var(--text-dim); margin-bottom:4px }
|
||||
.node-url { font-size:.75rem; color:var(--text-dim); margin-bottom:8px; word-break:break-all }
|
||||
.node-notes { font-size:.75rem; color:var(--text-dim); font-style:italic; margin-bottom:8px }
|
||||
.metric-row { display:flex; gap:12px; margin-bottom:8px }
|
||||
@@ -135,8 +136,11 @@
|
||||
card = document.createElement('div');
|
||||
card.className = 'node-card ' + (n.online ? 'online' : 'offline');
|
||||
card.setAttribute('data-id', id);
|
||||
var plat = n.platform || {};
|
||||
var sysInfo = (plat.system||'') + (plat.release ? ' ' + plat.release : '') + (plat.machine ? ' | ' + plat.machine : '');
|
||||
card.innerHTML =
|
||||
'<div class="node-name">'+(n.online?'🟢':'🔴')+' '+esc(n.name)+'</div>'+
|
||||
(sysInfo.trim() ? '<div class="node-sys">'+esc(sysInfo)+'</div>' : '')+
|
||||
'<div class="node-url">'+esc(n.url||'')+'</div>'+
|
||||
(n.notes ? '<div class="node-notes">📝 '+esc(n.notes)+'</div>' : '')+
|
||||
'<div class="metrics-body"></div>'+
|
||||
@@ -148,6 +152,13 @@
|
||||
// 更新状态样式
|
||||
card.className = 'node-card ' + (n.online ? 'online' : 'offline');
|
||||
card.querySelector('.node-name').innerHTML = (n.online?'🟢':'🔴')+' '+esc(n.name);
|
||||
var sysEl = card.querySelector('.node-sys');
|
||||
var plat = n.platform || {};
|
||||
var sysInfo = (plat.system||'') + (plat.release ? ' ' + plat.release : '') + (plat.machine ? ' | ' + plat.machine : '');
|
||||
if (sysInfo.trim()) {
|
||||
if (!sysEl) { sysEl = document.createElement('div'); sysEl.className = 'node-sys'; card.insertBefore(sysEl, card.querySelector('.node-url')); }
|
||||
sysEl.textContent = sysInfo;
|
||||
} else if (sysEl) { sysEl.remove(); }
|
||||
card.querySelector('.node-url').textContent = n.url||'';
|
||||
var notesEl = card.querySelector('.node-notes');
|
||||
if (n.notes) {
|
||||
|
||||
@@ -59,7 +59,8 @@ class SystemInfoCollector:
|
||||
"platform": {
|
||||
"system": platform.system(),
|
||||
"machine": platform.machine(),
|
||||
"python": platform.python_version()
|
||||
"release": platform.release(),
|
||||
"python": platform.python_version(),
|
||||
},
|
||||
"cpu": self._get_cpu(),
|
||||
"memory": self._get_memory(),
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"framework": {
|
||||
"version": "v0.7.0",
|
||||
"url": "https://git.yeij.top/AskaEth/SenSu/archive/dev.zip",
|
||||
"notes": "安全加固 + Sentinel 集群监控 + API Key 系统 + 更新服务"
|
||||
},
|
||||
"plugins": {
|
||||
"sentinel": { "version": "1.0.0", "url": "" },
|
||||
"example_plugin": { "version": "1.0.0", "url": "" }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user