Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
feat(dist): add scoop manifest and in-app environment detection
Samir Hossains1b019d89dd40
diff --git a/.github/workflows/homebrew.yml b/.github/workflows/manifests.ymlsimilarity index 69%rename from .github/workflows/homebrew.ymlrename to .github/workflows/manifests.ymlindex b35e225..d75a905 100644--- a/.github/workflows/homebrew.yml+++ b/.github/workflows/manifests.yml@@ -1,4 +1,4 @@-name: Update Homebrew Formula+name: Update Package Manifests (Homebrew & Scoop)on:workflow_run:@@ -8,11 +8,11 @@ on:workflow_dispatch:inputs:tag:- description: "Release tag to mirror into Homebrew (e.g. v0.1.13)"+ description: "Release tag to mirror into Homebrew and Scoop (e.g. v0.1.23)"required: truejobs:- update-homebrew:+ update-manifests:if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}runs-on: ubuntu-latesttimeout-minutes: 15@@ -68,8 +68,10 @@ jobs:macos_sha=$(awk '$2 == "MovieBox_macOS_Universal.tar.gz" {print $1}' SHA256SUMS)linux_x64_sha=$(awk '$2 == "MovieBox_Linux_x64.tar.gz" {print $1}' SHA256SUMS)linux_arm64_sha=$(awk '$2 == "MovieBox_Linux_arm64.tar.gz" {print $1}' SHA256SUMS)+ windows_x64_sha=$(awk '$2 == "MovieBox_Windows_x64.zip" {print $1}' SHA256SUMS)+ windows_arm64_sha=$(awk '$2 == "MovieBox_Windows_arm64.zip" {print $1}' SHA256SUMS)- for sha in "$macos_sha" "$linux_x64_sha" "$linux_arm64_sha"; do+ for sha in "$macos_sha" "$linux_x64_sha" "$linux_arm64_sha" "$windows_x64_sha" "$windows_arm64_sha"; doif [[ ! "$sha" =~ ^[0-9a-fA-F]{64}$ ]]; thenecho "::error::Invalid or missing SHA256 checksum in release manifest: $sha"exit 1@@ -79,7 +81,8 @@ jobs:echo "macos_sha=$macos_sha" >> $GITHUB_OUTPUTecho "linux_x64_sha=$linux_x64_sha" >> $GITHUB_OUTPUTecho "linux_arm64_sha=$linux_arm64_sha" >> $GITHUB_OUTPUT-+ echo "windows_x64_sha=$windows_x64_sha" >> $GITHUB_OUTPUT+ echo "windows_arm64_sha=$windows_arm64_sha" >> $GITHUB_OUTPUT- name: Update Formulaif: ${{ steps.release_gate.outputs.update != 'false' }}run: |@@ -90,10 +93,28 @@ jobs:sed -i "s/LINUX_X64_SHA256 = \".*\"/LINUX_X64_SHA256 = \"${{ steps.release.outputs.linux_x64_sha }}\"/" "$FORMULA_FILE"sed -i "s/LINUX_ARM64_SHA256 = \".*\"/LINUX_ARM64_SHA256 = \"${{ steps.release.outputs.linux_arm64_sha }}\"/" "$FORMULA_FILE"+ - name: Update Scoop Manifest+ if: ${{ steps.release_gate.outputs.update != 'false' }}+ run: |+ MANIFEST="bucket/moviebox-tui.json"+ VERSION="${{ steps.release.outputs.version }}"+ WIN_X64_SHA="${{ steps.release.outputs.windows_x64_sha }}"+ WIN_ARM64_SHA="${{ steps.release.outputs.windows_arm64_sha }}"++ jq --arg ver "$VERSION" \+ --arg x64 "$WIN_X64_SHA" \+ --arg arm64 "$WIN_ARM64_SHA" \+ '.version = $ver |+ .architecture."64bit".url = "https://github.com/${{ github.repository }}/releases/download/v" + $ver + "/MovieBox_Windows_x64.zip" |+ .architecture."64bit".hash = $x64 |+ .architecture."arm64".url = "https://github.com/${{ github.repository }}/releases/download/v" + $ver + "/MovieBox_Windows_arm64.zip" |+ .architecture."arm64".hash = $arm64' \+ "$MANIFEST" > "${MANIFEST}.tmp" && mv "${MANIFEST}.tmp" "$MANIFEST"+- name: Commit and Push Changesif: ${{ steps.release_gate.outputs.update != 'false' }}uses: stefanzweifel/git-auto-commit-action@v7with:- commit_message: "chore(homebrew): update formula to v${{ steps.release.outputs.version }}"- file_pattern: "Formula/moviebox-tui.rb"+ commit_message: "chore(dist): update formula and scoop manifest to v${{ steps.release.outputs.version }}"+ file_pattern: "Formula/moviebox-tui.rb bucket/moviebox-tui.json"branch: maindiff --git a/CHANGELOG.md b/CHANGELOG.mdindex c2f9613..b2443f7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,13 @@# Changelog+## [Unreleased]++### Added+- **Scoop Package Manager Distribution & In-App Environment Detection**:+ - Added native Scoop manifest in `bucket/moviebox-tui.json` supporting x64 and arm64 Windows architectures with automated release hash verification.+ - Automated Scoop manifest synchronization alongside Homebrew in `.github/workflows/manifests.yml`, extracting `MovieBox_Windows_x64.zip` and `MovieBox_Windows_arm64.zip` checksums from `SHA256SUMS`.+ - Added `InstallationEnvironment::Scoop` detection in `src/updater/apply.rs` via executable path inspection (`/scoop/apps/`, `\scoop\apps\`, `/scoop/shims/`, `\scoop\shims\`).+ - Added dedicated update notification modal handling with `[s]` shortcut to display `scoop update moviebox-tui` on Scoop-managed Windows installations.## [0.1.23] - 2026-09-21### Fixeddiff --git a/Cargo.toml b/Cargo.tomlindex 566571e..1b6dba1 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -3,6 +3,7 @@ name = "moviebox-tui"exclude = ["docs/","Formula/",+ "bucket/",".github/",".githooks/",".cargo/",diff --git a/README.md b/README.mdindex 8833fda..dce2483 100644--- a/README.md+++ b/README.md@@ -55,7 +55,13 @@ brew install moviebox-tui### Windows-Open PowerShell and run:+Via Scoop:+```powershell+scoop bucket add moviebox https://github.com/mesamirh/MovieBox-Tui+scoop install moviebox-tui+```++Or automated PowerShell script:```powershellirm https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.ps1 | iex```diff --git a/bucket/moviebox-tui.json b/bucket/moviebox-tui.jsonnew file mode 100644index 0000000..8b41d3e--- /dev/null+++ b/bucket/moviebox-tui.json@@ -0,0 +1,34 @@+{+ "version": "0.1.23",+ "description": "Terminal interface to find, download, and stream movies, TV shows, and live TV",+ "homepage": "https://github.com/mesamirh/MovieBox-Tui",+ "license": "MIT|Apache-2.0",+ "suggest": {+ "mpv": "extras/mpv"+ },+ "architecture": {+ "64bit": {+ "url": "https://github.com/mesamirh/MovieBox-Tui/releases/download/v0.1.23/MovieBox_Windows_x64.zip",+ "hash": "2542689f932eebacab1c7174df0845da3a71c119dfdf7fa2d79566d41ba4101f"+ },+ "arm64": {+ "url": "https://github.com/mesamirh/MovieBox-Tui/releases/download/v0.1.23/MovieBox_Windows_arm64.zip",+ "hash": "06199ff9b23a373fd4abdd027aa525e525cabbdcf7e1ce6c1a63c1e7ccf0e6c4"+ }+ },+ "bin": "moviebox-tui.exe",+ "checkver": "github",+ "autoupdate": {+ "architecture": {+ "64bit": {+ "url": "https://github.com/mesamirh/MovieBox-Tui/releases/download/v$version/MovieBox_Windows_x64.zip"+ },+ "arm64": {+ "url": "https://github.com/mesamirh/MovieBox-Tui/releases/download/v$version/MovieBox_Windows_arm64.zip"+ }+ },+ "hash": {+ "url": "$baseurl/SHA256SUMS"+ }+ }+}diff --git a/docs/controls.md b/docs/controls.mdindex 20a2e9f..4f432aa 100644--- a/docs/controls.md+++ b/docs/controls.md@@ -144,6 +144,7 @@ When a new release is detected, a centered modal card displays the version compa- `u` / `U`: Download and install update immediately (direct binary replacement platforms).- `b` / `B`: Copy Homebrew upgrade command (`brew upgrade moviebox-tui`) to clipboard with status toast on Homebrew-managed installations.+- `s` / `S`: Copy Scoop upgrade command (`scoop update moviebox-tui`) to clipboard with status toast on Scoop-managed installations.- `o` / `O`: Open GitHub release notes in the system browser.- `Esc`: Dismiss modal and return to previous screen.- The notification modal formats release notes into clean, indented category sections (`[Added]`, `[Fixed]`) with bold feature titles and bullet items, docked with inline quick actions (`[u] Update ──── [o] GitHub`).diff --git a/docs/cross-platform.md b/docs/cross-platform.mdindex d01db08..2b11b5f 100644--- a/docs/cross-platform.md+++ b/docs/cross-platform.md@@ -74,6 +74,7 @@ MovieBox-TUI embeds an in-app binary upgrade engine (`src/updater/`) with cross-- **Direct Replacement**: Supported on Linux (`x86_64`, `aarch64`), macOS (Universal binary), and Windows (`x64`, `arm64`). Downloaded release archives are validated against SHA-256 checksums, unpacked to temporary staging files, and swapped atomically with rollback on failure.- **Windows Helper Script**: On Windows, because running executables are locked by the OS, an external transient batch helper (`moviebox_update_helper.bat`) waits for the parent process PID to terminate, attempts atomic binary replacement with a 5-iteration retry loop (to tolerate antivirus/SmartScreen file locks), restarts the application, and self-deletes.- **Homebrew Managed Environments**: Automatically detected via path markers (`/Cellar/`, `/opt/homebrew/`, `/usr/local/Cellar/`, `/home/linuxbrew/`). In-app binary overwrites are disabled to protect package manager integrity; the update modal displays Homebrew instructions (`brew upgrade moviebox-tui`) with a dedicated `[b]` shortcut.+- **Scoop Managed Environments**: Automatically detected via path markers (`/scoop/apps/`, `\scoop\apps\`, `/scoop/shims/`, `\scoop\shims\`). In-app binary overwrites are disabled to protect package manager integrity; the update modal displays Scoop instructions (`scoop update moviebox-tui`) with a dedicated `[s]` shortcut.- **Android / Termux**: Protects Termux environments from overwriting bionic libc binaries with incompatible Linux glibc binaries. Instructs users to re-run the universal installer script (`curl -fsSL ... | bash`).- **Deterministic GitHub Asset Fallback**: When GitHub API requests are unauthenticated or rate-limited (status 403), tag resolution falls back to HTTP redirects, and asset download URLs are computed deterministically from release tags rather than failing update operations.- **Input Isolation & Event Locking**: Update notifications defer blocking modal presentation while typing in search mode (`InputMode::Editing`) to prevent keystroke hijacking. During in-flight update execution (`is_updating`), all keyboard and mouse events are locked while displaying an active Braille progress spinner.diff --git a/docs/installation.md b/docs/installation.mdindex 3bb6b9a..1a74e7a 100644--- a/docs/installation.md+++ b/docs/installation.md@@ -25,12 +25,18 @@ brew install moviebox-tui## Windows-Open PowerShell and run:+### Scoop Package Manager```powershell-irm https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.ps1 | iex+scoop bucket add moviebox https://github.com/mesamirh/MovieBox-Tui+scoop install moviebox-tui```+### Automated PowerShell Script++```powershell+irm https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.ps1 | iex+```---## Android (Termux)diff --git a/src/tui/app/keyboard.rs b/src/tui/app/keyboard.rsindex 4846db8..99135f1 100644--- a/src/tui/app/keyboard.rs+++ b/src/tui/app/keyboard.rs@@ -93,16 +93,25 @@ impl App {if self.state.input_mode != InputMode::Editing {if let Some((version, _)) = &self.state.update_available {- let is_homebrew = std::env::current_exe()- .map(|p| crate::updater::apply::is_homebrew_managed(&p))- .unwrap_or(false);+ let env = std::env::current_exe()+ .as_deref()+ .map(crate::updater::apply::detect_environment)+ .unwrap_or(crate::updater::apply::InstallationEnvironment::DirectReplace);match key.code {- KeyCode::Char('u') | KeyCode::Char('U') if !is_homebrew => {+ KeyCode::Char('u') | KeyCode::Char('U')+ if matches!(+ env,+ crate::updater::apply::InstallationEnvironment::DirectReplace+ | crate::updater::apply::InstallationEnvironment::WindowsHelper+ ) =>+ {self.action_sender.send(Action::StartSelfUpdate).ok();return None;}- KeyCode::Char('b') | KeyCode::Char('B') if is_homebrew => {+ KeyCode::Char('b') | KeyCode::Char('B')+ if env == crate::updater::apply::InstallationEnvironment::Homebrew =>+ {self.state.set_status_short("Run: brew upgrade moviebox-tui");self.state.notify(@@ -113,6 +122,19 @@ impl App {self.state.update_available = None;return None;}+ KeyCode::Char('s') | KeyCode::Char('S')+ if env == crate::updater::apply::InstallationEnvironment::Scoop =>+ {+ self.state+ .set_status_short("Run: scoop update moviebox-tui");+ self.state.notify(+ crate::tui::overlay::NotificationKind::Info,+ "Scoop Upgrade",+ "Run: scoop update moviebox-tui",+ );+ self.state.update_available = None;+ return None;+ }KeyCode::Char('o') | KeyCode::Char('O') => {let url = crate::updater::check::release_tag_url(version);let _ = open::that(&url);diff --git a/src/tui/app/mouse.rs b/src/tui/app/mouse.rsindex e5ddd50..d29075a 100644--- a/src/tui/app/mouse.rs+++ b/src/tui/app/mouse.rs@@ -309,22 +309,37 @@ impl App {.popup_area.contains(ratatui::layout::Position::new(col, row)){- let is_homebrew = std::env::current_exe()- .map(|p| crate::updater::apply::is_homebrew_managed(&p))- .unwrap_or(false);+ let env = std::env::current_exe()+ .as_deref()+ .map(crate::updater::apply::detect_environment)+ .unwrap_or(crate::updater::apply::InstallationEnvironment::DirectReplace);if row == layout.button_row_y {if col < layout.update_btn_end_x {- if is_homebrew {- self.state- .set_status_short("Run: brew upgrade moviebox-tui");- self.state.notify(- NotificationKind::Info,- "Homebrew Upgrade",- "Run: brew upgrade moviebox-tui",- );- } else {- self.action_sender.send(Action::StartSelfUpdate).ok();+ match env {+ crate::updater::apply::InstallationEnvironment::Homebrew => {+ self.state+ .set_status_short("Run: brew upgrade moviebox-tui");+ self.state.notify(+ NotificationKind::Info,+ "Homebrew Upgrade",+ "Run: brew upgrade moviebox-tui",+ );+ }+ crate::updater::apply::InstallationEnvironment::Scoop => {+ self.state+ .set_status_short("Run: scoop update moviebox-tui");+ self.state.notify(+ NotificationKind::Info,+ "Scoop Upgrade",+ "Run: scoop update moviebox-tui",+ );+ }+ crate::updater::apply::InstallationEnvironment::DirectReplace+ | crate::updater::apply::InstallationEnvironment::WindowsHelper => {+ self.action_sender.send(Action::StartSelfUpdate).ok();+ }+ _ => {}}} else if col < layout.open_btn_end_x {let url = crate::updater::check::release_tag_url(ver);diff --git a/src/tui/app/run.rs b/src/tui/app/run.rsindex 3d95857..ea6aeaf 100644--- a/src/tui/app/run.rs+++ b/src/tui/app/run.rs@@ -1160,6 +1160,23 @@ impl App {]}}+ crate::updater::apply::InstallationEnvironment::Scoop => {+ if is_compact_modal {+ vec![+ Span::styled("[s]", self.theme.shortcut),+ Span::styled(" Copy ", self.theme.text),+ Span::styled("[o]", self.theme.shortcut),+ Span::styled(" GitHub", self.theme.text),+ ]+ } else {+ vec![+ Span::styled("[s]", self.theme.shortcut),+ Span::styled(" Copy Command ──── ", self.theme.text),+ Span::styled("[o]", self.theme.shortcut),+ Span::styled(" GitHub", self.theme.text),+ ]+ }+ }crate::updater::apply::InstallationEnvironment::Termux| crate::updater::apply::InstallationEnvironment::Flatpak| crate::updater::apply::InstallationEnvironment::Snap@@ -1210,6 +1227,19 @@ impl App {]));text.push(Line::from(""));}+ crate::updater::apply::InstallationEnvironment::Scoop => {+ text.push(Line::from(vec![+ Span::raw(" "),+ Span::styled("Scoop Managed • Run: ", self.theme.text_dim),+ Span::styled(+ "scoop update moviebox-tui",+ self.theme+ .shortcut+ .add_modifier(ratatui::style::Modifier::BOLD),+ ),+ ]));+ text.push(Line::from(""));+ }crate::updater::apply::InstallationEnvironment::Termux => {text.push(Line::from(vec![Span::raw(" "),diff --git a/src/updater/apply.rs b/src/updater/apply.rsindex ffb9578..1cacef8 100644--- a/src/updater/apply.rs+++ b/src/updater/apply.rs@@ -14,6 +14,7 @@ pub enum SelfUpdateOutcome {pub enum InstallationEnvironment {DirectReplace,Homebrew,+ Scoop,Termux,Flatpak,Snap,@@ -43,6 +44,9 @@ pub fn detect_environment(exe_path: &Path) -> InstallationEnvironment {if is_homebrew_managed(exe_path) {return InstallationEnvironment::Homebrew;}+ if is_scoop_managed(exe_path) {+ return InstallationEnvironment::Scoop;+ }if cfg!(windows) {return InstallationEnvironment::WindowsHelper;}@@ -76,6 +80,25 @@ pub fn is_homebrew_managed(exe_path: &Path) -> bool {false}+pub fn is_scoop_managed(exe_path: &Path) -> bool {+ let check_path = |p: &Path| -> bool {+ let s = p.to_string_lossy().to_lowercase().replace('\\', "/");+ s.contains("/scoop/apps/") || s.contains("/scoop/shims/")+ };++ if check_path(exe_path) {+ return true;+ }++ if let Ok(canonical) = exe_path.canonicalize() {+ if check_path(&canonical) {+ return true;+ }+ }++ false+}+pub fn is_writable(exe_path: &Path) -> bool {let parent = match exe_path.parent() {Some(p) => p,@@ -104,6 +127,11 @@ pub fn apply_staged_binary("This installation is managed by Homebrew. Run: brew upgrade moviebox-tui".to_string(),))}+ InstallationEnvironment::Scoop => {+ Ok(SelfUpdateOutcome::RequiresManualUpgrade(+ "This installation is managed by Scoop. Run: scoop update moviebox-tui".to_string(),+ ))+ }InstallationEnvironment::Termux => {Ok(SelfUpdateOutcome::RequiresManualUpgrade("Android / Termux update: run 'curl -fsSL https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.sh | bash'".to_string(),@@ -314,6 +342,21 @@ mod tests {);}+ #[test]+ fn detects_scoop_managed_environment() {+ let win_path =+ Path::new("C:\\Users\\user\\scoop\\apps\\moviebox-tui\\0.1.23\\moviebox-tui.exe");+ assert!(is_scoop_managed(win_path));+ assert_eq!(detect_environment(win_path), InstallationEnvironment::Scoop);++ let shim_path = Path::new("C:\\Users\\user\\scoop\\shims\\moviebox-tui.exe");+ assert!(is_scoop_managed(shim_path));+ assert_eq!(+ detect_environment(shim_path),+ InstallationEnvironment::Scoop+ );+ }+#[test]fn helper_script_waits_moves_and_cleans_up() {let script = render_helper_script(diff --git a/src/updater/mod.rs b/src/updater/mod.rsindex ddaeeee..81fe5eb 100644--- a/src/updater/mod.rs+++ b/src/updater/mod.rs@@ -7,7 +7,7 @@ pub mod verify;pub use apply::{InstallationEnvironment, SelfUpdateOutcome, apply_staged_binary, detect_environment,- is_homebrew_managed, is_writable, restart_process,+ is_homebrew_managed, is_scoop_managed, is_writable, restart_process,};pub use artifact::{Release, ReleaseAsset, TargetPlatform, is_termux_environment};pub use check::{check, check_release, is_newer};@@ -27,6 +27,11 @@ pub async fn perform_self_update(.to_string(),));}+ InstallationEnvironment::Scoop => {+ return Ok(SelfUpdateOutcome::RequiresManualUpgrade(+ "This installation is managed by Scoop. Run: scoop update moviebox-tui".to_string(),+ ));+ }InstallationEnvironment::Termux => {return Ok(SelfUpdateOutcome::RequiresManualUpgrade("Android / Termux update: run 'curl -fsSL https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.sh | bash'".to_string(),