Added Chrome Job Profiling and Handling

This commit is contained in:
Joey Pillunat 2025-10-24 16:55:33 +02:00
parent 5b99621044
commit e4e454960e
5 changed files with 90 additions and 40 deletions

View file

@ -4,6 +4,7 @@ use crate::state::{SharedState, ChromiumPhase};
mod download;
pub mod utils;
pub mod profiles;
pub const CACHE_DIR: &str = "runtime/chrome-cache";

21
Core/chromium/profiles.rs Normal file
View file

@ -0,0 +1,21 @@
use std::{fs, io, path::{Path, PathBuf}};
pub fn job_profiles_root(exe_dir: &Path) -> PathBuf {
exe_dir.join("runtime").join("chrome-profiles")
}
pub fn create_job_profile(exe_dir: &Path, job_id: &str) -> io::Result<PathBuf> {
let root = job_profiles_root(exe_dir);
fs::create_dir_all(&root)?;
let p = root.join(format!("job-{}", job_id));
fs::create_dir_all(&p)?;
Ok(p)
}
/// Baut die Job-spezifischen Chrome-Args: Basis + user-data-dir + auto RDP-Port
pub fn build_job_args(base: &[String], profile_dir: &Path) -> Vec<String> {
let mut args = base.to_vec();
args.push(format!("--user-data-dir={}", profile_dir.display()));
args.push("--remote-debugging-port=0".to_string());
args
}

View file

@ -39,4 +39,4 @@ fn sanitize_path(name: &str) -> PathBuf {
}
}
clean
}
}