feat(desktop): add Tauri updater (GitHub Releases), updater UI button, hide PowerShell windows; fix Windows inventory arrays and activation; improve metrics parsing; branding rename to Raven across app; avoid localhost fallback in auth-server; inject APP_URL/AUTH_URL in stack

This commit is contained in:
Esdras Renan 2025-10-10 20:39:39 -03:00
parent eb5f39100f
commit 418599ef62
18 changed files with 127 additions and 34 deletions

View file

@ -21,6 +21,8 @@ tauri-build = { version = "2", features = [] }
tauri = { version = "2", features = ["wry"] }
tauri-plugin-opener = "2"
tauri-plugin-store = "2.4"
tauri-plugin-updater = "2"
tauri-plugin-process = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sysinfo = { version = "0.31", default-features = false, features = ["multithread", "network", "system", "disk"] }

View file

@ -11,6 +11,8 @@
"store:allow-set",
"store:allow-get",
"store:allow-save",
"store:allow-delete"
"store:allow-delete",
"updater:default",
"process:default"
]
}

View file

@ -469,13 +469,18 @@ fn collect_linux_extended() -> serde_json::Value {
#[cfg(target_os = "windows")]
fn collect_windows_extended() -> serde_json::Value {
use std::process::Command;
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x08000000;
fn ps(cmd: &str) -> Option<serde_json::Value> {
let ps_cmd = format!(
"$ErrorActionPreference='SilentlyContinue'; {} | ConvertTo-Json -Depth 4 -Compress",
cmd
);
let out = Command::new("powershell")
.creation_flags(CREATE_NO_WINDOW)
.arg("-NoProfile")
.arg("-WindowStyle").arg("Hidden")
.arg("-NoLogo")
.arg("-Command")
.arg(ps_cmd)
.output()
@ -486,23 +491,24 @@ fn collect_windows_extended() -> serde_json::Value {
let software = ps(r#"@(Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'; Get-ItemProperty 'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*') | Where-Object { $_.DisplayName } | Select-Object DisplayName, DisplayVersion, Publisher"#)
.unwrap_or_else(|| json!([]));
let services = ps("Get-Service | Select-Object Name,Status,DisplayName").unwrap_or_else(|| json!([]));
let services = ps("@(Get-Service | Select-Object Name,Status,DisplayName)").unwrap_or_else(|| json!([]));
let defender = ps("Get-MpComputerStatus | Select-Object AMRunningMode,AntivirusEnabled,RealTimeProtectionEnabled,AntispywareEnabled").unwrap_or_else(|| json!({}));
let hotfix = ps("Get-HotFix | Select-Object HotFixID,InstalledOn").unwrap_or_else(|| json!([]));
// Informações de build/edição e ativação
let os_info = ps(r#"
$cv = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion';
$ls = (Get-CimInstance -Query "SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL" | Select-Object -First 1).LicenseStatus;
$ls = Get-CimInstance -Query "SELECT Name, LicenseStatus FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL" | Where-Object { $_.Name -like 'Windows*' } | Select-Object -First 1;
$lsCode = if ($ls -and $ls.LicenseStatus -ne $null) { [int]$ls.LicenseStatus } else { 0 };
[PSCustomObject]@{
ProductName = $cv.ProductName
CurrentBuild = $cv.CurrentBuild
ProductName = $cv.ProductName
CurrentBuild = $cv.CurrentBuild
CurrentBuildNumber = $cv.CurrentBuildNumber
DisplayVersion = $cv.DisplayVersion
ReleaseId = $cv.ReleaseId
EditionID = $cv.EditionID
LicenseStatus = $ls
IsActivated = ($ls -eq 1)
DisplayVersion = $cv.DisplayVersion
ReleaseId = $cv.ReleaseId
EditionID = $cv.EditionID
LicenseStatus = $lsCode
IsActivated = ($lsCode -eq 1)
}
"#).unwrap_or_else(|| json!({}));
@ -510,9 +516,9 @@ fn collect_windows_extended() -> serde_json::Value {
let cpu = ps("Get-CimInstance Win32_Processor | Select-Object Name,Manufacturer,SocketDesignation,NumberOfCores,NumberOfLogicalProcessors,L2CacheSize,L3CacheSize,MaxClockSpeed").unwrap_or_else(|| json!({}));
let baseboard = ps("Get-CimInstance Win32_BaseBoard | Select-Object Product,Manufacturer,SerialNumber,Version").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!([]));
let disks = ps("Get-CimInstance Win32_DiskDrive | Select-Object Model,SerialNumber,Size,InterfaceType,MediaType").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!([]));
let disks = ps("@(Get-CimInstance Win32_DiskDrive | Select-Object Model,SerialNumber,Size,InterfaceType,MediaType)").unwrap_or_else(|| json!([]));
json!({
"windows": {

View file

@ -38,6 +38,8 @@ pub fn run() {
.manage(AgentRuntime::new())
.plugin(tauri_plugin_opener::init())
.plugin(StorePluginBuilder::default().build())
.plugin(tauri_plugin_updater::init())
.plugin(tauri_plugin_process::init())
.invoke_handler(tauri::generate_handler![
collect_machine_profile,
collect_machine_inventory,

View file

@ -1,6 +1,6 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Sistema de Chamados Desktop",
"productName": "Raven",
"version": "0.1.0",
"identifier": "br.com.esdrasrenan.sistemadechamados",
"build": {
@ -13,7 +13,7 @@
"withGlobalTauri": true,
"windows": [
{
"title": "Sistema de Chamados",
"title": "Raven",
"width": 1100,
"height": 720,
"resizable": true
@ -23,6 +23,14 @@
"csp": null
}
},
"updater": {
"active": true,
"endpoints": [
"https://github.com/esdrasrenan/sistema-de-chamados/releases/latest/download/latest.json"
],
"dialog": true,
"pubkey": "REPLACE_WITH_TAURI_PUBLIC_KEY"
},
"bundle": {
"active": true,
"targets": "all",