nonebot-plugin-shiro-web-console 0.1.9__py3-none-any.whl → 0.1.11__py3-none-any.whl
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/__init__.py +1 -1
- nonebot_plugin_shiro_web_console/static/index.html +27 -4
- {nonebot_plugin_shiro_web_console-0.1.9.dist-info → nonebot_plugin_shiro_web_console-0.1.11.dist-info}/METADATA +1 -1
- nonebot_plugin_shiro_web_console-0.1.11.dist-info/RECORD +7 -0
- nonebot_plugin_shiro_web_console-0.1.9.dist-info/RECORD +0 -7
- {nonebot_plugin_shiro_web_console-0.1.9.dist-info → nonebot_plugin_shiro_web_console-0.1.11.dist-info}/WHEEL +0 -0
- {nonebot_plugin_shiro_web_console-0.1.9.dist-info → nonebot_plugin_shiro_web_console-0.1.11.dist-info}/licenses/LICENSE +0 -0
|
@@ -709,12 +709,26 @@
|
|
|
709
709
|
if (!confirm(`确定要${actionText}机器人吗?`)) return;
|
|
710
710
|
|
|
711
711
|
try {
|
|
712
|
-
|
|
712
|
+
// 第一次请求(可能返回需要确认)
|
|
713
|
+
let res = await authorizedFetch('/web_console/api/system/action', {
|
|
713
714
|
method: 'POST',
|
|
714
715
|
body: JSON.stringify({ action })
|
|
715
716
|
});
|
|
716
|
-
|
|
717
|
+
let data = await res.json();
|
|
717
718
|
|
|
719
|
+
// 如果后端返回需要确认
|
|
720
|
+
if (data.need_confirm) {
|
|
721
|
+
const confirmed = confirm('确定要执行此操作吗?');
|
|
722
|
+
if (!confirmed) return;
|
|
723
|
+
|
|
724
|
+
// 再次发送带确认的请求
|
|
725
|
+
res = await authorizedFetch('/web_console/api/system/action', {
|
|
726
|
+
method: 'POST',
|
|
727
|
+
body: JSON.stringify({ action, confirm: true })
|
|
728
|
+
});
|
|
729
|
+
data = await res.json();
|
|
730
|
+
}
|
|
731
|
+
|
|
718
732
|
if (data.error) {
|
|
719
733
|
// 使用更友好的错误显示方式
|
|
720
734
|
const errorArea = document.createElement('div');
|
|
@@ -1307,6 +1321,8 @@
|
|
|
1307
1321
|
}
|
|
1308
1322
|
};
|
|
1309
1323
|
|
|
1324
|
+
let appInterval = null;
|
|
1325
|
+
|
|
1310
1326
|
async function initApp() {
|
|
1311
1327
|
initWS();
|
|
1312
1328
|
await fetchChats();
|
|
@@ -1317,9 +1333,11 @@
|
|
|
1317
1333
|
|
|
1318
1334
|
showPage('home');
|
|
1319
1335
|
// 定时刷新状态
|
|
1320
|
-
|
|
1336
|
+
if (appInterval) clearInterval(appInterval);
|
|
1337
|
+
appInterval = setInterval(() => {
|
|
1321
1338
|
if (document.getElementById('page-home').classList.contains('active')) fetchStatus();
|
|
1322
|
-
|
|
1339
|
+
// 日志已通过 WebSocket 推送,不再轮询,避免刷屏
|
|
1340
|
+
// if (document.getElementById('page-logs').classList.contains('active')) fetchLogs();
|
|
1323
1341
|
}, 5000);
|
|
1324
1342
|
}
|
|
1325
1343
|
|
|
@@ -1343,6 +1361,11 @@
|
|
|
1343
1361
|
|
|
1344
1362
|
// 初始化 WebSocket
|
|
1345
1363
|
function initWS() {
|
|
1364
|
+
if (ws) {
|
|
1365
|
+
ws.onclose = null; // 防止触发重连
|
|
1366
|
+
ws.close();
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1346
1369
|
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
1347
1370
|
// 添加 token 参数防止连接被服务端拒绝 (code 1008)
|
|
1348
1371
|
const wsUrl = `${protocol}//${window.location.host}/web_console/ws?token=${authToken}`;
|
|
@@ -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.11
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
nonebot_plugin_shiro_web_console/__init__.py,sha256=aBAzhpvaX9BGYCqv1ygLdKkr1baVMnfoeRT1kpmkTf8,41226
|
|
2
|
+
nonebot_plugin_shiro_web_console/config.py,sha256=LqHht8N5CuSMyBbEjzyJgfZtg05cvBlpGn_2MgTjt-g,202
|
|
3
|
+
nonebot_plugin_shiro_web_console/static/index.html,sha256=D8vIYiJRFbSyx23UHQMzQs55oWzO7sdQS_pFVLQZ5hU,81205
|
|
4
|
+
nonebot_plugin_shiro_web_console-0.1.11.dist-info/METADATA,sha256=UpcgaZ21z6RuesVyKoMMz5_uKHn82i9DEo5_pn7uRQU,1980
|
|
5
|
+
nonebot_plugin_shiro_web_console-0.1.11.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
+
nonebot_plugin_shiro_web_console-0.1.11.dist-info/licenses/LICENSE,sha256=WedEfsrQQfoZsmbJHIAPn4UY_IcpavYULMV5in_ZPbg,1066
|
|
7
|
+
nonebot_plugin_shiro_web_console-0.1.11.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
nonebot_plugin_shiro_web_console/__init__.py,sha256=fVHe5spU8pL3Ijg2HgF3k5oR9v6ZQ3dLiaIPpviZ34o,41225
|
|
2
|
-
nonebot_plugin_shiro_web_console/config.py,sha256=LqHht8N5CuSMyBbEjzyJgfZtg05cvBlpGn_2MgTjt-g,202
|
|
3
|
-
nonebot_plugin_shiro_web_console/static/index.html,sha256=47BThvsWr9LSgz61f6jSMD6tBj83nPQqltl2_6vahgM,80258
|
|
4
|
-
nonebot_plugin_shiro_web_console-0.1.9.dist-info/METADATA,sha256=8iSuWlmyiiLUwW0K8iBsObH28NOMPR4paVbxlZYi9t8,1979
|
|
5
|
-
nonebot_plugin_shiro_web_console-0.1.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
-
nonebot_plugin_shiro_web_console-0.1.9.dist-info/licenses/LICENSE,sha256=WedEfsrQQfoZsmbJHIAPn4UY_IcpavYULMV5in_ZPbg,1066
|
|
7
|
-
nonebot_plugin_shiro_web_console-0.1.9.dist-info/RECORD,,
|
|
File without changes
|