Implement password handling for unattended access
build / build-linux-amd64 (push) Successful in 2m0s
build / build-linux-amd64 (push) Successful in 2m0s
This commit is contained in:
@@ -139,6 +139,7 @@ async fn render_table(state: &Arc<AppState>) -> Result<String, ApiError> {
|
||||
<th class="text-left font-medium px-3 py-2">Owner</th>
|
||||
<th class="text-left font-medium px-3 py-2">Hostname</th>
|
||||
<th class="text-left font-medium px-3 py-2">User</th>
|
||||
<th class="text-left font-medium px-3 py-2">Unattended pwd</th>
|
||||
<th class="text-left font-medium px-3 py-2">OS</th>
|
||||
<th class="text-left font-medium px-3 py-2">Version</th>
|
||||
<th class="text-left font-medium px-3 py-2">Last heartbeat</th>
|
||||
@@ -150,7 +151,7 @@ async fn render_table(state: &Arc<AppState>) -> Result<String, ApiError> {
|
||||
);
|
||||
if devices.is_empty() {
|
||||
s.push_str(
|
||||
r##"<tr><td colspan="9" class="px-3 py-4 text-slate-500 text-center text-xs">No devices have heartbeated yet.</td></tr>"##,
|
||||
r##"<tr><td colspan="10" class="px-3 py-4 text-slate-500 text-center text-xs">No devices have heartbeated yet.</td></tr>"##,
|
||||
);
|
||||
}
|
||||
for d in &devices {
|
||||
@@ -223,6 +224,25 @@ fn render_device_row(s: &mut String, d: &DashboardDeviceRow, now: chrono::DateTi
|
||||
format!("Offline — last heartbeat {} ago", fmt_age(age_secs)),
|
||||
)
|
||||
};
|
||||
// Per-boot unattended-access password reported by hello-agent. Visible
|
||||
// only when (a) the device is online (offline rows show stale data),
|
||||
// (b) no interactive user is logged in (otherwise the supporter
|
||||
// should be using the per-session approval popup, not the password),
|
||||
// and (c) the agent has actually reported one (vanilla rustdesk
|
||||
// never will). Otherwise show a neutral dash so the column lines up.
|
||||
let unattended_pwd_cell = if is_online
|
||||
&& active_user.is_empty()
|
||||
&& !d.unattended_password.is_empty()
|
||||
{
|
||||
format!(
|
||||
r##"<code class="font-mono text-xs text-amber-300 bg-slate-950 px-1.5 py-0.5 rounded border border-slate-800" title="Reported {set_at} UTC">{pw}</code>"##,
|
||||
pw = html_escape(&d.unattended_password),
|
||||
set_at = html_escape(&d.unattended_password_set_at),
|
||||
)
|
||||
} else {
|
||||
r##"<span class="text-slate-600">—</span>"##.to_string()
|
||||
};
|
||||
|
||||
let id_cell = format!(
|
||||
r##"<td class="px-3 py-2 font-mono text-slate-200 whitespace-nowrap">
|
||||
<span class="inline-flex items-center gap-2" title="{tt}">
|
||||
@@ -241,6 +261,7 @@ fn render_device_row(s: &mut String, d: &DashboardDeviceRow, now: chrono::DateTi
|
||||
<td class="px-3 py-2 text-slate-300">{owner}</td>
|
||||
<td class="px-3 py-2 text-slate-400">{host}</td>
|
||||
<td class="px-3 py-2 text-slate-300">{user}</td>
|
||||
<td class="px-3 py-2 whitespace-nowrap">{unattended_pwd}</td>
|
||||
<td class="px-3 py-2 text-slate-400">{os}</td>
|
||||
<td class="px-3 py-2 text-slate-400 whitespace-nowrap">{ver}</td>
|
||||
<td class="px-3 py-2 text-slate-500 text-xs">{last}</td>
|
||||
@@ -285,6 +306,7 @@ fn render_device_row(s: &mut String, d: &DashboardDeviceRow, now: chrono::DateTi
|
||||
} else {
|
||||
html_escape(&active_user)
|
||||
},
|
||||
unattended_pwd = unattended_pwd_cell,
|
||||
os = html_escape(&os),
|
||||
ver = html_escape(&version_label),
|
||||
last = html_escape(&d.last_heartbeat_at),
|
||||
|
||||
Reference in New Issue
Block a user