Redesenho da UI de dispositivos e correcao de VRAM
- Reorganiza layout da tela de dispositivos admin - Renomeia secao "Controles do dispositivo" para "Atalhos" - Adiciona botao de Tickets com badge de quantidade - Simplifica textos de botoes (Acesso, Resetar) - Remove email da maquina do cabecalho - Move empresa e status para mesma linha - Remove chip de Build do resumo - Corrige deteccao de VRAM para GPUs >4GB usando nvidia-smi - Adiciona prefixo "VRAM" na exibicao de memoria da GPU - Documenta sincronizacao RustDesk 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c5150fee8f
commit
23e7cf58ae
11 changed files with 863 additions and 441 deletions
|
|
@ -931,7 +931,44 @@ fn collect_windows_extended() -> serde_json::Value {
|
|||
.unwrap_or_else(|| json!({}));
|
||||
let bios = ps("Get-CimInstance Win32_BIOS | Select-Object Manufacturer,SMBIOSBIOSVersion,ReleaseDate,Version").unwrap_or_else(|| json!({}));
|
||||
let memory = ps("@(Get-CimInstance Win32_PhysicalMemory | Select-Object BankLabel,Capacity,Manufacturer,PartNumber,SerialNumber,ConfiguredClockSpeed,Speed,ConfiguredVoltage)").unwrap_or_else(|| json!([]));
|
||||
let video = ps("@(Get-CimInstance Win32_VideoController | Select-Object Name,AdapterRAM,DriverVersion,PNPDeviceID)").unwrap_or_else(|| json!([]));
|
||||
// Coleta de GPU com VRAM correta (nvidia-smi para NVIDIA, registro como fallback para >4GB)
|
||||
let video = ps(r#"
|
||||
$gpus = @()
|
||||
$wmiGpus = Get-CimInstance Win32_VideoController | Select-Object Name,AdapterRAM,DriverVersion,PNPDeviceID
|
||||
foreach ($gpu in $wmiGpus) {
|
||||
$vram = $gpu.AdapterRAM
|
||||
# Tenta nvidia-smi para GPUs NVIDIA (retorna valor correto para >4GB)
|
||||
if ($gpu.Name -match 'NVIDIA') {
|
||||
try {
|
||||
$nvidiaSmi = & 'nvidia-smi' '--query-gpu=memory.total' '--format=csv,noheader,nounits' 2>$null
|
||||
if ($nvidiaSmi) {
|
||||
$vramMB = [int64]($nvidiaSmi.Trim())
|
||||
$vram = $vramMB * 1024 * 1024
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
# Fallback: tenta registro do Windows (qwMemorySize é uint64)
|
||||
if ($vram -le 4294967296 -and $vram -gt 0) {
|
||||
try {
|
||||
$regPath = 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0*'
|
||||
$regGpus = Get-ItemProperty $regPath -ErrorAction SilentlyContinue
|
||||
foreach ($reg in $regGpus) {
|
||||
if ($reg.DriverDesc -eq $gpu.Name -and $reg.'HardwareInformation.qwMemorySize') {
|
||||
$vram = [int64]$reg.'HardwareInformation.qwMemorySize'
|
||||
break
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
$gpus += [PSCustomObject]@{
|
||||
Name = $gpu.Name
|
||||
AdapterRAM = $vram
|
||||
DriverVersion = $gpu.DriverVersion
|
||||
PNPDeviceID = $gpu.PNPDeviceID
|
||||
}
|
||||
}
|
||||
@($gpus)
|
||||
"#).unwrap_or_else(|| json!([]));
|
||||
let disks = ps("@(Get-CimInstance Win32_DiskDrive | Select-Object Model,SerialNumber,Size,InterfaceType,MediaType)").unwrap_or_else(|| json!([]));
|
||||
|
||||
json!({
|
||||
|
|
@ -1305,8 +1342,10 @@ impl AgentRuntime {
|
|||
// Verifica politica USB apos heartbeat inicial
|
||||
check_and_apply_usb_policy(&base_clone, &token_clone).await;
|
||||
|
||||
let mut ticker = tokio::time::interval(Duration::from_secs(interval));
|
||||
ticker.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
|
||||
let mut heartbeat_ticker = tokio::time::interval(Duration::from_secs(interval));
|
||||
heartbeat_ticker.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
|
||||
let mut usb_ticker = tokio::time::interval(Duration::from_secs(60));
|
||||
usb_ticker.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
|
||||
|
||||
loop {
|
||||
// Wait interval
|
||||
|
|
@ -1314,7 +1353,11 @@ impl AgentRuntime {
|
|||
_ = stop_signal_clone.notified() => {
|
||||
break;
|
||||
}
|
||||
_ = ticker.tick() => {}
|
||||
_ = heartbeat_ticker.tick() => {}
|
||||
_ = usb_ticker.tick() => {
|
||||
check_and_apply_usb_policy(&base_clone, &token_clone).await;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(error) =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue