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