Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
refactor(tui): prune redundant slash commands and streamline shortcuts
Samir Hossainse04de745e3c2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 789ff4a..e742a05 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,19 +2,28 @@## [Unreleased]+### Changed+- **Provider Switching Shortcut**:+ - Scoped `Ctrl+P` strictly to Streaming Mode for provider cycling, eliminating redundant `Ctrl+P` handling in TV and Addon modes.+ - Streamlined `/config` as a direct alias for `/settings`.+### Fixed- **Direct Playback & Header Compatibility**:- Eliminated vestigial in-stream "Open with" popup that blocked playback when only VLC was installed, routing playback directly to the preferred compatible player.- Prevented silent player overrides: when a user explicitly selects a default player (e.g. VLC) that cannot satisfy stream authentication headers (e.g. MovieBox signed DASH manifests), the app now halts playback and warns the user with actionable detected alternatives instead of silently launching an unselected player.- - Added structured `PlaybackResolution` engine with dynamic context-aware notifications across playback resolution, download operations, and `/download-dir` commands.+ - Added structured `PlaybackResolution` engine with dynamic context-aware notifications across playback resolution and download operations.- Expanded Windows `mpv.exe` detection across winget (`MPV Player`, `mpv-player`), portable `C:\mpv`, and user directory paths.- **Terminal Graphics Probe Leak**:- Prevented raw Kitty APC escape sequence leak (`Gi=31...`) on macOS `Terminal.app` and legacy non-graphics consoles by skipping graphics stdio probes.- Removed unsafe mid-session stdio graphics re-probing on `FocusChange` events.+### Removed- Removed vestigial `ShowPlaybackPicker` and `ShowPlayerPicker` action variants and playback picker state fields in favor of direct compatible player dispatch.-+- **Redundant Slash Commands**:+ - Pruned 10+ legacy slash commands (`/download-dir`, `/clear-cache`, `/update`, `/github`, `/probe`, `/toggle-update`, `/toggle-bdix`, `/toggle-streaming`, `/toggle-tv`, `/toggle-addons`, `/enable-*`, `/disable-*`) superseded by the interactive Settings Hub.+ - Removed 300+ lines of redundant command execution and file write probing in `src/tui/app/search.rs`.+ - Removed duplicate unreachable `Ctrl+U` key handling in `src/tui/app/keyboard.rs`.## [0.1.15] - 2026-09-03### Addeddiff --git a/docs/addons-mode.md b/docs/addons-mode.mdindex 0d3ce6f..2b8eb00 100644--- a/docs/addons-mode.md+++ b/docs/addons-mode.md@@ -21,9 +21,7 @@ Addon Mode enables support for community HTTP addon manifests. You can install a- `Ctrl+S`: Return to standard **Streaming Mode**.- `Ctrl+T`: Toggle **TV Mode**.- `/browse`: Browse curated addon catalogs (`Top Movies`, `Top Series`, `Top Rated Movies`, `Top Rated Series`).-- `/enable-addons`: Enables Addon Mode in configuration and updates the footer navigation.-- `/disable-addons`: Disables Addon Mode in configuration.-- `Ctrl+P` or `/config`: Opens the Addon Manager modal.+- `/settings` $\to$ Content Modes: Enable or disable Addon Mode navigation.## Addon Managerdiff --git a/docs/cache.md b/docs/cache.mdindex f50acf3..a4427fa 100644--- a/docs/cache.md+++ b/docs/cache.md@@ -31,7 +31,7 @@ The cache directory is `dirs::cache_dir()/moviebox-tui` (macOS- **TTL**: Streams expire after 2h; search/details/captions/manifests after 24h; homepage/catalogs after 1h; remote TV playlists after 24h; images after 30 days. Local M3U files are reread from disk directly without caching.- **Atomic writes**: Entries are written to a unique temp file (`path.with_extension("tmp-PID-STAMP")`) and atomically replaced (`durable_replace`), preventing truncated or corrupt files on unexpected exits.- **Validation**: Empty search or stream results are never written or served from cache.-- **Purge**: Background cleanup runs at startup to delete entries older than 7 days. `/clear-cache` purges the entire cache tree and resets in-memory LRUs.+- **Purge**: Background cleanup runs at startup to delete entries older than 7 days. `/settings` $\to$ Maintenance $\to$ Clear Cache purges the entire cache tree and resets in-memory LRUs.## In-memory caches (AppState)diff --git a/docs/config.md b/docs/config.mdindex 507f2e6..05a26ac 100644--- a/docs/config.md+++ b/docs/config.md@@ -13,9 +13,9 @@ macOS `~/Library/Application Support/moviebox-tui`, Linux `~/.config/moviebox-tu| `active_provider` | string | Last provider (`moviebox`, `fourkhdhub`, …). || `active_theme` | string | Theme name. || `bdix_enabled` | bool | Show BDIX providers (Bangladesh-only). |-| `streaming_enabled` | bool | Enable Streaming Mode navigation in bottom dock (`/enable-streaming`, `/disable-streaming`). |-| `tv_enabled` | bool | Enable TV Mode navigation in bottom dock (`/enable-tv`, `/disable-tv`). |-| `addons_enabled` | bool | Enable Addon Mode navigation in bottom dock (`/enable-addons`, `/disable-addons`). |+| `streaming_enabled` | bool | Enable Streaming Mode navigation in bottom dock (`/settings` $\to$ Content Modes). |+| `tv_enabled` | bool | Enable TV Mode navigation in bottom dock (`/settings` $\to$ Content Modes). |+| `addons_enabled` | bool | Enable Addon Mode navigation in bottom dock (`/settings` $\to$ Content Modes). || `default_player` | string or null | Preferred player: `mpv`, `iina`, `vlc`, `android`; absent/null until you choose one from the in-app picker. || `download_dir` | string or null | Custom directory for video and subtitle downloads (null uses OS default). |@@ -32,7 +32,7 @@ All settings in `config.json` can be configured interactively inside the applica- `addons_config.json` — list of installed HTTP addons in the config directory (see [addons-mode.md](addons-mode.md)).- `tv_config.json` — list of M3U playlist sources in the config directory (see [tv-mode.md](tv-mode.md)).- `history.json` — watch history in the system data directory (`dirs::data_dir()/moviebox-tui/`).-- `favorites.json`: starred titles in the system data directory. Independent of `history.json`; clearing watch history or running `/clear-cache` never touches it.+- `favorites.json`: starred titles in the system data directory. Independent of `history.json`; clearing watch history or cache never touches it.- `playback/` — temporary playback states in the system data directory for resilient progress tracking.- `scripts/` — bundled player scripts (`moviebox_tracker.lua`) in the system data directory.- `iptv_cache/` — legacy TV image cache directory that `ClearCache` still removes.diff --git a/docs/controls.md b/docs/controls.mdindex deef389..162bbba 100644--- a/docs/controls.md+++ b/docs/controls.md@@ -73,10 +73,9 @@ All popup dialogs (Theme picker, Browse categories, Settings Media Player picker### Live TV Mode- **`Enter`**: Play selected TV channel immediately with default player.- **`r`**: Reload all active M3U playlist sources.-- **`/config`**: Open TV Playlist Manager dialog (`Space` to activate, `Delete`/`d` to remove).- **`/list`**: Show all loaded channels.### Addon Mode (HTTP Addons)-- **`Ctrl+P` / `/config`**: Open Addon Manager dialog (`Space` to toggle, `Delete`/`d` to remove).+- **`/settings`**: Open Settings Hub to manage addons and configuration.- **`Enter`**: Select title or play resolved stream.- **`d`**: Download HTTP stream release.- **`r`**: Refresh addon catalog search results.@@ -104,7 +103,7 @@ Type these commands directly into the search bar:| Command | Applicable Mode | Action || :--- | :--- | :--- |-| `/settings` | All | Open interactive Settings & Preferences Hub (configuration, modes, players, maintenance) |+| `/settings` | All | Open interactive Settings & Preferences Hub (aliases `/config`, `/pref`, `/preferences`, `/options`) || `/browse` | Streaming / Addon | Browse curated views (Trending, Popular) or Addon catalogs (Top Movies, Top Series) || `/history` | Streaming / Addon | View watch history with latest progress || `/favorites` | Streaming / Addon | View all starred titles |@@ -112,18 +111,7 @@ Type these commands directly into the search bar:| `/clear` | All | Clear search results and return to landing || `/help` | All | Open interactive keybinding help menu (alias `/?`) || `/list` | TV | View live TV channels |-| `/config` | All | Open mode-specific configuration dialog (TV Playlists, Addons, or Settings) |-| `/download-dir [path]` | All | View or configure custom media download folder (`reset` for default) |-| `/update` | All | Trigger interactive manual update check against GitHub |-| `/clear-cache` | All | Evict temporary cache files and image artifacts |-| `/github` | All | Open MovieBox-TUI GitHub repository in default browser |-| `/toggle-update` | All | Toggle automatic update checks on startup |-| `/toggle-bdix` | Streaming | Toggle BDIX FTP scrapers on/off |-| `/toggle-streaming` | All | Toggle Streaming Mode content availability || `/exit` | All | Exit application and return to shell (aliases `/quit`, `/q`) |-| `/toggle-tv` | All | Toggle TV Mode IPTV player |-| `/toggle-addons` | All | Toggle Addon Mode HTTP metadata/stream extensions |-| `/probe` | All | Re-probe terminal graphics protocol support (Kitty, Sixel, iTerm2) |- Open with `?`; close with `?`, `Esc`, or `q`.- `↑`/`↓`, `PageUp`/`PageDown`, and the mouse wheel scroll long content.diff --git a/docs/cross-platform.md b/docs/cross-platform.mdindex b7ab80e..e4c8375 100644--- a/docs/cross-platform.md+++ b/docs/cross-platform.md@@ -20,9 +20,9 @@ the release checks in [`release-checklist.md`](release-checklist.md).## Terminal capabilitiesThe app probes the terminal at startup via `ratatui_image` (400ms cap,-off the UI thread; on-demand via `/probe`). Non-graphics terminals (e.g.-macOS `Apple_Terminal`, legacy Windows `conhost`, and `TERM=dumb/linux/cygwin`)-are skipped to prevent escape sequence probe leakage (`Gi=31...`):+off the UI thread). Non-graphics terminals (e.g. macOS `Apple_Terminal`,+legacy Windows `conhost`, and `TERM=dumb/linux/cygwin`) are skipped to+prevent escape sequence probe leakage (`Gi=31...`):- **Poster rendering**: Sixel, Kitty, and iTerm2 protocols where the probedetects them. Terminals that report kitty/sixel capability but no celldiff --git a/docs/downloads.md b/docs/downloads.mdindex 505e89c..4f3c328 100644--- a/docs/downloads.md+++ b/docs/downloads.md@@ -27,7 +27,7 @@ and length is capped.- **Series downloads:** Saved under `<base_dir>/Series/<Title>/Season <N>/<Title> - S<N:02>E<E:02>.<ext>` (and subtitle `<Title> - S<N:02>E<E:02>.<lang>.<sub_ext>`).- **Movie downloads:** Saved under `<base_dir>/Movies/<Title>/<Title>.<ext>` (and subtitle `<Title>.<lang>.<sub_ext>`).- **Default path:** Files go to the user's OS download directory (`~/Downloads/MovieBox-TUI`). On Android-family environments the code prefers shared `storage/downloads` when present.-- **Custom path:** Users can set a custom download directory using `/download-dir <path>` or revert with `/download-dir reset`. Target directories are validated with a write probe before saving, and the code creates the `MovieBox-TUI` subfolder hierarchy (`Movies/` and `Series/`). If custom storage becomes unavailable at runtime, the engine falls back to the default download location.+- **Custom path:** Users can set a custom download directory in `/settings` $\to$ General $\to$ Download Folder or reset to default. Target directories are validated with a write probe before saving, and the code creates the `MovieBox-TUI` subfolder hierarchy (`Movies/` and `Series/`). If custom storage becomes unavailable at runtime, the engine falls back to the default download location.## Contextual triggers & Seasonsdiff --git a/docs/providers.md b/docs/providers.mdindex 3e0eed1..7434d3b 100644--- a/docs/providers.md+++ b/docs/providers.md@@ -15,7 +15,7 @@ shared typed models in `providers/models.rs` and the moviebox JSON schema used b| `Addons` | `providers/addons` | Community HTTP addons (Cinemeta, streams). |BDIX sources are only reachable from supported Bangladeshi ISPs and are hidden by-default (`bdix_enabled` in config; `/enable-bdix`).+default (`bdix_enabled` in config; `/settings` $\to$ Content Modes $\to$ BDIX Sources).## Shared Provider Contractdiff --git a/docs/tv-mode.md b/docs/tv-mode.mdindex a12503d..448ec7a 100644--- a/docs/tv-mode.md+++ b/docs/tv-mode.md@@ -38,7 +38,6 @@ namespace.## Commands in TV mode- `/list` — display all loaded TV channels.-- `/config` — open the TV Playlist Manager dialog.- `[r]` key — reload all active M3U playlist sources.-- Global commands (`/settings`, `/theme`, `/download-dir`, `/exit`, `/update`, `/toggle-update`, `/clear-cache`, `/github`, `/enable-tv`, `/disable-tv`, `/enable-streaming`, `/disable-streaming`, `/enable-addons`, `/disable-addons`) are active across all modes.-- Streaming/Addon-only commands (e.g. `/browse`, `/history`, `/enable-bdix`) display friendly guidance notifications prompting you to switch modes (`Ctrl+S` or `Ctrl+A`).+- Global commands (`/settings`, `/theme`, `/clear`, `/help`, `/exit`) are active across all modes.+- Streaming/Addon-only commands (e.g. `/browse`, `/history`, `/favorites`) display friendly guidance notifications prompting you to switch modes (`Ctrl+S` or `Ctrl+A`).diff --git a/src/tui/app/keyboard.rs b/src/tui/app/keyboard.rsindex e85e34b..13d7c7a 100644--- a/src/tui/app/keyboard.rs+++ b/src/tui/app/keyboard.rs@@ -38,7 +38,7 @@ impl App {self.state.set_status_short("Switched to TV Mode.");} else {self.state- .set_status_short("TV Mode is disabled. Use /enable-tv to enable.");+ .set_status_short("TV Mode is disabled. Use /settings to enable.");}return None;}@@ -47,16 +47,15 @@ impl App {self.action_sender.send(Action::ToggleAddonMode).ok();self.state.set_status_short("Switched to Addon Mode.");} else {- self.state.set_status_short(- "Addon Mode is disabled. Use /enable-addons to enable.",- );+ self.state+ .set_status_short("Addon Mode is disabled. Use /settings to enable.");}return None;}if let KeyCode::Char('s') = key.code {if !self.state.streaming_enabled {self.state.set_status_short(- "Streaming Mode is disabled. Use /enable-streaming to enable.",+ "Streaming Mode is disabled. Use /settings to enable.",);} else if !self.state.is_tv_mode && !self.state.is_addon_mode {self.state.set_status_short("Already in Streaming Mode.");@@ -67,40 +66,11 @@ impl App {return None;}if let KeyCode::Char('p') = key.code {- if self.state.is_tv_mode {- self.state.notify(- crate::tui::overlay::NotificationKind::Info,- "TV Mode",- "Provider cycling is only available in Streaming Mode.",- );- } else if self.state.is_addon_mode {- self.action_sender.send(Action::ShowAddonManager).ok();- } else {+ if !self.state.is_tv_mode && !self.state.is_addon_mode {self.cycle_provider();}return None;}- } else if !self.state.addon_input_active && !self.state.tv_input_active {- if let KeyCode::Char('u') = key.code {- if self.state.active_screen == Screen::Home {- self.state.clear_search_state();- self.state.input_mode = InputMode::Normal;- self.state.set_status_default("Search cleared.");- return None;- }- }- return None;- }- if let KeyCode::Char('u') = key.code {- if self.state.active_screen == Screen::Home- && !self.state.addon_input_active- && !self.state.tv_input_active- {- self.state.clear_search_state();- self.state.input_mode = InputMode::Normal;- self.state.set_status_default("Search cleared.");- return None;- }}}diff --git a/src/tui/app/requests.rs b/src/tui/app/requests.rsindex 7d7f48e..2db2047 100644--- a/src/tui/app/requests.rs+++ b/src/tui/app/requests.rs@@ -1317,7 +1317,7 @@ impl App {id,season,episode,- "No streaming addons are currently installed or enabled.\nPress Ctrl+P or open /config to install/enable a stream provider.".into(),+ "No streaming addons are currently installed or enabled.\nOpen /settings to install/enable a stream provider.".into(),)).ok();return;diff --git a/src/tui/app/search.rs b/src/tui/app/search.rsindex 8051457..782ddef 100644--- a/src/tui/app/search.rs+++ b/src/tui/app/search.rs@@ -123,10 +123,6 @@ impl App {self.action_sender.send(Action::ToggleSettingsPopup).ok();Some(true)}- crate::tui::commands::ParsedCommand::ClearCache => {- self.action_sender.send(Action::ClearCache).ok();- Some(true)- }crate::tui::commands::ParsedCommand::Clear => {self.state.clear_search_state();self.state.set_status_default("Search cleared.");@@ -136,39 +132,6 @@ impl App {self.action_sender.send(Action::ToggleHelp).ok();Some(true)}- crate::tui::commands::ParsedCommand::Github => {- let _ = open::that("https://github.com/mesamirh/MovieBox-Tui");- Some(true)- }- crate::tui::commands::ParsedCommand::Probe => {- self.action_sender.send(Action::ProbeTerminal).ok();- Some(true)- }- crate::tui::commands::ParsedCommand::Update => {- if !self.state.is_checking_updates {- self.state.update_available = None;- self.state.manual_update_check = true;- self.state.set_status_long("Checking GitHub for updates...");- self.action_sender.send(Action::CheckForUpdates).ok();- } else {- self.state.set_status_long("Checking GitHub for updates...");- }- Some(true)- }- crate::tui::commands::ParsedCommand::ToggleUpdate => {- self.state.auto_update = !self.state.auto_update;- self.persist_config();- self.state.notify(- NotificationKind::Info,- "Auto Update Check",- if self.state.auto_update {- "Enabled"- } else {- "Disabled"- },- );- Some(true)- }crate::tui::commands::ParsedCommand::Theme => {self.action_sender.send(Action::ToggleThemePopup).ok();Some(true)@@ -223,244 +186,6 @@ impl App {}Some(true)}- crate::tui::commands::ParsedCommand::Config => {- let current_mode = self.state.mode();- if current_mode == crate::tui::state::AppMode::Tv {- self.action_sender.send(Action::ShowTvConfig).ok();- } else if current_mode == crate::tui::state::AppMode::Addon {- self.action_sender.send(Action::ShowAddonManager).ok();- } else {- self.action_sender.send(Action::ToggleSettingsPopup).ok();- }- Some(true)- }- crate::tui::commands::ParsedCommand::DownloadDir(raw_arg) => {- if raw_arg.is_empty() {- let current = crate::logging::sanitize_path(self.resolve_download_base_dir());- self.state- .notify(NotificationKind::Info, "Download Directory", current);- return Some(true);- }-- if raw_arg.eq_ignore_ascii_case("reset") || raw_arg.eq_ignore_ascii_case("default")- {- let default_path =- crate::logging::sanitize_path(self.resolve_download_base_dir());- if self.state.download_dir.is_none() {- self.state.notify(- NotificationKind::Info,- "Download Directory",- format!("Already using system default ({default_path})"),- );- } else {- self.state.download_dir = None;- self.persist_config();- self.state.notify(- NotificationKind::Success,- "Download Directory",- format!("Reset to default ({default_path})"),- );- }- return Some(true);- }-- let clean_arg = raw_arg.trim_matches(|c| c == '\'' || c == '"').trim();- if clean_arg == "<path>"- || clean_arg == "path"- || clean_arg == "<dir>"- || clean_arg == "dir"- {- self.state.notify(- NotificationKind::Info,- "Download Directory",- "Usage: /download-dir <folder_path>\nExample: /download-dir ~/Movies",- );- return Some(true);- }- let expanded_path = crate::tui::state::AppState::expand_download_path(clean_arg)- .unwrap_or_else(|| std::path::PathBuf::from(clean_arg));-- match std::fs::create_dir_all(&expanded_path) {- Ok(_) => {- let test_file =- expanded_path.join(format!(".mb_probe_{}", std::process::id()));- match std::fs::write(&test_file, b"ok") {- Ok(_) => {- let _ = std::fs::remove_file(&test_file);- let canonical =- std::fs::canonicalize(&expanded_path).unwrap_or(expanded_path);- let clean_path = {- let s = canonical.to_string_lossy();- if let Some(stripped) = s.strip_prefix(r"\\?\") {- std::path::PathBuf::from(stripped)- } else {- canonical- }- };- self.state.download_dir = Some(clean_path.clone());- self.persist_config();- let effective =- crate::logging::sanitize_path(self.resolve_download_base_dir());- self.state.notify(- NotificationKind::Success,- "Download Directory",- format!("Saved: {effective}"),- );- }- Err(err) => {- self.state.notify(- NotificationKind::Error,- "Permission Denied",- format!(- "Cannot write to '{}': {}",- expanded_path.display(),- err- ),- );- }- }- }- Err(err) => {- self.state.notify(- NotificationKind::Error,- "Invalid Directory",- format!("Cannot create '{}': {}", expanded_path.display(), err),- );- }- }-- Some(true)- }- crate::tui::commands::ParsedCommand::ToggleBdix => {- let enable_req = !self.state.bdix_enabled;- if current_mode != crate::tui::state::AppMode::Streaming {- self.state.notify(- NotificationKind::Info,- "BDIX Sources",- format!("BDIX FTP sources are only available in Streaming Mode. Switch with {ctrl_s}."),- );- return Some(true);- }-- self.state.bdix_enabled = enable_req;- self.persist_config();- self.state.notify(- NotificationKind::Info,- "BDIX Providers",- if self.state.bdix_enabled {- "Enabled"- } else {- "Disabled"- },- );- if !self.state.bdix_enabled && self.state.active_provider.is_bdix() {- let new_provider = ProviderKind::ENABLED- .iter()- .copied()- .find(|provider| !provider.is_bdix())- .unwrap_or(ProviderKind::MovieBox);- self.action_sender- .send(Action::SwitchProvider(new_provider))- .ok();- }- Some(true)- }- crate::tui::commands::ParsedCommand::ToggleStreaming => {- let enable_req = !self.state.streaming_enabled;- if !enable_req && !self.state.tv_enabled && !self.state.addons_enabled {- self.state.notify(- NotificationKind::Warning,- "Streaming Mode",- "Cannot disable: at least one mode must remain active.",- );- return Some(true);- }-- self.state.streaming_enabled = enable_req;- self.persist_config();- self.state.notify(- NotificationKind::Info,- "Streaming Mode",- if self.state.streaming_enabled {- "Enabled"- } else {- "Disabled"- },- );- if !self.state.streaming_enabled- && !self.state.is_tv_mode- && !self.state.is_addon_mode- {- if self.state.tv_enabled {- self.action_sender.send(Action::ToggleTvMode).ok();- } else if self.state.addons_enabled {- self.action_sender.send(Action::ToggleAddonMode).ok();- }- }- Some(true)- }- crate::tui::commands::ParsedCommand::ToggleTv => {- let enable_req = !self.state.tv_enabled;- if !enable_req && !self.state.streaming_enabled && !self.state.addons_enabled {- self.state.notify(- NotificationKind::Warning,- "TV Mode",- "Cannot disable: at least one mode must remain active.",- );- return Some(true);- }-- self.state.tv_enabled = enable_req;- self.persist_config();- self.state.notify(- NotificationKind::Info,- "TV Mode",- if self.state.tv_enabled {- "Enabled"- } else {- "Disabled"- },- );- if !self.state.tv_enabled && self.state.is_tv_mode {- if self.state.streaming_enabled {- self.action_sender.send(Action::SwitchToStreamingMode).ok();- } else if self.state.addons_enabled {- self.action_sender.send(Action::ToggleAddonMode).ok();- }- }- Some(true)- }- crate::tui::commands::ParsedCommand::ToggleAddons => {- let enable_req = !self.state.addons_enabled;- if !enable_req && !self.state.streaming_enabled && !self.state.tv_enabled {- self.state.notify(- NotificationKind::Warning,- "Addon Mode",- "Cannot disable: at least one mode must remain active.",- );- return Some(true);- }-- self.state.addons_enabled = enable_req;- self.persist_config();- self.state.notify(- NotificationKind::Info,- "Addon Mode",- if self.state.addons_enabled {- "Enabled"- } else {- "Disabled"- },- );- if !self.state.addons_enabled && self.state.is_addon_mode {- if self.state.streaming_enabled {- self.action_sender.send(Action::SwitchToStreamingMode).ok();- } else if self.state.tv_enabled {- self.action_sender.send(Action::ToggleTvMode).ok();- }- }- Some(true)- }}}diff --git a/src/tui/commands.rs b/src/tui/commands.rsindex c751b89..d72b645 100644--- a/src/tui/commands.rs+++ b/src/tui/commands.rs@@ -10,22 +10,11 @@ pub enum SlashCommand {Clear,Help,List,- Config,- DownloadDir,- Update,- ClearCache,- Github,- ToggleUpdate,- ToggleBdix,- ToggleStreaming,- ToggleTv,- ToggleAddons,- Probe,Exit,}#[derive(Debug, Clone, PartialEq, Eq)]-pub enum ParsedCommand<'a> {+pub enum ParsedCommand {Settings,Browse,History,@@ -34,22 +23,11 @@ pub enum ParsedCommand<'a> {Clear,Help,List,- Config,- DownloadDir(&'a str),- Update,- ClearCache,- Github,- ToggleUpdate,- ToggleBdix,- ToggleStreaming,- ToggleTv,- ToggleAddons,- Probe,Exit,}impl SlashCommand {- pub const ALL: [Self; 20] = [+ pub const ALL: [Self; 9] = [Self::Settings,Self::Browse,Self::History,@@ -58,17 +36,6 @@ impl SlashCommand {Self::Clear,Self::Help,Self::List,- Self::Config,- Self::DownloadDir,- Self::Update,- Self::ClearCache,- Self::Github,- Self::ToggleUpdate,- Self::ToggleBdix,- Self::ToggleStreaming,- Self::ToggleTv,- Self::ToggleAddons,- Self::Probe,Self::Exit,];@@ -82,14 +49,6 @@ impl SlashCommand {Self::Help,];- pub const TOGGLE_COMMANDS: [Self; 5] = [- Self::ToggleUpdate,- Self::ToggleBdix,- Self::ToggleStreaming,- Self::ToggleTv,- Self::ToggleAddons,- ];-pub fn name(self) -> &'static str {match self {Self::Settings => "/settings",@@ -100,22 +59,11 @@ impl SlashCommand {Self::Clear => "/clear",Self::Help => "/help",Self::List => "/list",- Self::Config => "/config",- Self::DownloadDir => "/download-dir",- Self::Update => "/update",- Self::ClearCache => "/clear-cache",- Self::Github => "/github",- Self::ToggleUpdate => "/toggle-update",- Self::ToggleBdix => "/toggle-bdix",- Self::ToggleStreaming => "/toggle-streaming",- Self::ToggleTv => "/toggle-tv",- Self::ToggleAddons => "/toggle-addons",- Self::Probe => "/probe",Self::Exit => "/exit",}}- pub fn description(self, state: &AppState) -> &'static str {+ pub fn description(self, _state: &AppState) -> &'static str {match self {Self::Settings => "Interactive preferences, content modes & configuration",Self::Browse => "Curated, rated & most-watched views",@@ -125,25 +73,6 @@ impl SlashCommand {Self::Clear => "Clear search results and return to landing",Self::Help => "Open interactive keybinding help menu",Self::List => "Show all TV channels",- Self::Config => {- if state.is_addon_mode {- "Configure HTTP addons"- } else if state.is_tv_mode {- "Configure IPTV playlists"- } else {- "Interactive preferences and configuration"- }- }- Self::DownloadDir => "View or change download folder",- Self::Update => "Check for newer release",- Self::ClearCache => "Clear cached data",- Self::Github => "Open project repository",- Self::ToggleUpdate => "Toggle automatic update checks",- Self::ToggleBdix => "Toggle BDIX FTP sources",- Self::ToggleStreaming => "Toggle Streaming mode navigation",- Self::ToggleTv => "Toggle TV mode navigation",- Self::ToggleAddons => "Toggle Addon mode navigation",- Self::Probe => "Re-detect terminal graphics support",Self::Exit => "Exit application and restore terminal",}}@@ -161,21 +90,7 @@ impl SlashCommand {}Self::Favorites => state.favorites_available(),Self::List => state.tv_enabled && state.is_tv_mode,- Self::Config => true,- Self::ToggleBdix => !state.is_tv_mode && !state.is_addon_mode,- Self::Theme- | Self::Clear- | Self::Help- | Self::DownloadDir- | Self::Update- | Self::ClearCache- | Self::Github- | Self::ToggleUpdate- | Self::ToggleStreaming- | Self::ToggleTv- | Self::ToggleAddons- | Self::Probe- | Self::Exit => true,+ Self::Theme | Self::Clear | Self::Help | Self::Exit => true,}}@@ -183,20 +98,7 @@ impl SlashCommand {let lower = query.to_ascii_lowercase();let mut results = Vec::new();- if lower.starts_with("/toggle-") {- for cmd in Self::TOGGLE_COMMANDS {- if !cmd.is_available(state) {- continue;- }- let name = cmd.name();- if name.starts_with(&lower) {- results.push(name.to_string());- }- }- return results;- }-- let primary_suggestions: [(&str, Self); 7] = [+ let candidates: [(&str, Self); 8] = [("/settings", Self::Settings),("/browse", Self::Browse),("/history", Self::History),@@ -204,9 +106,10 @@ impl SlashCommand {("/theme", Self::Theme),("/clear", Self::Clear),("/help", Self::Help),+ ("/list", Self::List),];- for (name, cmd) in primary_suggestions {+ for (name, cmd) in candidates {if !cmd.is_available(state) {continue;}@@ -225,14 +128,15 @@ impl SlashCommand {return None;};- if trimmed == "/download-dir reset" {- return Some("Reset download folder to default");- }- if trimmed == "/pref" || trimmed == "/preferences" || trimmed == "/options" {- return Some("Interactive preferences, content modes & configuration");+ if trimmed == "/pref"+ || trimmed == "/preferences"+ || trimmed == "/options"+ || trimmed == "/config"+ {+ return Some(Self::Settings.description(state));}if trimmed == "/?" {- return Some("Open interactive keybinding help menu");+ return Some(Self::Help.description(state));}match trimmed {@@ -244,34 +148,24 @@ impl SlashCommand {"/clear" => Some(Self::Clear.description(state)),"/help" => Some(Self::Help.description(state)),"/list" => Some(Self::List.description(state)),- "/config" => Some(Self::Config.description(state)),- "/download-dir" => Some(Self::DownloadDir.description(state)),- "/update" => Some(Self::Update.description(state)),- "/clear-cache" => Some(Self::ClearCache.description(state)),- "/github" => Some(Self::Github.description(state)),- "/toggle-update" => Some(Self::ToggleUpdate.description(state)),- "/toggle-bdix" => Some(Self::ToggleBdix.description(state)),- "/toggle-streaming" => Some(Self::ToggleStreaming.description(state)),- "/toggle-tv" => Some(Self::ToggleTv.description(state)),- "/toggle-addons" => Some(Self::ToggleAddons.description(state)),- "/probe" => Some(Self::Probe.description(state)),"/exit" | "/quit" | "/q" => Some(Self::Exit.description(state)),_ => None,}}- pub fn parse(input: &str) -> Option<ParsedCommand<'_>> {+ pub fn parse(input: &str) -> Option<ParsedCommand> {let trimmed = input.trim();if !trimmed.starts_with('/') {return None;}- let mut parts = trimmed.splitn(2, char::is_whitespace);+ let mut parts = trimmed.split_whitespace();let command_name = parts.next()?;- let arg = parts.next().unwrap_or("").trim();match command_name.to_ascii_lowercase().as_str() {- "/settings" | "/pref" | "/preferences" | "/options" => Some(ParsedCommand::Settings),+ "/settings" | "/config" | "/pref" | "/preferences" | "/options" => {+ Some(ParsedCommand::Settings)+ }"/browse" => Some(ParsedCommand::Browse),"/history" => Some(ParsedCommand::History),"/favorites" => Some(ParsedCommand::Favorites),@@ -279,21 +173,6 @@ impl SlashCommand {"/clear" => Some(ParsedCommand::Clear),"/help" | "/?" => Some(ParsedCommand::Help),"/list" => Some(ParsedCommand::List),- "/config" => Some(ParsedCommand::Config),- "/download-dir" => Some(ParsedCommand::DownloadDir(arg)),- "/update" => Some(ParsedCommand::Update),- "/clear-cache" => Some(ParsedCommand::ClearCache),- "/github" => Some(ParsedCommand::Github),- "/toggle-update" => Some(ParsedCommand::ToggleUpdate),- "/toggle-bdix" | "/enable-bdix" | "/disable-bdix" => Some(ParsedCommand::ToggleBdix),- "/toggle-streaming" | "/enable-streaming" | "/disable-streaming" => {- Some(ParsedCommand::ToggleStreaming)- }- "/toggle-tv" | "/enable-tv" | "/disable-tv" => Some(ParsedCommand::ToggleTv),- "/toggle-addons" | "/enable-addons" | "/disable-addons" => {- Some(ParsedCommand::ToggleAddons)- }- "/probe" => Some(ParsedCommand::Probe),"/exit" | "/quit" | "/q" => Some(ParsedCommand::Exit),_ => None,}@@ -303,6 +182,7 @@ impl SlashCommand {#[cfg(test)]mod tests {use super::*;+#[test]fn test_primary_commands_suggest() {let state = AppState::default();@@ -331,7 +211,16 @@ mod tests {let d_sug = SlashCommand::suggest(&state, "/download-dir");assert!(d_sug.is_empty());++ let tv_state = AppState {+ is_tv_mode: true,+ tv_enabled: true,+ ..Default::default()+ };+ let list_sug = SlashCommand::suggest(&tv_state, "/l");+ assert_eq!(list_sug, vec!["/list".to_string()]);}+#[test]fn test_favorites_command_parses_and_is_available_by_default() {let state = AppState::default();@@ -353,69 +242,86 @@ mod tests {}#[test]- fn test_toggle_commands_and_aliases_parse() {+ fn test_core_commands_and_aliases_parse() {let state = AppState::default();- assert_eq!(SlashCommand::ALL.len(), 20);+ assert_eq!(SlashCommand::ALL.len(), 9);+ assert_eq!(SlashCommand::PRIMARY.len(), 7);assert_eq!(SlashCommand::parse("/exit"), Some(ParsedCommand::Exit));assert_eq!(SlashCommand::parse("/quit"), Some(ParsedCommand::Exit));assert_eq!(SlashCommand::parse("/q"), Some(ParsedCommand::Exit));assert!(SlashCommand::Exit.is_available(&state));assert_eq!(SlashCommand::Exit.name(), "/exit");+assert_eq!(SlashCommand::parse("/clear"), Some(ParsedCommand::Clear));assert!(SlashCommand::Clear.is_available(&state));assert_eq!(SlashCommand::Clear.name(), "/clear");+assert_eq!(SlashCommand::parse("/help"), Some(ParsedCommand::Help));assert_eq!(SlashCommand::parse("/?"), Some(ParsedCommand::Help));assert!(SlashCommand::Help.is_available(&state));assert_eq!(SlashCommand::Help.name(), "/help");assert_eq!(- SlashCommand::parse("/toggle-tv"),- Some(ParsedCommand::ToggleTv)+ SlashCommand::parse("/settings"),+ Some(ParsedCommand::Settings));assert_eq!(- SlashCommand::parse("/enable-tv"),- Some(ParsedCommand::ToggleTv)+ SlashCommand::parse("/config"),+ Some(ParsedCommand::Settings));+ assert_eq!(SlashCommand::parse("/pref"), Some(ParsedCommand::Settings));assert_eq!(- SlashCommand::parse("/disable-tv"),- Some(ParsedCommand::ToggleTv)- );-- assert_eq!(- SlashCommand::parse("/toggle-addons"),- Some(ParsedCommand::ToggleAddons)+ SlashCommand::parse("/preferences"),+ Some(ParsedCommand::Settings));assert_eq!(- SlashCommand::parse("/enable-addons"),- Some(ParsedCommand::ToggleAddons)+ SlashCommand::parse("/options"),+ Some(ParsedCommand::Settings));++ assert_eq!(SlashCommand::parse("/list"), Some(ParsedCommand::List));+ assert_eq!(SlashCommand::parse("/browse"), Some(ParsedCommand::Browse));assert_eq!(- SlashCommand::parse("/disable-addons"),- Some(ParsedCommand::ToggleAddons)+ SlashCommand::parse("/history"),+ Some(ParsedCommand::History));- let toggle_no_dash = SlashCommand::suggest(&state, "/toggle");- assert!(toggle_no_dash.is_empty());-- let toggle_sug = SlashCommand::suggest(&state, "/toggle-");- assert!(toggle_sug.contains(&"/toggle-update".to_string()));- assert!(toggle_sug.contains(&"/toggle-bdix".to_string()));-- let probe_sug = SlashCommand::suggest(&state, "/probe");- assert!(probe_sug.is_empty());+ assert_eq!(SlashCommand::parse("/toggle-tv"), None);+ assert_eq!(SlashCommand::parse("/enable-tv"), None);+ assert_eq!(SlashCommand::parse("/disable-tv"), None);+ assert_eq!(SlashCommand::parse("/toggle-addons"), None);+ assert_eq!(SlashCommand::parse("/download-dir"), None);+ assert_eq!(SlashCommand::parse("/download-dir ~/Movies"), None);+ assert_eq!(SlashCommand::parse("/update"), None);+ assert_eq!(SlashCommand::parse("/clear-cache"), None);+ assert_eq!(SlashCommand::parse("/github"), None);+ assert_eq!(SlashCommand::parse("/probe"), None);++ assert!(SlashCommand::suggest(&state, "/toggle").is_empty());+ assert!(SlashCommand::suggest(&state, "/toggle-").is_empty());+ assert!(SlashCommand::suggest(&state, "/probe").is_empty());}#[test]- fn test_download_dir_reset_description() {+ fn test_descriptions_and_aliases() {let state = AppState::default();assert_eq!(- SlashCommand::description_for("/download-dir reset", &state),- Some("Reset download folder to default")+ SlashCommand::description_for("/settings", &state),+ Some("Interactive preferences, content modes & configuration")+ );+ assert_eq!(+ SlashCommand::description_for("/config", &state),+ Some("Interactive preferences, content modes & configuration")+ );+ assert_eq!(+ SlashCommand::description_for("/pref", &state),+ Some("Interactive preferences, content modes & configuration"));assert_eq!(- SlashCommand::description_for("/download-dir", &state),- Some("View or change download folder")+ SlashCommand::description_for("/?", &state),+ Some("Open interactive keybinding help menu"));+ assert_eq!(SlashCommand::description_for("/download-dir", &state), None);+ assert_eq!(SlashCommand::description_for("/toggle-tv", &state), None);}}diff --git a/src/tui/screens/help.rs b/src/tui/screens/help.rsindex a35c154..693768a 100644--- a/src/tui/screens/help.rs+++ b/src/tui/screens/help.rs@@ -56,7 +56,6 @@ pub fn build_help_columns(left.push(help_section_header("TV Actions", theme));left.push(help_row("[Enter]", "Play Selected Channel", theme));left.push(help_row("[r]", "Reload M3U Playlists", theme));- left.push(help_row("/config", "Manage TV Playlists", theme));left.push(help_row("/list", "Show All TV Channels", theme));} else if state.is_addon_mode {left.push(help_section_header("Addon Actions", theme));@@ -64,7 +63,6 @@ pub fn build_help_columns(left.push(help_row("[d]", "Download Video Stream", theme));left.push(help_row("[f]", "Favorite / Unfavorite Title", theme));left.push(help_row("[s]", "Subtitles Picker (Details)", theme));- left.push(help_row("[Ctrl+P]", "Open Addon Manager", theme));left.push(help_row("[r]", "Refresh Catalog / Streams", theme));} else {left.push(help_section_header("Streaming Actions", theme));diff --git a/tests/grand_user_journey.rs b/tests/grand_user_journey.rsindex 1b46332..6071d1c 100644--- a/tests/grand_user_journey.rs+++ b/tests/grand_user_journey.rs@@ -238,8 +238,8 @@ async fn test_grand_user_journey_complete_lifecycle() {assert!(app.state().download_progress.is_none());app.state_mut().input_mode = InputMode::Editing;- app.state_mut().search_query.set_content("/download-dir");- assert_eq!(app.state().search_query, "/download-dir");+ app.state_mut().search_query.set_content("/settings");+ assert_eq!(app.state().search_query, "/settings");let esc_key = crossterm::event::KeyEvent::new(crossterm::event::KeyCode::Esc,diff --git a/tests/settings_hub.rs b/tests/settings_hub.rsindex 80d97b1..f13fdee 100644--- a/tests/settings_hub.rs+++ b/tests/settings_hub.rs@@ -31,7 +31,10 @@ fn test_settings_command_parsing_and_aliases() {SlashCommand::parse("/options"),Some(ParsedCommand::Settings));- assert_eq!(SlashCommand::parse("/config"), Some(ParsedCommand::Config));+ assert_eq!(+ SlashCommand::parse("/config"),+ Some(ParsedCommand::Settings)+ );assert_eq!(SlashCommand::parse("/help"), Some(ParsedCommand::Help));assert_eq!(SlashCommand::parse("/?"), Some(ParsedCommand::Help));diff --git a/tests/tui_acceptance.rs b/tests/tui_acceptance.rsindex a909e9e..6d45c9b 100644--- a/tests/tui_acceptance.rs+++ b/tests/tui_acceptance.rs@@ -354,26 +354,6 @@ async fn test_full_user_journey_mode_switching_and_theme_selection() {assert_eq!(app.state().active_theme_kind, "TokyoNight");}-#[tokio::test]-async fn test_download_dir_reset_user_journey() {- let mut app = App::new();- let custom_path = std::path::PathBuf::from("/custom/moviebox/downloads");- app.state_mut().download_dir = Some(custom_path.clone());- assert_eq!(app.state().download_dir, Some(custom_path));-- app.handle_action(Action::Search {- query: "/download-dir reset".to_string(),- force_refresh: false,- })- .await;-- assert!(app.state().download_dir.is_none());- assert!(!app.state().notifications.is_empty());- let notif = app.state().notifications.back().unwrap();- assert_eq!(notif.title, "Download Directory");- assert!(notif.message.contains("Reset to default"));-}-#[tokio::test]async fn test_esc_key_cancels_slash_command_and_clears_search_bar() {let mut app = App::new();@@ -381,7 +361,7 @@ async fn test_esc_key_cancels_slash_command_and_clears_search_bar() {app.state_mut().show_theme_popup = false;app.state_mut().show_browse_popup = false;app.state_mut().input_mode = InputMode::Editing;- app.state_mut().search_query.set_content("/download-dir");+ app.state_mut().search_query.set_content("/settings");let esc_key = crossterm::event::KeyEvent::new(crossterm::event::KeyCode::Esc,@@ -798,3 +778,34 @@ async fn test_no_results_and_error_state_rendering_hints() {assert!(text_err.contains("Switch Provider"));assert!(text_err.contains("Back"));}+#[tokio::test]+async fn test_ctrl_p_scoped_strictly_to_streaming_mode() {+ let mut app = App::new();+ let ctrl_p = crossterm::event::KeyEvent::new(+ crossterm::event::KeyCode::Char('p'),+ crossterm::event::KeyModifiers::CONTROL,+ );++ app.state_mut()+ .set_mode(moviebox_tui::tui::state::AppMode::Streaming);+ let initial_provider = app.state().active_provider;+ app.handle_action(Action::Key(ctrl_p)).await;+ assert_ne!(app.state().active_provider, initial_provider);++ app.state_mut()+ .set_mode(moviebox_tui::tui::state::AppMode::Tv);+ app.state_mut().is_tv_mode = true;+ app.state_mut().tv_enabled = true;+ app.state_mut().tv_config_popup = false;+ app.handle_action(Action::Key(ctrl_p)).await;+ assert!(!app.state().tv_config_popup);++ app.state_mut()+ .set_mode(moviebox_tui::tui::state::AppMode::Addon);+ app.state_mut().is_tv_mode = false;+ app.state_mut().is_addon_mode = true;+ app.state_mut().addons_enabled = true;+ app.state_mut().addon_manager_popup = false;+ app.handle_action(Action::Key(ctrl_p)).await;+ assert!(!app.state().addon_manager_popup);+}