@wendongfly/myhi 1.3.187 → 1.3.190
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/bin/daemon.js +196 -170
- package/bin/install-check.js +25 -0
- package/dist/admin.html +30 -7
- package/dist/chat.html +82 -33
- package/dist/index.html +37 -6
- package/dist/index.js +1 -1
- package/dist/index.min.js +126 -131
- package/dist/lib/machine.js +8 -1
- package/dist/terminal.html +1 -1
- package/package.json +1 -1
package/dist/lib/machine.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
// 机器标识:多台电脑都跑 myhi 时,浏览器标签全叫「myhi」分不清。
|
|
2
|
-
// 拉 /api/machine-name
|
|
2
|
+
// 拉 /api/machine-name(只是 myhi 的显示名,不动电脑主机名)→
|
|
3
|
+
// ① 首页 / 分屏 / 管理页:标题里的「myhi」换成「机器名」并放最前(标签被挤窄时先露出来的是机器名);
|
|
4
|
+
// 会话页(<script data-session>):标题只留任务名,机器靠标签图标区分;
|
|
3
5
|
// ② 标签图标换成按机器名哈希配色 + 首字的圆角方块,一眼认出是哪台。
|
|
4
6
|
// 页面后续自己改 document.title(如「会话名 — myhi」)也会被 MutationObserver 接住重写。
|
|
5
7
|
(function () {
|
|
8
|
+
const sessionPage = document.currentScript?.hasAttribute('data-session');
|
|
6
9
|
let name = '';
|
|
7
10
|
try { name = localStorage.getItem('myhi_machine_name') || ''; } catch {} // 先用缓存,避免标题闪一下 myhi
|
|
8
11
|
|
|
9
12
|
function fmt(t) {
|
|
13
|
+
if (sessionPage) {
|
|
14
|
+
const rest = t.replace(/\s*—\s*myhi$/, '').trim();
|
|
15
|
+
return rest && rest !== 'myhi' ? rest : (name || 'myhi'); // 会话还没加载出标题时先显示机器名
|
|
16
|
+
}
|
|
10
17
|
if (!name || t.startsWith(name + ' · ')) return t;
|
|
11
18
|
const rest = t.replace(/\s*—\s*myhi$/, '').replace(/^myhi\s*/, '').trim();
|
|
12
19
|
return rest ? `${name} · ${rest}` : `${name} · myhi`;
|
package/dist/terminal.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="manifest" href="/manifest.json">
|
|
10
10
|
<link rel="apple-touch-icon" href="/icon.png">
|
|
11
11
|
<title>myhi 终端</title>
|
|
12
|
-
<script src="/lib/machine.js"></script>
|
|
12
|
+
<script src="/lib/machine.js" data-session></script>
|
|
13
13
|
<link rel="stylesheet" href="/lib/xterm/css/xterm.css">
|
|
14
14
|
<script src="/lib/xterm/lib/xterm.js"></script>
|
|
15
15
|
<script src="/lib/xterm-fit/lib/xterm-addon-fit.js"></script>
|
package/package.json
CHANGED