fix: corriger les erreurs de compilation (Default, Debug, rustls)
This commit is contained in:
Generated
+3460
File diff suppressed because it is too large
Load Diff
+2
-8
@@ -14,8 +14,8 @@ categories = ["command-line-utilities", "web-programming"]
|
||||
clap = { version = "4", features = ["derive", "env"] }
|
||||
# Async runtime
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
# HTTP Client (API Imago)
|
||||
reqwest = { version = "0.12", features = ["json", "multipart", "stream"] }
|
||||
# HTTP Client (API Imago) — rustls pour éviter OpenSSL
|
||||
reqwest = { version = "0.12", default-features = false, features = ["json", "multipart", "stream", "rustls-tls"] }
|
||||
# Serialization
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
@@ -25,18 +25,12 @@ toml = "0.8"
|
||||
sha2 = "0.10"
|
||||
# SQLite
|
||||
rusqlite = { version = "0.32", features = ["bundled"] }
|
||||
# Time
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
# Logging
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
||||
# Error handling
|
||||
anyhow = "1"
|
||||
thiserror = "2"
|
||||
# Async trait
|
||||
async-trait = "0.1"
|
||||
# UUID for unique IDs
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
|
||||
# Web server (axum + tower)
|
||||
axum = { version = "0.8", features = ["ws"] }
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ pub enum Command {
|
||||
Logs,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
#[derive(Subcommand, Debug)]
|
||||
pub enum ConfigAction {
|
||||
/// Afficher la configuration actuelle
|
||||
Show,
|
||||
|
||||
+67
-37
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Configuration complète d'imagod-web
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct Config {
|
||||
#[serde(default)]
|
||||
pub imago: ImagoConfig,
|
||||
@@ -19,72 +19,105 @@ pub struct Config {
|
||||
pub logging: LoggingConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct ImagoConfig {
|
||||
#[serde(default = "default_imago_url")]
|
||||
pub url: String,
|
||||
#[serde(default)]
|
||||
pub api_key: String,
|
||||
}
|
||||
|
||||
fn default_imago_url() -> String {
|
||||
"http://imago.dracodev.net:8000".into()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct WatcherConfig {
|
||||
#[serde(default = "default_true")]
|
||||
pub capture_images: bool,
|
||||
#[serde(default = "default_poll_interval")]
|
||||
pub poll_interval_ms: u64,
|
||||
#[serde(default)]
|
||||
pub filters: WatcherFilters,
|
||||
}
|
||||
|
||||
impl Default for WatcherConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
capture_images: true,
|
||||
poll_interval_ms: 500,
|
||||
filters: WatcherFilters::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct WatcherFilters {
|
||||
#[serde(default)]
|
||||
pub only_apps: Vec<String>,
|
||||
#[serde(default = "default_exclude_apps")]
|
||||
pub exclude_apps: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
impl Default for WatcherFilters {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
only_apps: vec![],
|
||||
exclude_apps: vec!["mstsc".into()],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn default_exclude_apps() -> Vec<String> {
|
||||
vec!["mstsc".into()]
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct DedupConfig {
|
||||
#[serde(default = "default_dedup_method")]
|
||||
pub method: String,
|
||||
#[serde(default = "default_cache_size")]
|
||||
pub cache_size: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
fn default_dedup_method() -> String {
|
||||
"sha256".into()
|
||||
}
|
||||
|
||||
fn default_cache_size() -> usize {
|
||||
10000
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct UiConfig {
|
||||
#[serde(default = "default_true")]
|
||||
pub show_notifications: bool,
|
||||
#[serde(default = "default_true")]
|
||||
pub show_tray_icon: bool,
|
||||
#[serde(default = "default_notification_timeout")]
|
||||
pub notification_timeout_sec: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
fn default_notification_timeout() -> u64 {
|
||||
3
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct LoggingConfig {
|
||||
#[serde(default = "default_log_level")]
|
||||
pub level: String,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
imago: ImagoConfig {
|
||||
url: "http://imago.dracodev.net:8000".into(),
|
||||
api_key: String::new(),
|
||||
},
|
||||
watcher: WatcherConfig {
|
||||
capture_images: true,
|
||||
poll_interval_ms: 500,
|
||||
filters: WatcherFilters {
|
||||
only_apps: vec![],
|
||||
exclude_apps: vec!["mstsc".into()],
|
||||
},
|
||||
},
|
||||
dedup: DedupConfig {
|
||||
method: "sha256".into(),
|
||||
cache_size: 10000,
|
||||
},
|
||||
ui: UiConfig {
|
||||
show_notifications: true,
|
||||
show_tray_icon: true,
|
||||
notification_timeout_sec: 3,
|
||||
},
|
||||
logging: LoggingConfig {
|
||||
level: "info".into(),
|
||||
},
|
||||
fn default_log_level() -> String {
|
||||
"info".into()
|
||||
}
|
||||
|
||||
fn default_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn default_poll_interval() -> u64 {
|
||||
500
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -98,7 +131,6 @@ impl Config {
|
||||
.with_context(|| "Erreur de parsing du fichier de configuration")?;
|
||||
Ok(config)
|
||||
} else {
|
||||
// Premier lancement — créer la config par défaut
|
||||
let config = Config::default();
|
||||
config.save()?;
|
||||
Ok(config)
|
||||
@@ -119,12 +151,10 @@ impl Config {
|
||||
/// Chemin du fichier de configuration
|
||||
fn config_path() -> Result<PathBuf> {
|
||||
let base = if cfg!(target_os = "windows") {
|
||||
let appdata = std::env::var("APPDATA")
|
||||
.context("Variable APPDATA non définie")?;
|
||||
let appdata = std::env::var("APPDATA").context("Variable APPDATA non définie")?;
|
||||
PathBuf::from(appdata)
|
||||
} else {
|
||||
let home = std::env::var("HOME")
|
||||
.context("Variable HOME non définie")?;
|
||||
let home = std::env::var("HOME").context("Variable HOME non définie")?;
|
||||
PathBuf::from(home).join(".config")
|
||||
};
|
||||
Ok(base.join("imagod-web").join("imagod.toml"))
|
||||
|
||||
+6
-16
@@ -8,6 +8,8 @@
|
||||
//! - `config`: Gère la configuration
|
||||
//! - `install` / `uninstall`: Service Windows
|
||||
|
||||
#![allow(unused_imports, dead_code, unreachable_code)]
|
||||
|
||||
mod cli;
|
||||
mod config;
|
||||
mod dedup;
|
||||
@@ -45,43 +47,31 @@ async fn main() -> Result<()> {
|
||||
let args = cli::parse();
|
||||
|
||||
match args.command {
|
||||
cli::Command::Start { port, open_browser } => {
|
||||
cli::Command::Start { port: _, open_browser: _ } => {
|
||||
tracing::info!("Démarrage imagod-web — watcher + dashboard");
|
||||
// Lance le watcher et le serveur web en parallèle
|
||||
// ...
|
||||
todo!("Phase 6-7: Watcher + serveur web")
|
||||
}
|
||||
cli::Command::Serve { port, host, no_watcher, open_browser } => {
|
||||
tracing::info!("Démarrage dashboard web uniquement sur {}:{}", host, port);
|
||||
// Lance uniquement le serveur web
|
||||
// ...
|
||||
cli::Command::Serve { port: _, host: _, no_watcher: _, open_browser: _ } => {
|
||||
tracing::info!("Démarrage dashboard web uniquement");
|
||||
todo!("Phase 9: Dashboard web")
|
||||
}
|
||||
cli::Command::Stop => {
|
||||
tracing::info!("Arrêt du service");
|
||||
todo!("Phase 7: Stop")
|
||||
}
|
||||
cli::Command::Status => {
|
||||
tracing::info!("Statut du service");
|
||||
todo!("Phase 7: Status")
|
||||
}
|
||||
cli::Command::Config { action } => {
|
||||
tracing::info!("Configuration: {:?}", action);
|
||||
cli::Command::Config { action: _ } => {
|
||||
todo!("Phase 2: Config")
|
||||
}
|
||||
cli::Command::Install => {
|
||||
tracing::info!("Installation comme service Windows");
|
||||
todo!("Phase 10: Service install")
|
||||
}
|
||||
cli::Command::Uninstall => {
|
||||
tracing::info!("Désinstallation du service Windows");
|
||||
todo!("Phase 10: Service uninstall")
|
||||
}
|
||||
cli::Command::Logs => {
|
||||
tracing::info!("Logs");
|
||||
todo!("Phase 7: Logs")
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ impl Watcher {
|
||||
|
||||
/// Lance la boucle de polling
|
||||
pub async fn run(&self) -> Result<()> {
|
||||
let interval = Duration::from_millis(self.config.watcher.poll_interval_ms);
|
||||
let _interval = Duration::from_millis(self.config.watcher.poll_interval_ms);
|
||||
|
||||
tracing::info!(
|
||||
"Watcher démarré — polling toutes les {}ms",
|
||||
|
||||
Reference in New Issue
Block a user