mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-07-16 12:58:11 -07:00
add colorblind mode. Fixes #77
This commit is contained in:
committed by
Will Greenberg
parent
7addf3a67f
commit
87f9cc403b
@@ -9,6 +9,7 @@ struct ConfigFile {
|
|||||||
debug_mode: Option<bool>,
|
debug_mode: Option<bool>,
|
||||||
ui_level: Option<u8>,
|
ui_level: Option<u8>,
|
||||||
enable_dummy_analyzer: Option<bool>,
|
enable_dummy_analyzer: Option<bool>,
|
||||||
|
colorblind_mode: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -18,6 +19,7 @@ pub struct Config {
|
|||||||
pub debug_mode: bool,
|
pub debug_mode: bool,
|
||||||
pub ui_level: u8,
|
pub ui_level: u8,
|
||||||
pub enable_dummy_analyzer: bool,
|
pub enable_dummy_analyzer: bool,
|
||||||
|
pub colorblind_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
@@ -28,6 +30,7 @@ impl Default for Config {
|
|||||||
debug_mode: false,
|
debug_mode: false,
|
||||||
ui_level: 1,
|
ui_level: 1,
|
||||||
enable_dummy_analyzer: false,
|
enable_dummy_analyzer: false,
|
||||||
|
colorblind_mode: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,6 +45,7 @@ pub fn parse_config<P>(path: P) -> Result<Config, RayhunterError> where P: AsRef
|
|||||||
parsed_config.debug_mode.map(|v| config.debug_mode = v);
|
parsed_config.debug_mode.map(|v| config.debug_mode = v);
|
||||||
parsed_config.ui_level.map(|v| config.ui_level = v);
|
parsed_config.ui_level.map(|v| config.ui_level = v);
|
||||||
parsed_config.enable_dummy_analyzer.map(|v| config.enable_dummy_analyzer = v);
|
parsed_config.enable_dummy_analyzer.map(|v| config.enable_dummy_analyzer = v);
|
||||||
|
parsed_config.colorblind_mode.map(|v| config.colorblind_mode = v);
|
||||||
}
|
}
|
||||||
Ok(config)
|
Ok(config)
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -21,6 +21,7 @@ use crate::framebuffer::Framebuffer;
|
|||||||
use analysis::{get_analysis_status, run_analysis_thread, start_analysis, AnalysisCtrlMessage, AnalysisStatus};
|
use analysis::{get_analysis_status, run_analysis_thread, start_analysis, AnalysisCtrlMessage, AnalysisStatus};
|
||||||
use axum::response::Redirect;
|
use axum::response::Redirect;
|
||||||
use diag::{get_analysis_report, start_recording, stop_recording, DiagDeviceCtrlMessage};
|
use diag::{get_analysis_report, start_recording, stop_recording, DiagDeviceCtrlMessage};
|
||||||
|
use framebuffer::Color565;
|
||||||
use log::{info, error};
|
use log::{info, error};
|
||||||
use rayhunter::diag_device::DiagDevice;
|
use rayhunter::diag_device::DiagDevice;
|
||||||
use axum::routing::{get, post};
|
use axum::routing::{get, post};
|
||||||
@@ -142,12 +143,17 @@ fn run_ctrl_c_thread(
|
|||||||
|
|
||||||
fn update_ui(task_tracker: &TaskTracker, config: &config::Config, mut ui_shutdown_rx: oneshot::Receiver<()>, mut ui_update_rx: Receiver<framebuffer::DisplayState>) -> JoinHandle<()> {
|
fn update_ui(task_tracker: &TaskTracker, config: &config::Config, mut ui_shutdown_rx: oneshot::Receiver<()>, mut ui_update_rx: Receiver<framebuffer::DisplayState>) -> JoinHandle<()> {
|
||||||
static IMAGE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/static/images/");
|
static IMAGE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/static/images/");
|
||||||
|
let mut display_color: Color565;
|
||||||
let display_level = config.ui_level;
|
let display_level = config.ui_level;
|
||||||
if display_level == 0 {
|
if display_level == 0 {
|
||||||
info!("Invisible mode, not spawning UI.");
|
info!("Invisible mode, not spawning UI.");
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut display_color = framebuffer::Color565::Green;
|
if config.colorblind_mode {
|
||||||
|
display_color = framebuffer::Color565::Blue;
|
||||||
|
} else {
|
||||||
|
display_color = framebuffer::Color565::Green;
|
||||||
|
}
|
||||||
|
|
||||||
task_tracker.spawn_blocking(move || {
|
task_tracker.spawn_blocking(move || {
|
||||||
let mut fb: Framebuffer = Framebuffer::new();
|
let mut fb: Framebuffer = Framebuffer::new();
|
||||||
|
|||||||
Vendored
+3
@@ -1,6 +1,9 @@
|
|||||||
# cat config.toml
|
# cat config.toml
|
||||||
qmdl_store_path = "/data/rayhunter/qmdl"
|
qmdl_store_path = "/data/rayhunter/qmdl"
|
||||||
port = 8080
|
port = 8080
|
||||||
|
debug_mode = false
|
||||||
|
enable_dummy_analyzer = false
|
||||||
|
colorblind_mode = false
|
||||||
# UI Levels:
|
# UI Levels:
|
||||||
# 0 = invisible mode, no indicator that rayhunter is running
|
# 0 = invisible mode, no indicator that rayhunter is running
|
||||||
# 1 = Subtle mode, display a green line at the top of the screen when rayhunter is running
|
# 1 = Subtle mode, display a green line at the top of the screen when rayhunter is running
|
||||||
|
|||||||
Reference in New Issue
Block a user