style: cargo fmt --all — make codebase rustfmt-clean
Some checks failed
Build and Test / Build Server (Linux) (push) Failing after 2m59s
Build and Test / Build Agent (Windows) (push) Has started running
Build and Test / Security Audit (push) Has been cancelled
Build and Test / Build Summary (push) Has been cancelled
Run Tests / Test Server (push) Has been cancelled
Run Tests / Test Agent (push) Has been cancelled
Run Tests / Code Coverage (push) Has been cancelled
Run Tests / Lint and Format Check (push) Has been cancelled

First run of the build-and-test CI gate (cargo fmt --all -- --check) surfaced
pre-existing formatting drift across the agent and server crates. Apply rustfmt
across the workspace so the codebase meets its own CI gate. Pure formatting; no
logic changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 15:02:12 +00:00
parent f2e0456f8d
commit 1c5c1e78e7
48 changed files with 1174 additions and 797 deletions

View File

@@ -13,7 +13,7 @@ use axum::{
};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use tracing::{info, warn, error};
use tracing::{error, info, warn};
/// Magic marker for embedded configuration (must match agent)
const MAGIC_MARKER: &[u8] = b"GURUCONFIG";
@@ -87,7 +87,7 @@ pub async fn download_viewer() -> impl IntoResponse {
.header(header::CONTENT_TYPE, "application/octet-stream")
.header(
header::CONTENT_DISPOSITION,
"attachment; filename=\"GuruConnect-Viewer.exe\""
"attachment; filename=\"GuruConnect-Viewer.exe\"",
)
.header(header::CONTENT_LENGTH, binary_data.len())
.body(Body::from(binary_data))
@@ -104,9 +104,7 @@ pub async fn download_viewer() -> impl IntoResponse {
}
/// Download support session binary (code embedded in filename)
pub async fn download_support(
Query(params): Query<SupportDownloadParams>,
) -> impl IntoResponse {
pub async fn download_support(Query(params): Query<SupportDownloadParams>) -> impl IntoResponse {
// Validate support code (must be 6 digits)
let code = params.code.trim();
if code.len() != 6 || !code.chars().all(|c| c.is_ascii_digit()) {
@@ -120,7 +118,11 @@ pub async fn download_support(
match std::fs::read(&binary_path) {
Ok(binary_data) => {
info!("Serving support session download for code {} ({} bytes)", code, binary_data.len());
info!(
"Serving support session download for code {} ({} bytes)",
code,
binary_data.len()
);
// Filename includes the support code
let filename = format!("GuruConnect-{}.exe", code);
@@ -130,7 +132,7 @@ pub async fn download_support(
.header(header::CONTENT_TYPE, "application/octet-stream")
.header(
header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{}\"", filename)
format!("attachment; filename=\"{}\"", filename),
)
.header(header::CONTENT_LENGTH, binary_data.len())
.body(Body::from(binary_data))
@@ -147,9 +149,7 @@ pub async fn download_support(
}
/// Download permanent agent binary with embedded configuration
pub async fn download_agent(
Query(params): Query<AgentDownloadParams>,
) -> impl IntoResponse {
pub async fn download_agent(Query(params): Query<AgentDownloadParams>) -> impl IntoResponse {
let binary_path = get_base_binary_path();
// Read base binary
@@ -167,10 +167,13 @@ pub async fn download_agent(
// Build embedded config
let config = EmbeddedConfig {
server_url: "wss://connect.azcomputerguru.com/ws/agent".to_string(),
api_key: params.api_key.unwrap_or_else(|| "managed-agent".to_string()),
api_key: params
.api_key
.unwrap_or_else(|| "managed-agent".to_string()),
company: params.company.clone(),
site: params.site.clone(),
tags: params.tags
tags: params
.tags
.as_ref()
.map(|t| t.split(',').map(|s| s.trim().to_string()).collect())
.unwrap_or_default(),
@@ -196,18 +199,25 @@ pub async fn download_agent(
info!(
"Serving permanent agent download: company={:?}, site={:?}, tags={:?} ({} bytes)",
config.company, config.site, config.tags, binary_data.len()
config.company,
config.site,
config.tags,
binary_data.len()
);
// Generate filename based on company/site
let filename = match (&params.company, &params.site) {
(Some(company), Some(site)) => {
format!("GuruConnect-{}-{}-Setup.exe", sanitize_filename(company), sanitize_filename(site))
format!(
"GuruConnect-{}-{}-Setup.exe",
sanitize_filename(company),
sanitize_filename(site)
)
}
(Some(company), None) => {
format!("GuruConnect-{}-Setup.exe", sanitize_filename(company))
}
_ => "GuruConnect-Setup.exe".to_string()
_ => "GuruConnect-Setup.exe".to_string(),
};
Response::builder()
@@ -215,7 +225,7 @@ pub async fn download_agent(
.header(header::CONTENT_TYPE, "application/octet-stream")
.header(
header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{}\"", filename)
format!("attachment; filename=\"{}\"", filename),
)
.header(header::CONTENT_LENGTH, binary_data.len())
.body(Body::from(binary_data))