qq-bot-roost 0.8.7 → 0.8.8
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.
- package/README.md +1 -1
- package/package.json +3 -3
- package/src/plugin/deps.js +160 -26
- package/src/plugin/pages.js +38 -2
- package/src/web/server.js +306 -9
- package/web/app.js +3275 -3265
- package/web/index.html +2 -10
- package/web/theme-boot.js +17 -0
package/web/index.html
CHANGED
|
@@ -4,16 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>栖 Roost · 控制台</title>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(function () {
|
|
10
|
-
try {
|
|
11
|
-
var t = localStorage.getItem('qqbot_theme');
|
|
12
|
-
if (!t) t = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
13
|
-
document.documentElement.dataset.theme = t;
|
|
14
|
-
} catch (e) {}
|
|
15
|
-
})();
|
|
16
|
-
</script>
|
|
7
|
+
<!-- 主题脚本必须外置:CSP 的 script-src 'self' 会拦掉内联脚本 -->
|
|
8
|
+
<script src="/theme-boot.js"></script>
|
|
17
9
|
<link rel="stylesheet" href="/style.css">
|
|
18
10
|
</head>
|
|
19
11
|
<body>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 主题引导(在样式生效前跑,避免刷新时闪一下白底)
|
|
3
|
+
*
|
|
4
|
+
* 为什么单独成文件、不写在 index.html 里:
|
|
5
|
+
* 面板现在启用了 CSP `script-src 'self'`,内联脚本会被浏览器直接拦掉。
|
|
6
|
+
* 想保留内联就得开 `'unsafe-inline'` —— 那等于把 CSP 对脚本的保护整个作废,
|
|
7
|
+
* 面板里任何一处 XSS 都能执行任意代码,而面板的 localStorage 里存着访问密钥。
|
|
8
|
+
*
|
|
9
|
+
* 所以宁可多一个几毫秒的请求。
|
|
10
|
+
*/
|
|
11
|
+
(function () {
|
|
12
|
+
try {
|
|
13
|
+
var t = localStorage.getItem('qqbot_theme');
|
|
14
|
+
if (!t) t = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
15
|
+
document.documentElement.dataset.theme = t;
|
|
16
|
+
} catch (e) {}
|
|
17
|
+
})();
|