Feature(web): show host remark alongside hostname
This commit is contained in:
@@ -1545,6 +1545,16 @@ std::string CWebService::BuildDeviceListJson(const std::string& username) {
|
||||
CString name = ctx->GetClientData(ONLINELIST_COMPUTER_NAME);
|
||||
device["name"] = AnsiToUtf8(name);
|
||||
|
||||
// 用户在 MFC 端给这台主机起的备注(菜单"修改备注"写入 MAP_NOTE)
|
||||
// 例如 hostname="A6" + remark="我的Windows" → web 显示"A6 (我的Windows)"
|
||||
if (m_pParentDlg->m_ClientMap) {
|
||||
CString remark = m_pParentDlg->m_ClientMap->GetClientMapData(
|
||||
ctx->GetClientID(), MAP_NOTE);
|
||||
if (!remark.IsEmpty()) {
|
||||
device["remark"] = AnsiToUtf8(remark);
|
||||
}
|
||||
}
|
||||
|
||||
CString ip = ctx->GetClientData(ONLINELIST_IP);
|
||||
device["ip"] = AnsiToUtf8(ip);
|
||||
|
||||
|
||||
@@ -2099,6 +2099,7 @@
|
||||
const q = searchQuery.toLowerCase();
|
||||
filtered = filtered.filter(d =>
|
||||
(d.name && d.name.toLowerCase().includes(q)) ||
|
||||
(d.remark && d.remark.toLowerCase().includes(q)) ||
|
||||
(d.ip && d.ip.toLowerCase().includes(q)) ||
|
||||
(d.os && d.os.toLowerCase().includes(q)) ||
|
||||
(d.location && d.location.toLowerCase().includes(q)) ||
|
||||
@@ -2231,7 +2232,7 @@
|
||||
'<polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/>' +
|
||||
'</svg>' +
|
||||
'</button>' +
|
||||
'<h3>' + escapeHtml(d.name || 'Unknown') + '</h3>' +
|
||||
'<h3>' + escapeHtml(displayName(d)) + '</h3>' +
|
||||
'<div class="info-row">' +
|
||||
'<div class="info"><span class="info-label">IP:</span> ' + escapeHtml(d.ip || '-') + '</div>' +
|
||||
'<div class="info"><span class="info-label">Loc:</span> ' + escapeHtml(loc) + '</div>' +
|
||||
@@ -2498,7 +2499,7 @@
|
||||
const compat = checkWebCodecs();
|
||||
if (!compat.supported) { alert('Browser does not support H264: ' + compat.reason); return; }
|
||||
currentDevice = dev;
|
||||
document.getElementById('device-name').textContent = currentDevice.name;
|
||||
document.getElementById('device-name').textContent = displayName(currentDevice);
|
||||
document.getElementById('frame-info').textContent = '';
|
||||
// Reset throughput / resolution read-outs for the new session
|
||||
currentWidth = 0; currentHeight = 0;
|
||||
@@ -2532,7 +2533,7 @@
|
||||
termState.deviceId = String(id);
|
||||
termState.ready = false;
|
||||
|
||||
document.getElementById('term-title').textContent = dev.name + ' Terminal';
|
||||
document.getElementById('term-title').textContent = displayName(dev) + ' Terminal';
|
||||
document.getElementById('term-status-info').textContent = 'Connecting...';
|
||||
|
||||
// 先 showPage 让 term-host 拿到真实尺寸;xterm.open() 必须在容器有 size 时调用,
|
||||
@@ -3932,6 +3933,14 @@
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
// 设备显示名:有备注则 "hostname (备注)",否则就是 hostname。
|
||||
// 服务端备注从 m_ClientMap MAP_NOTE 取(参看 BuildDeviceListJson)。
|
||||
function displayName(d) {
|
||||
if (!d) return '';
|
||||
const name = d.name || 'Unknown';
|
||||
return d.remark ? (name + ' (' + d.remark + ')') : name;
|
||||
}
|
||||
|
||||
function startPingInterval() {
|
||||
if (pingInterval) clearInterval(pingInterval);
|
||||
pingInterval = setInterval(() => {
|
||||
|
||||
Reference in New Issue
Block a user