diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 2d22ae7..377e2be 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,5 +1,5 @@ name: Report a problem -description: Something in Roku Control doesn't work the way it should. +description: Something in Open Remote Control doesn't work the way it should. title: "[Bug]: " labels: ["bug"] body: @@ -23,7 +23,7 @@ body: attributes: label: Steps to reproduce placeholder: | - 1. Open Roku Control + 1. Open Open Remote Control 2. Pick my living room TV 3. … - type: textarea diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c294c6e..dcd323b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,4 +2,4 @@ blank_issues_enabled: true contact_links: - name: MoveWeight.com url: https://moveweight.com - about: The people who make Roku Control. + about: The people who make Open Remote Control. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 2c92786..2101543 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,12 +1,12 @@ name: Suggest an idea -description: A feature, a button, a shortcut — anything that would make Roku Control better for you. +description: A feature, a button, a shortcut — anything that would make Open Remote Control better for you. title: "[Idea]: " labels: ["enhancement"] body: - type: markdown attributes: value: | - Roku Control is free, open source and ad-free. Ideas from people who use it decide what gets built next — thank you! + Open Remote Control is free, open source and ad-free. Ideas from people who use it decide what gets built next — thank you! - type: textarea id: idea attributes: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b6fd97e..a2e11ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,12 @@ name: Build installers -# Runs by hand from the Actions tab (optionally publishing a release and -# submitting to the Microsoft Store), on a version tag (v2.1.0), or on a pull -# request labelled "build-installers" (a downloadable preview for testing). +# Runs on pull requests to build all desktop installers, by hand from the Actions tab, +# or on a version tag. Store submission stays gated until the existing listing is ready. on: workflow_dispatch: inputs: release: - description: Publish a GitHub release with this tag (e.g. v2.1.0). Leave empty to only build. + description: Publish a GitHub release with this tag (e.g. v2.1.2). Leave empty to only build. required: false default: '' store: @@ -17,7 +16,7 @@ on: push: tags: ['v*'] pull_request: - types: [labeled, synchronize, reopened] + types: [opened, synchronize, reopened] permissions: contents: read @@ -29,7 +28,6 @@ concurrency: jobs: build: name: ${{ matrix.os }} - if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'build-installers') strategy: fail-fast: false matrix: @@ -73,16 +71,16 @@ jobs: $version = (Select-Xml -Path msix/AppxManifest.xml -Namespace @{ m = 'http://schemas.microsoft.com/appx/manifest/foundation/windows10' } -XPath '/m:Package/m:Identity').Node.Version $stage = Join-Path $env:RUNNER_TEMP 'msix' New-Item -ItemType Directory -Force (Join-Path $stage 'Assets') | Out-Null - Copy-Item src-tauri/target/release/roku-control.exe $stage + Copy-Item src-tauri/target/release/open-remote-control.exe $stage Copy-Item msix/AppxManifest.xml $stage Copy-Item msix/Assets/* (Join-Path $stage 'Assets') New-Item -ItemType Directory -Force src-tauri/target/release/bundle/msix | Out-Null - & $makeappx.FullName pack /d $stage /p "src-tauri/target/release/bundle/msix/RokuControl_${version}_x64.msix" /o + & $makeappx.FullName pack /d $stage /p "src-tauri/target/release/bundle/msix/OpenRemoteControl_${version}_x64.msix" /o if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - uses: actions/upload-artifact@v4 with: - name: roku-control-${{ runner.os }} + name: open-remote-control-${{ runner.os }} if-no-files-found: error path: | src-tauri/target/release/bundle/msix/*.msix @@ -93,15 +91,12 @@ jobs: src-tauri/target/release/bundle/rpm/*.rpm src-tauri/target/release/bundle/appimage/*.AppImage - # Publish the installers as a GitHub release, so there is a direct download - # link. A release asked for from the Actions tab is published right away; - # pushed tags with a suffix (v2.1.0-beta.1) publish a pre-release and plain - # version tags make a draft to review first; a labelled PR gets a - # "preview-pr" pre-release that is replaced on every push. + # Publish only when a release tag is requested or pushed. Explicit dispatches publish immediately; + # pushed version tags make stable releases drafts and beta tags pre-releases. release: name: Publish release needs: build - if: ${{ !cancelled() && needs.build.result != 'skipped' && (startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request' || inputs.release != '') }} + if: ${{ !cancelled() && needs.build.result != 'skipped' && (startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.release != '')) }} runs-on: ubuntu-latest permissions: contents: write @@ -116,47 +111,38 @@ jobs: GH_TOKEN: ${{ github.token }} EVENT: ${{ github.event_name }} REF_NAME: ${{ github.ref_name }} - PR_NUMBER: ${{ github.event.pull_request.number }} - PR_SHA: ${{ github.event.pull_request.head.sha }} INPUT_TAG: ${{ inputs.release }} run: | mapfile -t files < <(find installers -type f) printf 'Attaching: %s\n' "${files[@]}" - if [ "$EVENT" = pull_request ]; then - tag="preview-pr$PR_NUMBER" - gh release delete "$tag" --repo "$GITHUB_REPOSITORY" --cleanup-tag --yes || true - gh release create "$tag" "${files[@]}" --repo "$GITHUB_REPOSITORY" --target "$PR_SHA" --prerelease \ - --title "Preview build — PR #$PR_NUMBER" \ - --notes "Test build of pull request #$PR_NUMBER at $PR_SHA. Not a release. Installers are unsigned, so Windows may show a SmartScreen warning: choose More info → Run anyway." - elif [ "$EVENT" = workflow_dispatch ]; then + if [ "$EVENT" = workflow_dispatch ]; then if ! [[ "$INPUT_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; then - echo "::error::Release tag must look like v2.1.0 or v2.1.0-beta.1, got '$INPUT_TAG'" + echo "::error::Release tag must look like v2.1.2 or v2.1.2-beta.1, got '$INPUT_TAG'" exit 1 fi kind=--latest case "$INPUT_TAG" in *-*) kind=--prerelease ;; esac gh release create "$INPUT_TAG" "${files[@]}" --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" \ - --title "Roku Control $INPUT_TAG" --generate-notes "$kind" + --title "Open Remote Control $INPUT_TAG" --generate-notes "$kind" else kind=--draft case "$REF_NAME" in *-*) kind=--prerelease ;; esac gh release create "$REF_NAME" "${files[@]}" --repo "$GITHUB_REPOSITORY" \ - --title "Roku Control $REF_NAME" --generate-notes "$kind" + --title "Open Remote Control $REF_NAME" --generate-notes "$kind" fi - # Submit the MSIX to the Microsoft Store listing (product 9MTNNGZKJ1WK) with - # Microsoft's Store CLI. Needs an Azure AD app linked in Partner Center; its - # IDs go in the PARTNER_CENTER_* repository secrets. Certification then - # takes Microsoft a few hours to a few days. + # Submit to the existing Store product only after Microsoft restores it and its Store listing is rebranded. + # Set STORE_PRODUCT_REINSTATED=true only after both conditions are met. + # Partner Center CLI credentials belong in PARTNER_CENTER_* repository secrets. store: name: Submit to Microsoft Store needs: build - if: ${{ github.event_name == 'workflow_dispatch' && inputs.store && needs.build.result == 'success' }} + if: ${{ github.event_name == 'workflow_dispatch' && inputs.store && needs.build.result == 'success' && vars.STORE_PRODUCT_REINSTATED == 'true' }} runs-on: windows-latest steps: - uses: actions/download-artifact@v4 with: - name: roku-control-Windows + name: open-remote-control-Windows path: windows - name: Check the Partner Center secrets diff --git a/CHANGELOG.md b/CHANGELOG.md index f71799a..a0db3b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,50 +1,37 @@ # Changelog +## 2.1.2 — Open Remote Control + +### Added +- Android TV / Google TV pairing with the code displayed by Android TV Remote Service. +- Core Android TV remote controls for navigation, playback, volume, mute, wake and standby. +- A unified TV list and platform-aware controls for Roku and Android TV. + +### Changed +- Rebranded the app display name and Microsoft Store listing to **Open Remote Control**. +- Preserved the existing Store product ID and package identity. +- Updated the Store listing, privacy policy and help content for both supported TV families. + +### Retained +- Roku automatic discovery, manual IP setup, ECP response checking, Limited Mode guidance, Wake-on-LAN and Fast TV Start instructions. +- Roku app/channel launch, input switching, keyboard shortcuts and live text entry. + ## 2.1.0 -Fixes for the problems people reported in Microsoft Store reviews ("didn't -work at all", "only volume works", "still doesn't work on the living room TV"), -plus keyboard control and power-on. +Fixes for the problems people reported in Microsoft Store reviews ("didn't work at all", "only volume works", "still doesn't work on the living room TV"), plus keyboard control and power-on. ### Fixed -- The app opened pointed at the developer's own TVs (hard-coded IP addresses), - so for everyone else no button did anything until they found and changed the - device menu. Those entries are gone; the app now searches your network on - launch and picks what it finds. -- Buttons failed silently. Every command now checks the Roku's answer and says - what went wrong and how to fix it. -- Roku OS 14.1+ "Limited" mode (the reason only volume worked) is detected, and - the app shows the exact setting to change. -- The fallback network scan tried 762 addresses one at a time with a 3-second - timeout — up to ~38 minutes of spinner. It now probes your actual subnet in - parallel in a couple of seconds. -- Discovery now asks on every network adapter, so VPNs and Hyper-V/WSL virtual - adapters no longer swallow the search. -- A system or corporate proxy could intercept requests meant for the Roku; the - app now always connects directly. -- The green "connected" dot was always green. Status is now a real check every - few seconds. -- When the router gives a Roku a new IP, the app finds it again by serial number. -- The close button and window dragging were blocked by missing permissions. -- Rapid presses could arrive out of order; commands are now sent in sequence. -- Typed text now encodes spaces, symbols and accented letters correctly. -- Channel names with `&` showed as `&`. +- Removed hard-coded household TVs; the app now searches the network on launch. +- Commands check the Roku response and explain failures, including Roku OS 14.1+ Limited mode. +- Discovery scans each network adapter and probes the subnet in parallel when SSDP is blocked. +- Requests connect directly instead of going through a system proxy. +- Status checks report the actual connection, and saved Roku devices follow DHCP address changes by serial number. +- Rapid presses are sent in sequence; typed text handles spaces, symbols and accented letters. ### Added -- **Turn on from off**: `PowerOn`, then Wake-on-LAN with retries. -- **Keyboard shortcuts** for every remote button, press-and-hold repeat. -- **Live typing** straight into the TV's search box. -- Real channel icons, a channel filter, "on now", and TV inputs by name. -- Add a Roku by IP, scan the whole network, forget old devices. -- Mini remote that stays on top. -- Help: troubleshooting steps, shortcut list, copy diagnostics. -- Report a problem / Suggest an idea — opens a pre-filled GitHub issue. -- MoveWeight.com and source code links in the footer. -- A one-time invitation to rate the app after ten minutes of use. -- CI (Linux + Windows) and a workflow that builds installers for all three OSes, - packs the Microsoft Store MSIX, publishes GitHub releases and can submit to - the Store. +- Power On and Wake-on-LAN retries for Roku TVs, keyboard shortcuts, live typing, channel icons, TV inputs, mini remote, help and diagnostics. +- Add a Roku by IP, scan the network and manage saved devices. +- CI and installer workflows for Windows, macOS and Linux. ### Removed -- The volume slider. Rokus can't report their volume, so the slider only ever - guessed; press-and-hold − / + is accurate. +- The volume slider; Roku does not report volume, so the previous slider could only guess. diff --git a/README.md b/README.md index 201f9fd..e1cb300 100644 --- a/README.md +++ b/README.md @@ -1,131 +1,52 @@ -# Roku Control +# Open Remote Control -A free desktop remote for Roku TVs and streaming players. Every button on the -physical remote, your keyboard as a remote, live typing into search boxes, -channel launching with real channel art, and a Turn on button that can wake a -TV from standby — in a native window on Windows, macOS or Linux. One Tauri -(Rust + React) codebase, a binary around 5 MB. +A free desktop remote for Roku and Android TV / Google TV. It runs on Windows, macOS and Linux, talks directly to TVs on your local network, and needs no account, ads or tracking. -No ads, no accounts, no tracking. The app only ever talks to the Rokus on your -own network. +The public repository keeps its historical name, `BlizzHacker/RokuControl`; the Microsoft Store product is branded **Open Remote Control**. Its Store product ID and MSIX package identity are unchanged. -## Get it +## Supported TVs -- **Microsoft Store** — search for *Roku Control* (Windows). -- **Installers** — Windows, macOS and Linux downloads are on the - [latest release](https://github.com/BlizzHacker/RokuControl/releases/latest). -- **From source** — any OS: +- **Roku TVs and players:** automatic network discovery, manual IP setup, Roku-style directional controls, channel and app launching, keyboard typing, input selection, Limited Mode diagnostics, and wake assistance. +- **Android TV and Google TV:** manual IP pairing with the six-character code shown by Android TV Remote Service, directional controls, Back, Home, playback, volume, mute, standby and wake commands. + +Android TV support requires the TV's Android TV Remote Service to be available on the local network. Pairing is approved on the TV itself. The app stores its local pairing identity in its application-data folder so it can reconnect after restart. + +## Install from source ```bash git clone https://github.com/BlizzHacker/RokuControl.git cd RokuControl -npm install +npm ci npm run tauri:dev ``` -That's a live dev build with hot reload. To produce a real installer: +Build an installer for the current operating system with `npm run tauri:build`. The build workflow creates Windows, macOS and Linux installers and the Microsoft Store MSIX. -```bash -npm run tauri:build # current OS -npm run tauri:build:win # Windows .msi -npm run tauri:build:mac # macOS .dmg -npm run tauri:build:linux # Linux .deb + .AppImage -``` +## Roku notes -Installers land in `src-tauri/target/release/bundle/`. - -> Build through `npm run tauri:build`, not `cargo build` directly — the Tauri -> script builds the web frontend first. A bare cargo build packages an empty -> frontend and you get a blank window that looks like a broken app. - -## What it does - -- **Finds your Rokus by itself** on launch — SSDP on every network adapter, and - a direct scan of your subnet when multicast is blocked. Add one by IP if you - need to. Devices are remembered by serial number, so when your router hands a - Roku a new address the app follows it. -- **Honest status** — the dot next to your Roku reflects a real check every few - seconds: connected, screen off, not responding, or Limited mode. -- **Turn on from off** — sends `PowerOn`, and if the TV has dropped off the - network, Wake-on-LAN to every MAC address it has seen for it, then keeps - knocking until the TV answers. -- **Your keyboard is a remote** (see below), with press-and-hold repeat on the - arrows and volume. -- **Live typing** — type into the app and the letters appear in the TV's - search box as you type, including accents and symbols. Fix a typo anywhere - and the TV follows. -- **Channels** with their real icons, a filter, and "on now"; **TV inputs** by - the names you gave them on the TV. -- **Mini remote** (📌) — a compact remote that stays on top of other windows. -- **Straight-to-GitHub feedback** — *Report a problem* and *Suggest an idea* - open a pre-filled GitHub issue (Roku model and software version only — never - IPs, names or serials). Nothing is sent until you press Submit. +Roku OS 14.1 and later can reject key presses when **Settings › System › Advanced system settings › Control by mobile apps** is Limited or disabled. Open Remote Control detects the rejection and shows the fix. For Roku TV wake from a deep sleep, enable **Fast TV start**; Wake-on-LAN only works when the TV's network hardware remains able to receive it. + +## Android TV notes + +Choose Android TV / Google TV in **Pair or manage TVs**, enter the TV's IP address, then type the short code displayed on the television. This uses Android TV Remote Service's local encrypted pairing and control connections, not ADB. If a TV does not expose that service, it cannot be paired by this version. ## Keyboard shortcuts -| Key | Does | -|-----|------| -| ↑ ↓ ← → | Move | +| Key | Action | +|-----|--------| +| Arrow keys | Move | | Enter | OK | | Backspace / Esc | Back | | H | Home | | Space or P | Play / Pause | -| `,` / `.` (or `[` / `]`) | Rewind / Fast forward | -| R | Instant replay | -| I or `*` | Options | -| S | Search | -| `+` / `−` / M | Volume up / down / mute | -| Page Up / Page Down | Channel up / down | -| `/` or T | Start typing on the TV (Esc to stop) | -| `?` | Show all shortcuts | - -## If something doesn't work - -**Only volume works, or the app says your Roku is blocking it.** Roku OS 14.1 -and later ship in *Limited* mode. On the Roku open -**Settings › System › Advanced system settings › Control by mobile apps** and -choose **Enabled** (or set **Network access** to **Permissive**). - -**Turn on doesn't wake the TV.** A Roku TV that is fully off switches its -network off too. Turn on **Settings › System › Power › Fast TV start**. - -**No Roku found.** Put the computer on the same network as the Roku (not a -guest network). On Windows, set that network to *Private*. You can always add a -Roku by IP — it's under **Settings › Network › About** on the Roku. - -Still stuck? Use **Report a problem** in the app, or -[open an issue](https://github.com/BlizzHacker/RokuControl/issues/new/choose). - -## How it works - -Roku devices expose the -[External Control Protocol](https://developer.roku.com/docs/developer-program/dev-tools/external-control-api.md) -on port 8060: plain HTTP for keypresses, app launching and device queries. The -app discovers devices with an SSDP multicast query (`239.255.255.250:1900`) and -then talks straight to each Roku. - -| Layer | Tech | -|-------|------| -| Desktop shell | Tauri 2 (Rust) | -| UI | React 19 + Vite | -| Networking | reqwest (plain HTTP, no proxy) | -| Discovery | SSDP multicast + subnet probe | -| Wake | Wake-on-LAN magic packets | - -Run the Rust tests (they include a fake Roku to talk to) with -`cd src-tauri && cargo test`. +| `,` / `.` | Rewind / Fast forward | +| `+` / `−` / M | Volume / Mute | +| `?` | Show shortcuts | ## Privacy -Roku Control does not collect or transmit any personal data. All -communication is strictly between the app and Roku devices on your local -network. No analytics, no telemetry, no tracking. See [privacy.txt](privacy.txt). - -## Credits - -Made ad-free by [MoveWeight.com](https://moveweight.com). If the app helps -you, a rating in the Microsoft Store or a star here is how other people find it. +Device details and the Android TV pairing identity stay on your computer. The app does not collect telemetry or send commands through a cloud service. See [privacy.txt](privacy.txt). ## License -MIT — see [LICENSE](LICENSE). +MIT. Roku, Android TV and Google TV are trademarks of their respective owners. Open Remote Control is independent and unaffiliated. diff --git a/STORE-LISTING.txt b/STORE-LISTING.txt index 260e2ef..c9b1dc6 100644 --- a/STORE-LISTING.txt +++ b/STORE-LISTING.txt @@ -1,79 +1,65 @@ -=== COPY EVERYTHING BELOW INTO YOUR STORE LISTING === +MICROSOFT STORE LISTING — EXISTING PRODUCT 9MTNNGZKJ1WK ---- DESCRIPTION --- +Product name (English): Open Remote Control +Keep the existing Store product ID and package identity. Do not create a new product. -Control any Roku TV or streaming player on your network with this free desktop remote. No ads, no accounts, no tracking — it only ever talks to the Rokus in your home. +DESCRIPTION -FINDS YOUR ROKU BY ITSELF -Open the app and it searches your network — on every adapter, with a direct scan if your router blocks discovery. It remembers each Roku by serial number, so it keeps working when your router gives the TV a new address. Or add one by IP in seconds. +One remote for Roku, Android TV and Google TV — right from your Windows PC. Connect to TVs on your home network with no account, ads or tracking. Open Remote Control talks directly to your TV; it does not route commands through a cloud service. -TURN YOUR TV ON FROM STANDBY -One click sends Power On. If the TV has dropped off the network, the app sends a Wake-on-LAN signal and keeps trying. (For the most reliable wake-up, turn on Fast TV start on your Roku TV — the app shows you how.) +ROKU TVS AND PLAYERS -YOUR KEYBOARD IS A REMOTE -Arrow keys move, Enter is OK, Backspace is Back, Space plays and pauses, + and − change the volume. Hold a key to keep scrolling. Press ? to see every shortcut. +• Find Roku devices automatically or add one by IP. +• Use a tactile, directional remote layout with arrows and OK. +• Open channels, launch apps and switch TV inputs. +• Type into Roku search fields with your PC keyboard. +• See why commands fail, including Roku OS Limited mode. +• Send Power On and Wake-on-LAN requests. For reliable wake from deep standby, enable Fast TV Start on the Roku TV. -TYPE STRAIGHT INTO YOUR TV -Search Netflix, YouTube, Plex or any app by typing on your real keyboard — letters show up on the TV as you type, accents and symbols included. +ANDROID TV AND GOOGLE TV -EVERY BUTTON ON THE REMOTE -D-pad and OK, Back, Home, Options, Search, Play/Pause, Rewind, Fast Forward, Instant Replay, Volume and Mute, Channel Up/Down, TV inputs by the names you gave them, and Find My Remote. +• Pair by IP using the short code shown on your TV. +• Control navigation, Back, Home, playback, volume and mute. +• Send wake and standby requests over Android TV Remote Service. +• Keep the pairing identity on this computer for reconnecting after restart. -YOUR CHANNELS, ONE CLICK AWAY -All your channels with their real icons, a quick filter, and what's on now. +YOUR NETWORK, YOUR TV -MINI REMOTE -A compact remote that stays on top of your other windows. +Free and open source. No account, subscriptions, ads, analytics or tracking. Device control stays on your local network. -TELLS YOU WHAT'S WRONG — AND HOW TO FIX IT -A live status light shows whether your Roku is connected, asleep or unreachable. If your Roku is blocking remote control (Roku's "Limited" mode), the app shows you exactly which setting to change. +WHAT'S NEW (2.1.2) -FREE, OPEN SOURCE, PRIVATE -Made ad-free by MoveWeight.com. Report a problem or suggest an idea from inside the app. The source code is on GitHub. +• Rebranded as Open Remote Control. +• Added Android TV and Google TV pairing and remote controls. +• Kept Roku discovery, Limited Mode diagnostics, wake assistance, keyboard controls and app/channel tools. +• Updated the remote layout and device manager for multiple TV platforms. ---- WHAT'S NEW (2.1.0) --- +FEATURES -• Finds your Roku automatically when you open the app -• Fixes "only volume works": the app now spots Roku's Limited mode and shows the setting to change -• Turn on your TV from standby (Power On + Wake-on-LAN) -• Full keyboard control and live typing into search boxes -• Real channel icons, TV inputs by name, mini always-on-top remote -• Clear messages when something's wrong, and a Help screen -• Report problems and suggest ideas straight from the app +• Roku TVs and streaming players +• Android TV and Google TV pairing by on-screen code +• Physical-remote style arrows and OK button +• Roku discovery, apps, channels and TV inputs +• Roku Limited Mode diagnostics and wake assistance +• Android TV navigation, playback, volume, mute, wake and standby +• No account, ads, telemetry or cloud relay ---- FEATURES (short list) --- +KEYWORDS -• Automatic Roku discovery — follows your TV when its IP changes -• Turn on from standby (Power On + Wake-on-LAN) -• Keyboard shortcuts for every button -• Live typing into search boxes -• Full D-pad, playback, volume and channel controls -• TV inputs and channel launcher with real icons -• Live connection status with fix-it help -• Mini remote that stays on top -• Report problems and ideas from the app -• No ads, no accounts, no tracking — free and open source +TV remote, Roku remote, Android TV remote, Google TV remote, smart TV remote, desktop remote, streaming player remote ---- KEYWORDS --- +CATEGORY -roku remote, roku control, tv remote, roku tv, hisense remote, tcl remote, onn remote, roku keyboard, desktop remote, roku controller, plex remote, smart tv remote +Keep the existing assigned category unless Partner Center flags it for correction. ---- CATEGORY --- - -Utilities & tools > Remote & control - ---- PRIVACY POLICY URL --- +PRIVACY POLICY URL https://github.com/BlizzHacker/RokuControl/blob/master/privacy.txt ---- PRICE --- +PRICE Free ---- SCREENSHOTS (need 1366x768 PNG, 3 minimum) --- +SCREENSHOTS -Take these with Win+Shift+S while the app is open: -1. Main remote with D-pad and all buttons visible -2. Channels grid with channel icons and "On now" -3. Mini remote floating over the desktop -4. Help screen showing keyboard shortcuts +Refresh screenshots for the Open Remote Control title and multi-platform device manager. Show the Roku remote, the Android TV pairing flow, and the paired Android TV remote. Do not show private IPs, home-device names, serials or pairing codes. diff --git a/STORE.md b/STORE.md index 2c16d30..3557877 100644 --- a/STORE.md +++ b/STORE.md @@ -1,65 +1,47 @@ -# Publishing to the Microsoft Store +# Microsoft Store recovery and release notes -Roku Control is an MSIX product in Partner Center (Store ID `9MTNNGZKJ1WK`, -package identity `MOVEWEIGHT.RokuControl`). The *Build installers* workflow -builds the app and packs the Store `.msix` with the Windows SDK's `makeappx` -from `msix/AppxManifest.xml`. Partner Center signs the package on upload. +## Existing product identity -## Before every release +- Store product ID: `9MTNNGZKJ1WK` +- Current MSIX identity name: `MOVEWEIGHT.RokuControl` +- Publisher: `CN=6375D74B-5E4F-45B4-B246-B29507C1332A` +- Product name for the English Store listing: **Open Remote Control** -1. Bump the version in `package.json`, `src-tauri/Cargo.toml`, - `src-tauri/tauri.conf.json` and `msix/AppxManifest.xml` (`2.1.0` → `2.1.0.0`). - The Store only accepts a version higher than the one it has. -2. Update `CHANGELOG.md` and the "What's new" block in `STORE-LISTING.txt`. +Keep the Store ID, MSIX Identity Name, publisher certificate identity, and Tauri `identifier` unchanged. The rebrand changes the display name and app content only. Do not create a new Store product. -## Build and publish the release +## Why Microsoft removed the product -Actions → **Build installers** → **Run workflow** on `master`: +The October 10, 2026 certification report rejected the Store product name under policy 10.1.1.1, **Inaccurate Representation**: the name “Roku Control” was found to contain the title of another software or service. The September 24 report gave a deadline to submit a name update by October 8. The product was removed after that deadline. The draft submission still listed Store listings as unchanged, even though the package was updated to 2.1.1. -- **release:** the tag to publish, e.g. `v2.1.0`. The installers and the - `.msix` are attached to a GitHub release with that tag. -- **store:** tick it to also submit the `.msix` to the Store (see below). +Partner Center now says the removed product cannot be submitted until the publisher contacts its Microsoft representative. Include product ID `9MTNNGZKJ1WK` in that request. Once Microsoft re-enables submission for this same product, update the Store listing name and text, upload version 2.1.2, review the existing submission, and submit for certification. -## Submit to the Store +## Package build -### Option A — automatically from GitHub (one-time setup) +The package workflow builds the app for Windows, macOS and Linux, then packs the Windows executable with `msix/AppxManifest.xml`. Microsoft signs the MSIX after upload. -1. Partner Center → **Account settings** → **User management** → - **Azure AD applications** → **Add Azure AD application** (create a new one), - role **Manager**. Create a **key** for it. -2. Note the **Tenant ID**, **Client ID** and the key (client secret), and your - **Seller ID** (Account settings → Legal info → Developer tab). -3. GitHub → repository **Settings** → **Secrets and variables** → **Actions**, - add: `PARTNER_CENTER_TENANT_ID`, `PARTNER_CENTER_CLIENT_ID`, - `PARTNER_CENTER_CLIENT_SECRET`, `PARTNER_CENTER_SELLER_ID`. +1. Bump the version consistently in `package.json`, `src-tauri/Cargo.toml`, `src-tauri/tauri.conf.json`, and `msix/AppxManifest.xml`. The current version is 2.1.2. +2. Run `npm ci`, `npm run build`, and `cd src-tauri && cargo test`. +3. Run the **Build installers** GitHub Actions workflow. It attaches the MSIX and desktop installers. +4. Do not run automatic Store publishing while Partner Center marks this product removed. After Microsoft restores the existing product, the existing package can be uploaded to the same listing. -From then on, running the workflow with **store** ticked uploads the package -and submits it for certification using Microsoft's `msstore` CLI. +## Partner Center update checklist -### Option B — by hand +After Microsoft restores the product for submission: -1. Download `RokuControl__x64.msix` from the GitHub release. -2. Partner Center → Apps and games → **Roku Control** → **Start update**. -3. **Packages:** upload the `.msix`; remove the previous version's package. -4. **Store listings:** paste the description and "What's new" from - `STORE-LISTING.txt`; refresh screenshots if the UI changed. -5. **Properties:** privacy policy URL - `https://github.com/BlizzHacker/RokuControl/blob/master/privacy.txt`. -6. **Submit for certification.** +1. Open product `9MTNNGZKJ1WK` and resume its existing draft. +2. In **Store listings**, set English **Product name** to exactly `Open Remote Control`; update the description, features and What's new from `STORE-LISTING.txt`. +3. Keep the existing listing languages and product identity. +4. In **Packages**, replace the draft package with `OpenRemoteControl_2.1.2.0_x64.msix`. The MSIX identity remains `MOVEWEIGHT.RokuControl`. +5. Review screenshots and privacy URL, confirm the age ratings and submission options remain valid, then inspect the final review page. +6. Submit only after the listing title and package show the new values. -## Certification notes +## Store package identity -- Capabilities: `runFullTrust` (restricted — it's a desktop app; the - justification is "Tauri desktop app, runs as a full-trust Win32 process"), - `privateNetworkClientServer` (talking to Rokus on the LAN) and - `internetClient`. -- Common rejections: the app must launch on a clean machine, the privacy - policy URL must load, and the listing must only describe features the app - has. -- Screenshots (1366×768 PNG, at least 1): main remote, channels grid, mini - remote, help/shortcuts. +`msix/AppxManifest.xml` uses the Store identity `MOVEWEIGHT.RokuControl` and publisher certificate specified above. The app's Tauri identifier remains `com.moveweight.roku-control` so existing app-data and local preferences continue to resolve. -## Cost +## Certification notes -$19 one-time Partner Center registration for individuals. Publishing free apps -costs nothing, and the app has no backend. +- Required capabilities: `runFullTrust` (Tauri desktop process), `privateNetworkClientServer` (LAN TV control) and `internetClient` (links the user chooses to open). +- Android TV support uses Android TV Remote Service over local TLS. The user authorizes pairing by entering the code displayed on the TV. Its client certificate and private key are stored only in the user's app-data folder. +- Store listing must describe only Roku and Android TV / Google TV features implemented by this package. +- Privacy policy: `https://github.com/BlizzHacker/RokuControl/blob/master/privacy.txt`. diff --git a/docs/index.html b/docs/index.html index 2b86835..a1f96a4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -Roku Control Privacy Policy

Privacy Policy for Roku Control

Last updated: September 2026

Roku Control does not collect, store on any server, share, or transmit any personal information, usage data, or telemetry.

The app communicates exclusively with Roku devices on your local network (LAN) using the Roku External Control Protocol (ECP) on port 8060. It finds them with SSDP multicast and, if that gets no answer, by checking your local subnet for that port. To turn on a TV that is in standby it may send Wake-on-LAN packets, which also stay on your local network. No data is sent to any external server.

Stored only on your computer, and never transmitted: the names, IP addresses, models and network hardware (MAC) addresses of your Rokus (so the app can reconnect and wake them), your window preference, and two counters — how long the app has been used and how many commands it has sent — used only to show a one-time invitation to rate the app.

Links in the app (MoveWeight.com, Source code, Report a problem, Suggest an idea, Rate) open your web browser or the Microsoft Store, and only when you click them. "Report a problem" pre-fills a GitHub issue with the app version, your operating system, and your Roku's model, software version and settings mode — never its IP address, name, serial number or MAC address. Nothing is sent unless you choose to submit it on GitHub.

This app:

Contact: me@moveweight.com

+Open Remote Control Privacy Policy

Privacy Policy for Open Remote Control

Last updated: November 2026

Open Remote Control does not collect, store on any server, share, or transmit personal information, usage data, or telemetry.

The app communicates directly with Roku and Android TV / Google TV devices on your local network. Roku control uses ECP on port 8060 and local SSDP discovery. Android TV pairing and control use Android TV Remote Service on the local network (ports 6467 and 6466); the TV displays a code you enter to authorize the app. No commands are sent to an external server. Roku Wake-on-LAN packets, when used, stay on your local network.

Stored only on your computer: TV names, IP addresses, models and Roku MAC addresses; app preferences and usage counters; and the Android TV pairing certificate and private key. The pairing key stays in the app's local application-data folder and is used only to reconnect to paired TVs on your LAN. It is never sent to an external server. To revoke a paired certificate, remove Open Remote Control in the TV's Android TV Remote Service paired-device settings.

Links open your browser or the Microsoft Store only when clicked. A GitHub bug-report link may include the app version, operating system, TV family and model, and a redacted error, but never the TV's IP address, name, serial number, MAC address or pairing key. Nothing is sent unless you submit it on GitHub.

Contact: me@moveweight.com

\ No newline at end of file diff --git a/docs/privacy.html b/docs/privacy.html index 2b86835..a1f96a4 100644 --- a/docs/privacy.html +++ b/docs/privacy.html @@ -1 +1 @@ -Roku Control Privacy Policy

Privacy Policy for Roku Control

Last updated: September 2026

Roku Control does not collect, store on any server, share, or transmit any personal information, usage data, or telemetry.

The app communicates exclusively with Roku devices on your local network (LAN) using the Roku External Control Protocol (ECP) on port 8060. It finds them with SSDP multicast and, if that gets no answer, by checking your local subnet for that port. To turn on a TV that is in standby it may send Wake-on-LAN packets, which also stay on your local network. No data is sent to any external server.

Stored only on your computer, and never transmitted: the names, IP addresses, models and network hardware (MAC) addresses of your Rokus (so the app can reconnect and wake them), your window preference, and two counters — how long the app has been used and how many commands it has sent — used only to show a one-time invitation to rate the app.

Links in the app (MoveWeight.com, Source code, Report a problem, Suggest an idea, Rate) open your web browser or the Microsoft Store, and only when you click them. "Report a problem" pre-fills a GitHub issue with the app version, your operating system, and your Roku's model, software version and settings mode — never its IP address, name, serial number or MAC address. Nothing is sent unless you choose to submit it on GitHub.

This app:

Contact: me@moveweight.com

+Open Remote Control Privacy Policy

Privacy Policy for Open Remote Control

Last updated: November 2026

Open Remote Control does not collect, store on any server, share, or transmit personal information, usage data, or telemetry.

The app communicates directly with Roku and Android TV / Google TV devices on your local network. Roku control uses ECP on port 8060 and local SSDP discovery. Android TV pairing and control use Android TV Remote Service on the local network (ports 6467 and 6466); the TV displays a code you enter to authorize the app. No commands are sent to an external server. Roku Wake-on-LAN packets, when used, stay on your local network.

Stored only on your computer: TV names, IP addresses, models and Roku MAC addresses; app preferences and usage counters; and the Android TV pairing certificate and private key. The pairing key stays in the app's local application-data folder and is used only to reconnect to paired TVs on your LAN. It is never sent to an external server. To revoke a paired certificate, remove Open Remote Control in the TV's Android TV Remote Service paired-device settings.

Links open your browser or the Microsoft Store only when clicked. A GitHub bug-report link may include the app version, operating system, TV family and model, and a redacted error, but never the TV's IP address, name, serial number, MAC address or pairing key. Nothing is sent unless you submit it on GitHub.

Contact: me@moveweight.com

\ No newline at end of file diff --git a/index.html b/index.html index 0e7427b..d43f63d 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,9 @@ - Roku Control + + + Open Remote Control
diff --git a/msix/AppxManifest.xml b/msix/AppxManifest.xml index 53bc84b..8f871a3 100644 --- a/msix/AppxManifest.xml +++ b/msix/AppxManifest.xml @@ -2,9 +2,9 @@ - + - Roku Control + Open Remote Control MOVE WEIGHT Assets\StoreLogo.png @@ -15,9 +15,9 @@ - - + + diff --git a/msix/Assets/Square150x150Logo.png b/msix/Assets/Square150x150Logo.png index 77e7d23..e7debe5 100644 Binary files a/msix/Assets/Square150x150Logo.png and b/msix/Assets/Square150x150Logo.png differ diff --git a/msix/Assets/Square44x44Logo.png b/msix/Assets/Square44x44Logo.png index 98fda06..1d24b7d 100644 Binary files a/msix/Assets/Square44x44Logo.png and b/msix/Assets/Square44x44Logo.png differ diff --git a/msix/Assets/StoreLogo.png b/msix/Assets/StoreLogo.png index 98fda06..5253cf7 100644 Binary files a/msix/Assets/StoreLogo.png and b/msix/Assets/StoreLogo.png differ diff --git a/package-lock.json b/package-lock.json index 1b2de48..dade7a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "roku-control", - "version": "2.1.0", + "name": "open-remote-control", + "version": "2.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "roku-control", - "version": "2.1.0", + "name": "open-remote-control", + "version": "2.1.2", "dependencies": { "@tauri-apps/api": "^2.11.1", "@tauri-apps/cli": "^2.11.4", @@ -177,9 +177,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -197,9 +194,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -217,9 +211,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -237,9 +228,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -257,9 +245,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -277,9 +262,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -460,9 +442,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0 OR MIT", "optional": true, "os": [ @@ -479,9 +458,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "Apache-2.0 OR MIT", "optional": true, "os": [ @@ -498,9 +474,6 @@ "cpu": [ "riscv64" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0 OR MIT", "optional": true, "os": [ @@ -517,9 +490,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0 OR MIT", "optional": true, "os": [ @@ -536,9 +506,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "Apache-2.0 OR MIT", "optional": true, "os": [ @@ -855,9 +822,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -879,9 +843,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -903,9 +864,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -927,9 +885,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ diff --git a/package.json b/package.json index 54dd686..1f74928 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "roku-control", + "name": "open-remote-control", "private": true, - "version": "2.1.0", + "version": "2.1.2", "type": "module", "scripts": { "dev": "vite", diff --git a/privacy.txt b/privacy.txt index c9b9d96..7ef267d 100644 --- a/privacy.txt +++ b/privacy.txt @@ -1,21 +1,15 @@ -Privacy Policy for Roku Control +Privacy Policy for Open Remote Control -Last updated: September 2026 +Last updated: November 2026 -Roku Control does not collect, store on any server, share, or transmit any personal information, usage data, or telemetry. +Open Remote Control does not collect, store on any server, share, or transmit personal information, usage data, or telemetry. -The app communicates exclusively with Roku devices on your local network (LAN) using the Roku External Control Protocol (ECP) on port 8060. It finds them with SSDP multicast and, if that gets no answer, by checking your local subnet for that port. To turn on a TV that is in standby it may send Wake-on-LAN packets, which also stay on your local network. No data is sent to any external server. +The app communicates directly with Roku devices and Android TV / Google TV devices on your local network. Roku control uses the Roku External Control Protocol (ECP) on port 8060 and local SSDP discovery. Android TV pairing and control use Android TV Remote Service on the local network (pairing port 6467 and control port 6466); the TV displays a code that you enter to authorize this app. No commands are sent to an external server. Roku Wake-on-LAN packets, when used, also stay on your local network. -Stored only on your computer, and never transmitted: the names, IP addresses, models and network hardware (MAC) addresses of your Rokus (so the app can reconnect and wake them), your window preference, and two counters — how long the app has been used and how many commands it has sent — used only to show a one-time invitation to rate the app. +Stored only on your computer: Roku and Android TV device names, IP addresses, models and Roku network hardware (MAC) addresses; app window preferences; usage counters used only to show a one-time invitation to rate the app; and the Android TV pairing certificate and private key. The pairing key is kept in the app's local application-data folder so the TV can recognize this installation after restart. The key is never sent anywhere except to the Android TV device as part of local TLS pairing and control. Forgetting a TV removes its saved device entry; to revoke a paired certificate, remove Open Remote Control from the TV's Android TV Remote Service paired-device settings. -Links in the app (MoveWeight.com, Source code, Report a problem, Suggest an idea, Rate) open your web browser or the Microsoft Store, and only when you click them. "Report a problem" pre-fills a GitHub issue with the app version, your operating system, and your Roku's model, software version and settings mode — never its IP address, name, serial number or MAC address. Nothing is sent unless you choose to submit it on GitHub. +Links in the app open your browser or the Microsoft Store only when clicked. A GitHub bug-report link may include the app version, operating system, selected TV family and model, and a redacted error. It never includes an IP address, device name, serial number, MAC address or pairing key. Nothing is sent unless you submit it on GitHub. -This app: -- Does NOT collect personal information -- Does NOT use analytics or crash reporting -- Does NOT contain advertisements -- Does NOT require an account or login -- Does NOT access the internet on its own — only Roku devices on your LAN, plus pages you choose to open -- Only stores device details and usage counters locally, on your computer +This app does not collect personal information, use analytics or crash reporting, contain advertisements, or require an account or login. It does not access the internet on its own; it talks to selected TVs on your LAN. If you have questions, contact: me@moveweight.com diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 275e88c..2d26d6b 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adler2" @@ -8,6 +8,17 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "aho-corasick" version = "1.1.4" @@ -47,6 +58,45 @@ version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3" +[[package]] +name = "asn1-rs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5493c3bedbacf7fd7382c6346bbd66687d12bbaad3a89a2d2c303ee6cf20b048" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror 1.0.69", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.118", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.118", +] + [[package]] name = "async-broadcast" version = "0.7.2" @@ -225,6 +275,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "bit-set" version = "0.8.0" @@ -307,15 +363,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "tinyvec", -] - [[package]] name = "bumpalo" version = "3.20.3" @@ -453,6 +500,36 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "chromiacast" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3656a0c01a1fcbf327b3d9af9559c821860653e0c55e81bd013dc21355b7349d" +dependencies = [ + "aes", + "base64ct", + "bytes", + "ctr", + "httparse", + "prost", + "rand", + "rcgen", + "ring", + "rsa", + "rustls", + "rustls-webpki", + "serde", + "serde_json", + "sha2", + "thiserror 2.0.18", + "time", + "tokio", + "tokio-rustls", + "tracing", + "x509-parser", + "zeroize", +] + [[package]] name = "chrono" version = "0.4.45" @@ -465,6 +542,16 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "combine" version = "4.6.7" @@ -484,6 +571,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "cookie" version = "0.18.1" @@ -616,11 +709,20 @@ version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1" +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "darling" -version = "0.23.0" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ "darling_core", "darling_macro", @@ -628,10 +730,11 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.23.0" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" dependencies = [ + "fnv", "ident_case", "proc-macro2", "quote", @@ -641,15 +744,21 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.23.0" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core", "quote", "syn 2.0.118", ] +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + [[package]] name = "dbus" version = "0.9.12" @@ -661,13 +770,38 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + [[package]] name = "deranged" -version = "0.5.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ - "serde_core", + "powerfmt", + "serde", ] [[package]] @@ -698,6 +832,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", ] @@ -834,6 +969,12 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + [[package]] name = "embed-resource" version = "3.0.11" @@ -1705,6 +1846,15 @@ dependencies = [ "cfb", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "ipnet" version = "2.12.0" @@ -1730,6 +1880,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.18" @@ -1847,6 +2006,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" +dependencies = [ + "spin", +] + [[package]] name = "libappindicator" version = "0.9.0" @@ -1896,6 +2064,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + [[package]] name = "libredox" version = "0.1.18" @@ -1964,6 +2138,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -2036,11 +2216,66 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + [[package]] name = "num-conv" -version = "0.2.2" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] [[package]] name = "num-traits" @@ -2049,6 +2284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -2268,6 +2504,15 @@ dependencies = [ "objc2-foundation", ] +[[package]] +name = "oid-registry" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d8034d9489cdaf79228eb9f6a3b8d7bb32ba00d6645ebd48eef4077ceb5bd9" +dependencies = [ + "asn1-rs", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -2285,6 +2530,24 @@ dependencies = [ "libc", ] +[[package]] +name = "open-remote-control" +version = "2.1.2" +dependencies = [ + "base64 0.22.1", + "chromiacast", + "if-addrs", + "reqwest 0.12.28", + "serde", + "serde_json", + "socket2", + "tauri", + "tauri-build", + "tauri-plugin-opener", + "tauri-plugin-process", + "tokio", +] + [[package]] name = "option-ext" version = "0.2.0" @@ -2431,6 +2694,27 @@ dependencies = [ "futures-io", ] +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.33" @@ -2439,9 +2723,9 @@ checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" [[package]] name = "plist" -version = "1.10.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da1d65da6dd5d1e44199ac0f58712d241c0f439f80adea8924d832384087f85" +checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" dependencies = [ "base64 0.22.1", "indexmap 2.14.0", @@ -2505,6 +2789,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -2573,11 +2866,34 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.118", +] + [[package]] name = "quick-xml" -version = "0.41.0" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c" dependencies = [ "memchr", ] @@ -2603,12 +2919,54 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + [[package]] name = "raw-window-handle" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" +[[package]] +name = "rcgen" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75e669e5202259b5314d1ea5397316ad400819437857b90861765f24c4cf80a2" +dependencies = [ + "ring", + "rustls-pki-types", + "time", + "yasna", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -2745,20 +3103,37 @@ dependencies = [ ] [[package]] -name = "roku-control" -version = "2.1.0" +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ - "base64 0.22.1", - "if-addrs", - "reqwest 0.12.28", - "serde", - "serde_json", - "socket2", - "tauri", - "tauri-build", - "tauri-plugin-opener", - "tauri-plugin-process", - "tokio", + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", ] [[package]] @@ -2776,6 +3151,15 @@ dependencies = [ "semver", ] +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + [[package]] name = "rustix" version = "1.1.4" @@ -2789,6 +3173,40 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.23" @@ -3005,12 +3423,11 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.21.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c" +checksum = "381b283ce7bc6b476d903296fb59d0d36633652b633b27f64db4fb46dcbfc3b9" dependencies = [ "base64 0.22.1", - "bs58", "chrono", "hex", "indexmap 1.9.3", @@ -3025,9 +3442,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.21.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d57bc0c8b9a17920c178daa6bb924850d54a9c97ab45194bb8c17ad66bb660" +checksum = "a6d4e30573c8cb306ed6ab1dca8423eec9a463ea0e155f45399455e0368b27e0" dependencies = [ "darling", "proc-macro2", @@ -3093,6 +3510,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "simd-adler32" version = "0.3.9" @@ -3175,6 +3602,22 @@ dependencies = [ "system-deps", ] +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3211,6 +3654,12 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "swift-rs" version = "1.0.7" @@ -3669,29 +4118,30 @@ dependencies = [ [[package]] name = "time" -version = "0.3.53" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18dfaaeddcb932337b5e7866ee7d0ce9b76d2fd092997146f187ec09b4558a50" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", + "itoa", "num-conv", "powerfmt", - "serde_core", + "serde", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.9" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.31" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c431b87111666e491a90baa837f914fb45cd5dc3c268591b0220ff5057f2085f" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -3707,21 +4157,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "tinyvec" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" version = "1.52.3" @@ -3750,6 +4185,16 @@ dependencies = [ "syn 2.0.118", ] +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.18" @@ -4063,6 +4508,12 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.8" @@ -4536,6 +4987,15 @@ dependencies = [ "windows-targets 0.42.2", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.59.0" @@ -4804,6 +5264,33 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "x509-parser" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "ring", + "rusticata-macros", + "thiserror 1.0.69", + "time", +] + +[[package]] +name = "yasna" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +dependencies = [ + "time", +] + [[package]] name = "yoke" version = "0.8.3" @@ -4897,6 +5384,26 @@ dependencies = [ "serde", ] +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.118", +] + [[package]] name = "zerofrom" version = "0.1.8" @@ -4918,6 +5425,12 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" + [[package]] name = "zerotrie" version = "0.2.4" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 6df8227..756483d 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "roku-control" -version = "2.1.0" -description = "Roku Remote Control — cross-platform desktop app" +name = "open-remote-control" +version = "2.1.2" +description = "Open Remote Control for Roku, Android TV and Google TV" authors = ["Wade"] license = "MIT" repository = "https://github.com/BlizzHacker/RokuControl" edition = "2021" -rust-version = "1.77.2" +rust-version = "1.83" [lib] name = "app_lib" @@ -27,3 +27,4 @@ reqwest = { version = "0.12", default-features = false } socket2 = "0.6" if-addrs = "0.13" base64 = "0.22" +chromiacast = { version = "=0.3.1", default-features = false, features = ["android-tv"] } diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 795b9b7..d860e1e 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -1,3 +1,3 @@ fn main() { - tauri_build::build() + tauri_build::build() } diff --git a/src-tauri/icons/128x128.png b/src-tauri/icons/128x128.png index 77e7d23..7f52787 100644 Binary files a/src-tauri/icons/128x128.png and b/src-tauri/icons/128x128.png differ diff --git a/src-tauri/icons/128x128@2x.png b/src-tauri/icons/128x128@2x.png index 0f7976f..a25d812 100644 Binary files a/src-tauri/icons/128x128@2x.png and b/src-tauri/icons/128x128@2x.png differ diff --git a/src-tauri/icons/32x32.png b/src-tauri/icons/32x32.png index 98fda06..d223fa4 100644 Binary files a/src-tauri/icons/32x32.png and b/src-tauri/icons/32x32.png differ diff --git a/src-tauri/icons/Square107x107Logo.png b/src-tauri/icons/Square107x107Logo.png index f35d84f..aeb0032 100644 Binary files a/src-tauri/icons/Square107x107Logo.png and b/src-tauri/icons/Square107x107Logo.png differ diff --git a/src-tauri/icons/Square142x142Logo.png b/src-tauri/icons/Square142x142Logo.png index 1823bb2..ad5fdc7 100644 Binary files a/src-tauri/icons/Square142x142Logo.png and b/src-tauri/icons/Square142x142Logo.png differ diff --git a/src-tauri/icons/Square150x150Logo.png b/src-tauri/icons/Square150x150Logo.png index dc2b22c..e7debe5 100644 Binary files a/src-tauri/icons/Square150x150Logo.png and b/src-tauri/icons/Square150x150Logo.png differ diff --git a/src-tauri/icons/Square284x284Logo.png b/src-tauri/icons/Square284x284Logo.png index 0ed3984..fa72e89 100644 Binary files a/src-tauri/icons/Square284x284Logo.png and b/src-tauri/icons/Square284x284Logo.png differ diff --git a/src-tauri/icons/Square30x30Logo.png b/src-tauri/icons/Square30x30Logo.png index 60bf0ea..5283f92 100644 Binary files a/src-tauri/icons/Square30x30Logo.png and b/src-tauri/icons/Square30x30Logo.png differ diff --git a/src-tauri/icons/Square310x310Logo.png b/src-tauri/icons/Square310x310Logo.png index c8ca0ad..d663359 100644 Binary files a/src-tauri/icons/Square310x310Logo.png and b/src-tauri/icons/Square310x310Logo.png differ diff --git a/src-tauri/icons/Square44x44Logo.png b/src-tauri/icons/Square44x44Logo.png index 8756459..1d24b7d 100644 Binary files a/src-tauri/icons/Square44x44Logo.png and b/src-tauri/icons/Square44x44Logo.png differ diff --git a/src-tauri/icons/Square71x71Logo.png b/src-tauri/icons/Square71x71Logo.png index 2c8023c..11db4b0 100644 Binary files a/src-tauri/icons/Square71x71Logo.png and b/src-tauri/icons/Square71x71Logo.png differ diff --git a/src-tauri/icons/Square89x89Logo.png b/src-tauri/icons/Square89x89Logo.png index 2c5e603..0c08561 100644 Binary files a/src-tauri/icons/Square89x89Logo.png and b/src-tauri/icons/Square89x89Logo.png differ diff --git a/src-tauri/icons/StoreLogo.png b/src-tauri/icons/StoreLogo.png index 17d142c..5253cf7 100644 Binary files a/src-tauri/icons/StoreLogo.png and b/src-tauri/icons/StoreLogo.png differ diff --git a/src-tauri/icons/icon.icns b/src-tauri/icons/icon.icns index a2993ad..7519822 100644 Binary files a/src-tauri/icons/icon.icns and b/src-tauri/icons/icon.icns differ diff --git a/src-tauri/icons/icon.ico b/src-tauri/icons/icon.ico index 06c23c8..bbd9ce7 100644 Binary files a/src-tauri/icons/icon.ico and b/src-tauri/icons/icon.ico differ diff --git a/src-tauri/icons/icon.png b/src-tauri/icons/icon.png index d1756ce..3227f5b 100644 Binary files a/src-tauri/icons/icon.png and b/src-tauri/icons/icon.png differ diff --git a/src-tauri/icons/open-remote-control.svg b/src-tauri/icons/open-remote-control.svg new file mode 100644 index 0000000..1cc76ff --- /dev/null +++ b/src-tauri/icons/open-remote-control.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src-tauri/src/android_tv.rs b/src-tauri/src/android_tv.rs new file mode 100644 index 0000000..4763163 --- /dev/null +++ b/src-tauri/src/android_tv.rs @@ -0,0 +1,331 @@ +use base64::{engine::general_purpose::STANDARD, Engine as _}; +use chromiacast::android_tv::{ + AndroidTvKeyCode, AndroidTvPairingSession, AndroidTvRemote, AndroidTvRemoteClientInfo, + AndroidTvRemoteIdentity, +}; +use serde::{Deserialize, Serialize}; +use std::{collections::HashMap, fs, net::IpAddr, path::PathBuf}; +use tauri::{AppHandle, Manager}; +use tokio::sync::Mutex; + +#[derive(Default)] +pub struct AndroidTvState { + pairings: Mutex>, + remotes: Mutex>, +} + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct AndroidTvDevice { + pub id: String, + pub platform: String, + pub ip: String, + pub name: String, + pub model: String, + pub vendor: String, + pub software_version: String, + pub is_tv: bool, + pub supports_find_remote: bool, +} + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct AndroidTvPairingInfo { + pub ip: String, + pub server_name: Option, +} + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct StoredIdentity { + certificate_der: String, + private_key_pkcs8_der: String, +} + +fn identity_path(app: &AppHandle) -> Result { + let dir = app + .path() + .app_data_dir() + .map_err(|e| format!("Can't open app data folder: {e}"))?; + fs::create_dir_all(&dir).map_err(|e| format!("Can't create app data folder: {e}"))?; + Ok(dir.join("android-tv-identity.json")) +} + +fn save_identity(app: &AppHandle, identity: &AndroidTvRemoteIdentity) -> Result<(), String> { + let path = identity_path(app)?; + let stored = StoredIdentity { + certificate_der: STANDARD.encode(identity.certificate_der()), + private_key_pkcs8_der: STANDARD.encode(identity.private_key_pkcs8_der()), + }; + let bytes = serde_json::to_vec(&stored) + .map_err(|e| format!("Can't encode Android TV pairing identity: {e}"))?; + let temp = path.with_extension("json.tmp"); + fs::write(&temp, bytes).map_err(|e| format!("Can't save Android TV pairing identity: {e}"))?; + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + fs::set_permissions(&temp, fs::Permissions::from_mode(0o600)) + .map_err(|e| format!("Can't protect Android TV pairing identity: {e}"))?; + } + fs::rename(&temp, &path) + .map_err(|e| format!("Can't finish saving Android TV pairing identity: {e}")) +} + +fn load_identity(app: &AppHandle) -> Result { + let path = identity_path(app)?; + let bytes = match fs::read(&path) { + Ok(bytes) => bytes, + Err(error) if error.kind() == std::io::ErrorKind::NotFound => { + let identity = AndroidTvRemoteIdentity::generate("Open Remote Control") + .map_err(|e| format!("Can't create Android TV pairing identity: {e}"))?; + save_identity(app, &identity)?; + return Ok(identity); + } + Err(error) => return Err(format!("Can't read Android TV pairing identity: {error}")), + }; + let stored: StoredIdentity = serde_json::from_slice(&bytes) + .map_err(|e| format!("Saved Android TV pairing identity is damaged: {e}"))?; + let certificate = STANDARD + .decode(stored.certificate_der) + .map_err(|e| format!("Saved Android TV certificate is invalid: {e}"))?; + let private_key = STANDARD + .decode(stored.private_key_pkcs8_der) + .map_err(|e| format!("Saved Android TV private key is invalid: {e}"))?; + AndroidTvRemoteIdentity::from_der(certificate, private_key) + .map_err(|e| format!("Saved Android TV pairing identity is invalid: {e}")) +} + +fn parse_ip(value: &str) -> Result { + value + .trim() + .parse::() + .map_err(|_| "Enter the Android TV's IPv4 or IPv6 address.".to_string()) +} + +fn device_from_remote(ip: IpAddr, remote: &AndroidTvRemote) -> AndroidTvDevice { + let info = remote.device_info(); + let model = info.model().trim().to_string(); + let vendor = info.vendor().trim().to_string(); + let service_version = info.service_version().trim().to_string(); + let name = if model.is_empty() { + format!("Android TV at {ip}") + } else if vendor.is_empty() { + model.clone() + } else { + format!("{vendor} {model}") + }; + AndroidTvDevice { + id: format!("androidtv:{ip}"), + platform: "androidtv".into(), + ip: ip.to_string(), + name, + model, + vendor, + software_version: service_version, + is_tv: true, + supports_find_remote: false, + } +} + +fn device_without_remote(ip: IpAddr, name: Option) -> AndroidTvDevice { + AndroidTvDevice { + id: format!("androidtv:{ip}"), + platform: "androidtv".into(), + ip: ip.to_string(), + name: name + .filter(|s| !s.trim().is_empty()) + .unwrap_or_else(|| format!("Android TV at {ip}")), + model: String::new(), + vendor: String::new(), + software_version: String::new(), + is_tv: true, + supports_find_remote: false, + } +} + +fn client_info() -> AndroidTvRemoteClientInfo { + AndroidTvRemoteClientInfo::new( + "Open Remote Control", + "MOVE WEIGHT", + "com.moveweight.roku-control", + env!("CARGO_PKG_VERSION"), + ) + .expect("valid Android TV client metadata") +} + +async fn connect_remote(app: &AppHandle, state: &AndroidTvState, ip: IpAddr) -> Result<(), String> { + if state.remotes.lock().await.contains_key(&ip) { + return Ok(()); + } + let identity = load_identity(app)?; + let remote = AndroidTvRemote::connect(ip, &identity, client_info()) + .await + .map_err(|e| format!("Can't connect to Android TV at {ip}: {e}"))?; + state.remotes.lock().await.entry(ip).or_insert(remote); + Ok(()) +} + +pub async fn start_pairing( + app: &AppHandle, + state: &AndroidTvState, + value: &str, +) -> Result { + let ip = parse_ip(value)?; + let identity = load_identity(app)?; + let pairing = AndroidTvPairingSession::begin(ip, &identity, "Open Remote Control") + .await + .map_err(|e| format!("Can't start Android TV pairing at {ip}: {e}"))?; + let server_name = pairing.server_name().map(str::to_string); + state.pairings.lock().await.insert(ip, pairing); + Ok(AndroidTvPairingInfo { + ip: ip.to_string(), + server_name, + }) +} + +pub async fn finish_pairing( + app: &AppHandle, + state: &AndroidTvState, + value: &str, + code: &str, +) -> Result { + let ip = parse_ip(value)?; + let pairing = state + .pairings + .lock() + .await + .remove(&ip) + .ok_or_else(|| "Start pairing with this Android TV first.".to_string())?; + let server_name = pairing.server_name().map(str::to_string); + pairing + .finish(code.trim()) + .await + .map_err(|e| format!("Android TV pairing failed: {e}"))?; + let identity = load_identity(app)?; + match AndroidTvRemote::connect(ip, &identity, client_info()).await { + Ok(remote) => { + let device = device_from_remote(ip, &remote); + state.remotes.lock().await.insert(ip, remote); + Ok(device) + } + Err(_) => Ok(device_without_remote(ip, server_name)), + } +} + +pub async fn connect( + app: &AppHandle, + state: &AndroidTvState, + value: &str, +) -> Result { + let ip = parse_ip(value)?; + connect_remote(app, state, ip).await?; + let remotes = state.remotes.lock().await; + let remote = remotes + .get(&ip) + .ok_or_else(|| "Android TV connection closed. Try again.".to_string())?; + Ok(device_from_remote(ip, remote)) +} + +fn key_code(key: &str) -> Result { + let code = match key { + "Up" => AndroidTvKeyCode::DPAD_UP, + "Down" => AndroidTvKeyCode::DPAD_DOWN, + "Left" => AndroidTvKeyCode::DPAD_LEFT, + "Right" => AndroidTvKeyCode::DPAD_RIGHT, + "Select" => AndroidTvKeyCode::DPAD_CENTER, + "Back" => AndroidTvKeyCode::BACK, + "Home" => AndroidTvKeyCode::HOME, + "Info" => AndroidTvKeyCode::SETTINGS, + "Search" => AndroidTvKeyCode::from_raw(84), // Android KEYCODE_SEARCH + "Play" => AndroidTvKeyCode::MEDIA_PLAY_PAUSE, + "Rev" => AndroidTvKeyCode::MEDIA_REWIND, + "Fwd" => AndroidTvKeyCode::MEDIA_FAST_FORWARD, + "InstantReplay" => AndroidTvKeyCode::MEDIA_PREVIOUS, + "VolumeUp" => AndroidTvKeyCode::VOLUME_UP, + "VolumeDown" => AndroidTvKeyCode::VOLUME_DOWN, + "VolumeMute" => AndroidTvKeyCode::VOLUME_MUTE, + "PowerOff" => AndroidTvKeyCode::SLEEP, + "ChannelUp" => AndroidTvKeyCode::from_raw(92), // Android KEYCODE_PAGE_UP + "ChannelDown" => AndroidTvKeyCode::from_raw(93), // Android KEYCODE_PAGE_DOWN + _ => return Err(format!("{key} isn't available on Android TV.")), + }; + Ok(code) +} + +pub async fn keypress( + app: &AppHandle, + state: &AndroidTvState, + value: &str, + key: &str, +) -> Result<(), String> { + let ip = parse_ip(value)?; + let code = key_code(key)?; + connect_remote(app, state, ip).await?; + let remotes = state.remotes.lock().await; + let remote = remotes + .get(&ip) + .ok_or_else(|| "Android TV connection closed. Try again.".to_string())?; + remote + .press_key(code) + .await + .map_err(|e| format!("Android TV command failed: {e}")) +} + +pub async fn power_on(app: &AppHandle, state: &AndroidTvState, value: &str) -> Result<(), String> { + let ip = parse_ip(value)?; + connect_remote(app, state, ip).await?; + let remotes = state.remotes.lock().await; + let remote = remotes + .get(&ip) + .ok_or_else(|| "Android TV connection closed. Try again.".to_string())?; + remote + .press_wake_key() + .await + .map_err(|e| format!("Android TV wake command failed: {e}")) +} + +pub async fn cancel_pairing(state: &AndroidTvState, value: &str) -> Result<(), String> { + let ip = parse_ip(value)?; + state.pairings.lock().await.remove(&ip); + Ok(()) +} + +pub async fn forget(state: &AndroidTvState, value: &str) -> Result<(), String> { + let ip = parse_ip(value)?; + state.pairings.lock().await.remove(&ip); + let remote = state.remotes.lock().await.remove(&ip); + if let Some(remote) = remote { + let _ = remote.close().await; + } + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::{key_code, parse_ip}; + + #[test] + fn maps_remote_keys_to_android_tv_keycodes() { + for (name, expected) in [ + ("Up", 19), + ("Down", 20), + ("Left", 21), + ("Right", 22), + ("Select", 23), + ("Back", 4), + ("Home", 3), + ("Search", 84), + ("ChannelUp", 92), + ("ChannelDown", 93), + ] { + assert_eq!(key_code(name).unwrap().raw(), expected, "{name}"); + } + assert!(key_code("Lit_a").is_err()); + } + + #[test] + fn accepts_only_ip_addresses_for_android_tv() { + assert!(parse_ip("192.168.1.20").is_ok()); + assert!(parse_ip("android-tv.local").is_err()); + } +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 2881f1d..9158b48 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,11 +1,75 @@ +mod android_tv; mod roku; use roku::{EcpError, ErrorKind, PowerOnReport, RokuApp, RokuDevice}; -use tauri::Manager; +use tauri::{Manager, State}; use tauri_plugin_opener::OpenerExt; type CmdResult = Result; +#[tauri::command] +async fn android_tv_start_pairing( + app: tauri::AppHandle, + state: State<'_, android_tv::AndroidTvState>, + ip: String, +) -> Result { + android_tv::start_pairing(&app, &state, &ip).await +} + +#[tauri::command] +async fn android_tv_finish_pairing( + app: tauri::AppHandle, + state: State<'_, android_tv::AndroidTvState>, + ip: String, + code: String, +) -> Result { + android_tv::finish_pairing(&app, &state, &ip, &code).await +} + +#[tauri::command] +async fn android_tv_connect( + app: tauri::AppHandle, + state: State<'_, android_tv::AndroidTvState>, + ip: String, +) -> Result { + android_tv::connect(&app, &state, &ip).await +} + +#[tauri::command] +async fn android_tv_keypress( + app: tauri::AppHandle, + state: State<'_, android_tv::AndroidTvState>, + ip: String, + key: String, +) -> Result<(), String> { + android_tv::keypress(&app, &state, &ip, &key).await +} + +#[tauri::command] +async fn android_tv_power_on( + app: tauri::AppHandle, + state: State<'_, android_tv::AndroidTvState>, + ip: String, +) -> Result<(), String> { + android_tv::power_on(&app, &state, &ip).await +} + +#[tauri::command] +async fn android_tv_cancel_pairing( + state: State<'_, android_tv::AndroidTvState>, + ip: String, +) -> Result<(), String> { + android_tv::cancel_pairing(&state, &ip).await +} + +#[tauri::command] +async fn android_tv_forget( + state: State<'_, android_tv::AndroidTvState>, + ip: String, +) -> Result<(), String> { + android_tv::forget(&state, &ip).await +} + #[tauri::command] async fn discover(deep: Option) -> Vec { roku::discover(deep.unwrap_or(false)).await @@ -85,7 +149,10 @@ fn is_allowed_link(url: &str) -> bool { #[tauri::command] fn open_link(app: tauri::AppHandle, url: String) -> CmdResult<()> { if !is_allowed_link(&url) { - return Err(EcpError::new(ErrorKind::Invalid, "That link isn't allowed.")); + return Err(EcpError::new( + ErrorKind::Invalid, + "That link isn't allowed.", + )); } app.opener() .open_url(url, None::<&str>) @@ -95,6 +162,7 @@ fn open_link(app: tauri::AppHandle, url: String) -> CmdResult<()> { #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() + .manage(android_tv::AndroidTvState::default()) .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_process::init()) .invoke_handler(tauri::generate_handler![ @@ -108,6 +176,13 @@ pub fn run() { send_text, power_on, lookup_mac, + android_tv_start_pairing, + android_tv_finish_pairing, + android_tv_connect, + android_tv_keypress, + android_tv_power_on, + android_tv_cancel_pairing, + android_tv_forget, open_link, ]) .on_window_event(|window, event| { @@ -118,7 +193,7 @@ pub fn run() { } }) .run(tauri::generate_context!()) - .expect("error while running Roku Control"); + .expect("error while running Open Remote Control"); } #[cfg(test)] diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index ad5fe83..69c3a72 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -2,5 +2,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] fn main() { - app_lib::run(); + app_lib::run(); } diff --git a/src-tauri/src/roku.rs b/src-tauri/src/roku.rs index 3e2b491..341a4b7 100644 --- a/src-tauri/src/roku.rs +++ b/src-tauri/src/roku.rs @@ -58,7 +58,10 @@ pub struct EcpError { impl EcpError { pub fn new(kind: ErrorKind, message: impl Into) -> Self { - Self { kind, message: message.into() } + Self { + kind, + message: message.into(), + } } fn invalid(message: impl Into) -> Self { Self::new(ErrorKind::Invalid, message) @@ -101,7 +104,10 @@ fn transport_error(host: &str, e: &reqwest::Error) -> EcpError { ), ) } else { - EcpError::new(ErrorKind::Other, format!("Network error talking to {host}: {e}")) + EcpError::new( + ErrorKind::Other, + format!("Network error talking to {host}: {e}"), + ) } } @@ -112,7 +118,9 @@ fn transport_error(host: &str, e: &reqwest::Error) -> EcpError { pub fn normalize_host(input: &str) -> Result { let mut s = input.trim(); for scheme in ["http://", "https://"] { - if s.get(..scheme.len()).is_some_and(|p| p.eq_ignore_ascii_case(scheme)) { + if s.get(..scheme.len()) + .is_some_and(|p| p.eq_ignore_ascii_case(scheme)) + { s = &s[scheme.len()..]; } } @@ -145,7 +153,9 @@ pub fn normalize_host(input: &str) -> Result { if valid_hostname { Ok(s.to_ascii_lowercase()) } else { - Err(EcpError::invalid(format!("\"{s}\" isn't an IP address or hostname."))) + Err(EcpError::invalid(format!( + "\"{s}\" isn't an IP address or hostname." + ))) } } @@ -153,11 +163,15 @@ pub fn normalize_host(input: &str) -> Result { pub fn validate_key(key: &str) -> Result<(), EcpError> { let ok = !key.is_empty() && key.len() <= 64 - && key.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '%'); + && key + .chars() + .all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '%'); if ok { Ok(()) } else { - Err(EcpError::invalid(format!("\"{key}\" isn't a Roku key name."))) + Err(EcpError::invalid(format!( + "\"{key}\" isn't a Roku key name." + ))) } } @@ -165,7 +179,9 @@ pub fn validate_key(key: &str) -> Result<(), EcpError> { pub fn validate_app_id(id: &str) -> Result<(), EcpError> { let ok = !id.is_empty() && id.len() <= 64 - && id.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '.' | '-')); + && id + .chars() + .all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '.' | '-')); if ok { Ok(()) } else { @@ -283,7 +299,9 @@ fn xml_text(xml: &str, tag: &str) -> String { xml.find(&open) .and_then(|start| { let inner = &xml[start + open.len()..]; - inner.find(&close).map(|end| unescape_xml(inner[..end].trim())) + inner + .find(&close) + .map(|end| unescape_xml(inner[..end].trim())) }) .unwrap_or_default() } @@ -367,7 +385,10 @@ pub fn parse_device_info(ip: &str, xml: &str) -> Option { } fn first_non_empty(candidates: [String; N]) -> String { - candidates.into_iter().find(|s| !s.is_empty()).unwrap_or_default() + candidates + .into_iter() + .find(|s| !s.is_empty()) + .unwrap_or_default() } pub async fn device_info(host: &str) -> Result { @@ -425,7 +446,10 @@ pub fn parse_apps(xml: &str) -> Vec { pub async fn apps(host: &str) -> Result, EcpError> { let xml = ecp_get_text(host, "query/apps").await?; - Ok(parse_apps(&xml).into_iter().filter(|a| !a.id.is_empty()).collect()) + Ok(parse_apps(&xml) + .into_iter() + .filter(|a| !a.id.is_empty()) + .collect()) } /// What's on screen now. `None` when the Roku is on its home screen. @@ -448,7 +472,10 @@ pub async fn app_icon(host: &str, app_id: &str) -> Result { .to_string(); let bytes = resp.bytes().await.map_err(|e| transport_error(host, &e))?; if bytes.is_empty() || bytes.len() > 1_000_000 { - return Err(EcpError::new(ErrorKind::Unsupported, "No icon for this app.")); + return Err(EcpError::new( + ErrorKind::Unsupported, + "No icon for this app.", + )); } let b64 = base64::engine::general_purpose::STANDARD.encode(&bytes); Ok(format!("data:{mime};base64,{b64}")) @@ -526,7 +553,10 @@ pub fn local_networks() -> Vec { .into_iter() .filter(|iface| !iface.is_loopback()) .filter_map(|iface| match iface.addr { - if_addrs::IfAddr::V4(v4) => Some(LocalNet { ip: v4.ip, netmask: v4.netmask }), + if_addrs::IfAddr::V4(v4) => Some(LocalNet { + ip: v4.ip, + netmask: v4.netmask, + }), _ => None, }) .filter(|n| !n.ip.is_loopback() && !n.ip.is_link_local() && !n.ip.is_unspecified()) @@ -616,7 +646,8 @@ async fn ssdp_search(nets: &[LocalNet], window: Duration) -> HashSet { let slice = deadline .saturating_duration_since(Instant::now()) .min(Duration::from_millis(150)); - if let Ok(Ok((n, src))) = tokio::time::timeout(slice, sock.recv_from(&mut buf)).await + if let Ok(Ok((n, src))) = + tokio::time::timeout(slice, sock.recv_from(&mut buf)).await { if let Some(host) = parse_ssdp_response(&buf[..n], src) { found.insert(host); @@ -698,7 +729,12 @@ pub async fn discover(deep: bool) -> Vec { } } } - devices.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()).then(a.ip.cmp(&b.ip))); + devices.sort_by(|a, b| { + a.name + .to_lowercase() + .cmp(&b.name.to_lowercase()) + .then(a.ip.cmp(&b.ip)) + }); devices } @@ -731,7 +767,10 @@ pub fn parse_mac(s: &str) -> Option<[u8; 6]> { } pub fn format_mac(mac: [u8; 6]) -> String { - mac.iter().map(|b| format!("{b:02x}")).collect::>().join(":") + mac.iter() + .map(|b| format!("{b:02x}")) + .collect::>() + .join(":") } pub fn magic_packet(mac: &[u8; 6]) -> [u8; 102] { @@ -749,7 +788,11 @@ async fn send_magic_packets(macs: &[[u8; 6]], host: &str, nets: &[LocalNet]) -> let _ = sock.set_broadcast(true); let mut targets: Vec = vec![Ipv4Addr::BROADCAST]; - targets.extend(nets.iter().filter(|n| n.ip.is_private()).map(LocalNet::broadcast)); + targets.extend( + nets.iter() + .filter(|n| n.ip.is_private()) + .map(LocalNet::broadcast), + ); if let Ok(ip) = host.parse::() { targets.push(ip); } @@ -793,7 +836,8 @@ fn arp_lookup_blocking(ip: Ipv4Addr) -> Option { { use std::os::windows::process::CommandExt; const CREATE_NO_WINDOW: u32 = 0x0800_0000; - cmd.creation_flags(CREATE_NO_WINDOW).args(["-a", &ip.to_string()]); + cmd.creation_flags(CREATE_NO_WINDOW) + .args(["-a", &ip.to_string()]); } #[cfg(not(windows))] cmd.args(["-n", &ip.to_string()]); @@ -870,7 +914,7 @@ pub async fn power_on(host: &str, macs: &[String]) -> Result = None; while Instant::now() < deadline { - if last_wol.map_or(true, |t| t.elapsed() >= Duration::from_secs(3)) { + if last_wol.is_none_or(|t| t.elapsed() >= Duration::from_secs(3)) { packets += send_magic_packets(&known, host, &nets).await; last_wol = Some(Instant::now()); } @@ -938,9 +982,15 @@ mod tests { #[test] fn device_name_falls_back_to_model_then_ip() { let xml = "RokuRoku Express"; - assert_eq!(parse_device_info("10.0.0.5", xml).unwrap().name, "Roku Express"); + assert_eq!( + parse_device_info("10.0.0.5", xml).unwrap().name, + "Roku Express" + ); let xml = "X1"; - assert_eq!(parse_device_info("10.0.0.5", xml).unwrap().name, "Roku at 10.0.0.5"); + assert_eq!( + parse_device_info("10.0.0.5", xml).unwrap().name, + "Roku at 10.0.0.5" + ); } #[test] @@ -959,7 +1009,15 @@ mod tests { "#; let apps = parse_apps(xml); assert_eq!(apps.len(), 4); - assert_eq!(apps[0], RokuApp { id: "tvinput.hdmi1".into(), name: "Xbox".into(), kind: "tvin".into(), version: "1.0.0".into() }); + assert_eq!( + apps[0], + RokuApp { + id: "tvinput.hdmi1".into(), + name: "Xbox".into(), + kind: "tvin".into(), + version: "1.0.0".into() + } + ); assert_eq!(apps[2].kind, "appl"); assert_eq!(apps[3].name, "Max & HBO"); } @@ -969,13 +1027,19 @@ mod tests { let home = "Roku"; assert!(parse_apps(home).into_iter().all(|a| a.id.is_empty())); let playing = r#"NetflixAquarium"#; - let first = parse_apps(playing).into_iter().find(|a| !a.id.is_empty()).unwrap(); + let first = parse_apps(playing) + .into_iter() + .find(|a| !a.id.is_empty()) + .unwrap(); assert_eq!(first.name, "Netflix"); } #[test] fn unescapes_entities() { - assert_eq!(unescape_xml("A & B <3 é😀 & done"), "A & B <3 é😀 & done"); + assert_eq!( + unescape_xml("A & B <3 é😀 & done"), + "A & B <3 é😀 & done" + ); assert_eq!(unescape_xml("no entities"), "no entities"); assert_eq!(unescape_xml("&bogus;"), "&bogus;"); } @@ -983,7 +1047,10 @@ mod tests { #[test] fn text_becomes_lit_keys() { assert_eq!(text_to_keys("Hi 5"), ["Lit_H", "Lit_i", "Lit_%20", "Lit_5"]); - assert_eq!(text_to_keys("a+b&c/?#"), ["Lit_a", "Lit_%2B", "Lit_b", "Lit_%26", "Lit_c", "Lit_%2F", "Lit_%3F", "Lit_%23"]); + assert_eq!( + text_to_keys("a+b&c/?#"), + ["Lit_a", "Lit_%2B", "Lit_b", "Lit_%26", "Lit_c", "Lit_%2F", "Lit_%3F", "Lit_%23"] + ); assert_eq!(text_to_keys("é"), ["Lit_%C3%A9"]); assert_eq!(text_to_keys("ok\r\n\t"), ["Lit_o", "Lit_k", "Enter"]); for key in text_to_keys("Crème brûlée — 100% 🎬") { @@ -994,9 +1061,27 @@ mod tests { #[test] fn normalizes_hosts() { assert_eq!(normalize_host(" 192.168.1.20 ").unwrap(), "192.168.1.20"); - assert_eq!(normalize_host("http://192.168.1.20:8060/query/device-info").unwrap(), "192.168.1.20"); - assert_eq!(normalize_host("HTTP://Roku-Den.local").unwrap(), "roku-den.local"); - for bad in ["", " ", "192.168.1.300", "0.0.0.0", "255.255.255.255", "evil com", "a b", "roku_den.local", "-bad.local", "http://", "é.local"] { + assert_eq!( + normalize_host("http://192.168.1.20:8060/query/device-info").unwrap(), + "192.168.1.20" + ); + assert_eq!( + normalize_host("HTTP://Roku-Den.local").unwrap(), + "roku-den.local" + ); + for bad in [ + "", + " ", + "192.168.1.300", + "0.0.0.0", + "255.255.255.255", + "evil com", + "a b", + "roku_den.local", + "-bad.local", + "http://", + "é.local", + ] { let err = normalize_host(bad).unwrap_err(); assert_eq!(err.kind, ErrorKind::Invalid, "{bad:?} should be rejected"); } @@ -1036,7 +1121,16 @@ mod tests { assert_eq!(parse_mac("A0-62-FB-02-1C-0E"), Some(want)); assert_eq!(parse_mac("a0:62:fb:2:1c:e"), Some(want)); assert_eq!(parse_mac("a062fb021c0e"), Some(want)); - for bad in ["", "00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff", "a0:62:fb:02:1c", "zz:62:fb:02:1c:0e", "0x1", "192.168.1.1", "a0:62:fb:02:1c:0e:11"] { + for bad in [ + "", + "00:00:00:00:00:00", + "ff:ff:ff:ff:ff:ff", + "a0:62:fb:02:1c", + "zz:62:fb:02:1c:0e", + "0x1", + "192.168.1.1", + "a0:62:fb:02:1c:0e:11", + ] { assert_eq!(parse_mac(bad), None, "{bad:?}"); } assert_eq!(format_mac(want), "a0:62:fb:02:1c:0e"); @@ -1058,7 +1152,10 @@ mod tests { let macos = "? (192.168.0.1) at 10:20:30:40:50:60 on en0 ifscope [ethernet]\n? (192.168.0.126) at a0:62:fb:9a:1c:be on en0 ifscope [ethernet]\n"; let linux = "IP address HW type Flags HW address Mask Device\n192.168.0.126 0x1 0x2 a0:62:fb:9a:1c:be * wlan0\n192.168.0.12 0x1 0x0 00:00:00:00:00:00 * wlan0\n"; for table in [windows, macos, linux] { - assert_eq!(parse_arp_output(table, ip).as_deref(), Some("a0:62:fb:9a:1c:be")); + assert_eq!( + parse_arp_output(table, ip).as_deref(), + Some("a0:62:fb:9a:1c:be") + ); } let incomplete: Ipv4Addr = "192.168.0.12".parse().unwrap(); assert_eq!(parse_arp_output(linux, incomplete), None); @@ -1068,28 +1165,51 @@ mod tests { #[test] fn scan_targets_cover_the_local_subnet_only() { - let net = |ip: &str, mask: &str| LocalNet { ip: ip.parse().unwrap(), netmask: mask.parse().unwrap() }; + let net = |ip: &str, mask: &str| LocalNet { + ip: ip.parse().unwrap(), + netmask: mask.parse().unwrap(), + }; let t = scan_targets(&[net("192.168.1.50", "255.255.255.0")]); assert_eq!(t.len(), 253); assert!(!t.contains(&"192.168.1.50".parse().unwrap())); - assert!(!t.contains(&"192.168.1.0".parse().unwrap()) && !t.contains(&"192.168.1.255".parse().unwrap())); + assert!( + !t.contains(&"192.168.1.0".parse().unwrap()) + && !t.contains(&"192.168.1.255".parse().unwrap()) + ); // A /16 is narrowed to our own /24. assert_eq!(scan_targets(&[net("10.0.4.9", "255.255.0.0")]).len(), 253); // A /22 is scanned whole. - assert_eq!(scan_targets(&[net("172.16.5.9", "255.255.252.0")]).len(), 1021); + assert_eq!( + scan_targets(&[net("172.16.5.9", "255.255.252.0")]).len(), + 1021 + ); // Public addresses and point-to-point links are never scanned. - assert!(scan_targets(&[net("8.8.8.8", "255.255.255.0"), net("192.168.9.1", "255.255.255.255")]).is_empty()); - assert_eq!(net("192.168.1.50", "255.255.255.0").broadcast(), "192.168.1.255".parse::().unwrap()); + assert!(scan_targets(&[ + net("8.8.8.8", "255.255.255.0"), + net("192.168.9.1", "255.255.255.255") + ]) + .is_empty()); + assert_eq!( + net("192.168.1.50", "255.255.255.0").broadcast(), + "192.168.1.255".parse::().unwrap() + ); } #[test] fn parses_ssdp_replies() { let src: SocketAddr = "192.168.1.77:1900".parse().unwrap(); let reply = b"HTTP/1.1 200 OK\r\nCache-Control: max-age=3600\r\nST: roku:ecp\r\nLOCATION: http://192.168.1.134:8060/\r\nUSN: uuid:roku:ecp:X01900ABCDEF\r\n\r\n"; - assert_eq!(parse_ssdp_response(reply, src).as_deref(), Some("192.168.1.134")); + assert_eq!( + parse_ssdp_response(reply, src).as_deref(), + Some("192.168.1.134") + ); let no_location = b"HTTP/1.1 200 OK\r\nST: roku:ecp\r\n\r\n"; - assert_eq!(parse_ssdp_response(no_location, src).as_deref(), Some("192.168.1.77")); - let not_roku = b"HTTP/1.1 200 OK\r\nST: upnp:rootdevice\r\nLOCATION: http://192.168.1.1:5000/\r\n\r\n"; + assert_eq!( + parse_ssdp_response(no_location, src).as_deref(), + Some("192.168.1.77") + ); + let not_roku = + b"HTTP/1.1 200 OK\r\nST: upnp:rootdevice\r\nLOCATION: http://192.168.1.1:5000/\r\n\r\n"; assert_eq!(parse_ssdp_response(not_roku, src), None); } @@ -1100,30 +1220,51 @@ mod tests { async fn discovers_on_this_network() { let start = std::time::Instant::now(); let nets = local_networks(); - println!("networks: {nets:?} ({} scan targets)", scan_targets(&nets).len()); + println!( + "networks: {nets:?} ({} scan targets)", + scan_targets(&nets).len() + ); let found = discover(false).await; - println!("{} Roku(s) in {:?}: {found:#?}", found.len(), start.elapsed()); - assert!(start.elapsed() < Duration::from_secs(20), "discovery must stay quick"); + println!( + "{} Roku(s) in {:?}: {found:#?}", + found.len(), + start.elapsed() + ); + assert!( + start.elapsed() < Duration::from_secs(20), + "discovery must stay quick" + ); } /// A tiny fake Roku on a loopback address, answering every request with /// the scripted status and body, and recording the request lines it saw. #[cfg(target_os = "linux")] - async fn fake_roku(ip: &str, routes: Vec<(&'static str, u16, &'static str)>) -> Arc>> { + async fn fake_roku( + ip: &str, + routes: Vec<(&'static str, u16, &'static str)>, + ) -> Arc>> { use tokio::io::{AsyncReadExt, AsyncWriteExt}; - let listener = tokio::net::TcpListener::bind((ip, ECP_PORT)).await.expect("bind fake roku"); + let listener = tokio::net::TcpListener::bind((ip, ECP_PORT)) + .await + .expect("bind fake roku"); let seen = Arc::new(std::sync::Mutex::new(Vec::new())); let log = seen.clone(); tokio::spawn(async move { loop { - let Ok((mut stream, _)) = listener.accept().await else { return }; + let Ok((mut stream, _)) = listener.accept().await else { + return; + }; let routes = routes.clone(); let log = log.clone(); tokio::spawn(async move { let mut buf = vec![0u8; 4096]; loop { - let Ok(n) = stream.read(&mut buf).await else { return }; - if n == 0 { return; } + let Ok(n) = stream.read(&mut buf).await else { + return; + }; + if n == 0 { + return; + } let req = String::from_utf8_lossy(&buf[..n]).to_string(); let line = req.lines().next().unwrap_or_default().to_string(); log.lock().unwrap().push(line.clone()); @@ -1132,8 +1273,13 @@ mod tests { .find(|(prefix, _, _)| line.contains(prefix)) .map(|(_, s, b)| (*s, *b)) .unwrap_or((404, "")); - let resp = format!("HTTP/1.1 {status} X\r\nContent-Length: {}\r\n\r\n{body}", body.len()); - if stream.write_all(resp.as_bytes()).await.is_err() { return; } + let resp = format!( + "HTTP/1.1 {status} X\r\nContent-Length: {}\r\n\r\n{body}", + body.len() + ); + if stream.write_all(resp.as_bytes()).await.is_err() { + return; + } } }); } @@ -1145,29 +1291,60 @@ mod tests { #[tokio::test] async fn talks_to_a_roku_and_reports_limited_mode() { let ip = "127.0.0.61"; - let seen = fake_roku(ip, vec![ - ("/query/device-info", 200, DEVICE_INFO), - ("/keypress/VolumeUp", 200, ""), - ("/keypress/Home", 403, "ECP command not allowed in limited mode."), - ("/keypress/Lit_", 200, ""), - ("/launch/12", 200, ""), - ]).await; + let seen = fake_roku( + ip, + vec![ + ("/query/device-info", 200, DEVICE_INFO), + ("/keypress/VolumeUp", 200, ""), + ( + "/keypress/Home", + 403, + "ECP command not allowed in limited mode.", + ), + ("/keypress/Lit_", 200, ""), + ("/launch/12", 200, ""), + ], + ) + .await; let dev = device_info(ip).await.unwrap(); assert_eq!(dev.name, "Living Room & Den"); keypress(ip, "VolumeUp").await.unwrap(); let err = keypress(ip, "Home").await.unwrap_err(); assert_eq!(err.kind, ErrorKind::Limited); - assert_eq!(keypress(ip, "InputHDMI9").await.unwrap_err().kind, ErrorKind::Unsupported); + assert_eq!( + keypress(ip, "InputHDMI9").await.unwrap_err().kind, + ErrorKind::Unsupported + ); send_text(ip, "a b").await.unwrap(); launch(ip, "12").await.unwrap(); let seen = seen.lock().unwrap().clone(); - assert!(seen.contains(&"POST /keypress/Lit_a HTTP/1.1".to_string()), "{seen:?}"); - assert!(seen.contains(&"POST /keypress/Lit_%20 HTTP/1.1".to_string()), "{seen:?}"); - assert!(seen.contains(&"POST /launch/12 HTTP/1.1".to_string()), "{seen:?}"); - let order: Vec<_> = seen.iter().filter(|l| l.contains("Lit_")).cloned().collect(); - assert_eq!(order, ["POST /keypress/Lit_a HTTP/1.1", "POST /keypress/Lit_%20 HTTP/1.1", "POST /keypress/Lit_b HTTP/1.1"]); + assert!( + seen.contains(&"POST /keypress/Lit_a HTTP/1.1".to_string()), + "{seen:?}" + ); + assert!( + seen.contains(&"POST /keypress/Lit_%20 HTTP/1.1".to_string()), + "{seen:?}" + ); + assert!( + seen.contains(&"POST /launch/12 HTTP/1.1".to_string()), + "{seen:?}" + ); + let order: Vec<_> = seen + .iter() + .filter(|l| l.contains("Lit_")) + .cloned() + .collect(); + assert_eq!( + order, + [ + "POST /keypress/Lit_a HTTP/1.1", + "POST /keypress/Lit_%20 HTTP/1.1", + "POST /keypress/Lit_b HTTP/1.1" + ] + ); } #[cfg(target_os = "linux")] @@ -1188,7 +1365,10 @@ mod tests { let report = power_on(ip, &[]).await.unwrap(); assert_eq!(report.method, "ecp"); assert_eq!(report.packets_sent, 0); - assert_eq!(seen.lock().unwrap().as_slice(), ["POST /keypress/PowerOn HTTP/1.1"]); + assert_eq!( + seen.lock().unwrap().as_slice(), + ["POST /keypress/PowerOn HTTP/1.1"] + ); } #[cfg(target_os = "linux")] @@ -1197,7 +1377,13 @@ mod tests { let ip = "127.0.0.63"; let seen = fake_roku(ip, vec![("/keypress/Home", 200, "")]).await; assert_eq!(power_on(ip, &[]).await.unwrap().method, "ecp"); - assert_eq!(seen.lock().unwrap().as_slice(), ["POST /keypress/PowerOn HTTP/1.1", "POST /keypress/Home HTTP/1.1"]); + assert_eq!( + seen.lock().unwrap().as_slice(), + [ + "POST /keypress/PowerOn HTTP/1.1", + "POST /keypress/Home HTTP/1.1" + ] + ); } #[cfg(target_os = "linux")] diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0146e6d..6d546cf 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", - "productName": "Roku Control", - "version": "2.1.0", + "productName": "Open Remote Control", + "version": "2.1.2", "identifier": "com.moveweight.roku-control", "build": { "frontendDist": "../dist", @@ -12,7 +12,7 @@ "app": { "windows": [ { - "title": "Roku Control", + "title": "Open Remote Control", "width": 480, "height": 820, "minWidth": 400, diff --git a/src/App.jsx b/src/App.jsx index 10770de..56e4363 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { getCurrentWindow } from '@tauri-apps/api/window'; import { LogicalSize } from '@tauri-apps/api/dpi'; import { useRoku } from './hooks/useRoku'; +import { useAndroidTv } from './hooks/useAndroidTv'; import { api, toError } from './lib/api'; import { load, save } from './lib/storage'; import { usage } from './lib/usage'; @@ -44,19 +45,43 @@ export default function App() { }, []); const roku = useRoku({ notify }); - const { selected: sel, status, press } = roku; + const android = useAndroidTv({ notify }); + const devices = [...roku.devices, ...android.devices]; + const [activeId, setActiveId] = useState(() => load('activeDevice', load('selected', null))); + const sel = devices.find((device) => device.id === activeId) ?? roku.selected ?? android.selected ?? null; + const isAndroidTv = sel?.platform === 'androidtv'; + const status = sel ? (isAndroidTv ? android.status : roku.status) : { state: roku.scanning ? 'scanning' : 'none' }; + const waking = isAndroidTv ? android.waking : roku.waking; + const scanning = roku.scanning; + const lastError = isAndroidTv ? android.lastError : roku.lastError; + + const selectDevice = useCallback((id) => { + setActiveId(id); + save('activeDevice', id); + const device = devices.find((item) => item.id === id); + if (device?.platform === 'androidtv') android.select(id); + else if (device) roku.select(id); + }, [devices, android.select, roku.select]); + + useEffect(() => { + if (!sel) return; + save('activeDevice', sel.id); + if (sel.platform === 'androidtv') android.select(sel.id); + else roku.select(sel.id); + }, [sel?.id, sel?.platform, android.select, roku.select]); + + const press = useCallback((key, options) => isAndroidTv ? android.press(key, options) : roku.press(key, options), [isAndroidTv, android.press, roku.press]); + const powerOn = useCallback(() => isAndroidTv ? android.powerOn() : roku.powerOn(), [isAndroidTv, android.powerOn, roku.powerOn]); + const check = useCallback(() => isAndroidTv ? android.check() : roku.check(), [isAndroidTv, android.check, roku.check]); const [dialog, setDialog] = useState(null); const dialogRef = useRef(dialog); dialogRef.current = dialog; const closeDialog = useCallback(() => setDialog(null), []); - // ── Mini remote: small, always on top ── const [compact, setCompact] = useState(() => load('compact', false)); useEffect(() => { if (compact) applyWindowMode(true); - // Only restore the saved mode on launch; toggling applies it directly. - // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const toggleCompact = () => { const next = !compact; @@ -65,12 +90,10 @@ export default function App() { applyWindowMode(next); }; - // ── Keyboard shortcuts ── const typingRef = useRef(null); const [flash, setFlash] = useState(null); const flashTimer = useRef(); const lastRepeat = useRef(0); - useEffect(() => { const onKey = (e) => { if (dialogRef.current || e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey) return; @@ -78,11 +101,13 @@ export default function App() { if (target?.closest('input, textarea, select, [contenteditable="true"]')) return; const item = SHORTCUTS.get(normalizeKey(e.key)); if (!item) return; - // A button reached with Tab keeps Enter/Space for itself. if ((e.key === 'Enter' || e.key === ' ') && target?.closest('button')) return; e.preventDefault(); if (item.action === 'help') return setDialog({ type: 'help', tab: 'keys' }); - if (item.action === 'type') return typingRef.current?.focus(); + if (item.action === 'type') { + if (!isAndroidTv) typingRef.current?.focus(); + return; + } if (e.repeat) { if (!REPEATABLE.has(item.roku) || performance.now() - lastRepeat.current < 110) return; lastRepeat.current = performance.now(); @@ -94,23 +119,20 @@ export default function App() { }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); - }, [press]); + }, [press, isAndroidTv]); - // ── Channels and what's playing ── const [apps, setApps] = useState([]); const [appsState, setAppsState] = useState({ loading: false, error: null }); const [activeAppId, setActiveAppId] = useState(null); - const selIdRef = useRef(sel?.id); selIdRef.current = sel?.id; const loadApps = useCallback(async () => { - if (!sel) return; + if (!sel || sel.platform === 'androidtv') return; const forId = sel.id; setAppsState({ loading: true, error: null }); try { const list = await api.apps(sel.ip); - // The user may have switched Rokus while this was loading. if (selIdRef.current !== forId) return; setApps(list); setAppsState({ loading: false, error: null }); @@ -122,8 +144,7 @@ export default function App() { error: err.kind === 'limited' ? 'Channels are hidden while the Roku is in Limited mode.' : err.message, }); } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [sel?.id, sel?.ip]); + }, [sel?.id, sel?.ip, sel?.platform]); useEffect(() => { setApps([]); @@ -133,34 +154,27 @@ export default function App() { const reachable = status.state === 'online' || status.state === 'standby'; useEffect(() => { - if (reachable && !apps.length) loadApps(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [reachable, sel?.id]); + if (reachable && sel?.platform !== 'androidtv' && !apps.length) loadApps(); + }, [reachable, sel?.id, sel?.platform, apps.length, loadApps]); - const selIp = sel?.ip; useEffect(() => { - if (!selIp || compact || status.state !== 'online') return undefined; + if (!sel?.ip || sel.platform === 'androidtv' || compact || status.state !== 'online') return undefined; let live = true; const poll = () => { if (document.visibilityState !== 'visible') return; - api.activeApp(selIp).then( - (a) => live && setActiveAppId(a?.id ?? null), - () => {}, - ); + api.activeApp(sel.ip).then((app) => live && setActiveAppId(app?.id ?? null), () => {}); }; poll(); const id = setInterval(poll, 10_000); - return () => { - live = false; - clearInterval(id); - }; - }, [selIp, compact, status.state]); + return () => { live = false; clearInterval(id); }; + }, [sel?.ip, sel?.platform, compact, status.state]); const launchApp = async (appId) => { + if (isAndroidTv) return false; if (await roku.launch(appId)) setActiveAppId(appId); + return true; }; - // ── One-time rating prompt after ten minutes of use ── useEffect(() => { let last = Date.now(); const id = setInterval(() => { @@ -175,21 +189,44 @@ export default function App() { return () => clearInterval(id); }, []); - // ── Feedback straight to GitHub ── - const reportProblem = () => openLink(issueUrl('bug', { device: sel, lastError: roku.lastError ?? status.error })); + const reportProblem = () => openLink(issueUrl('bug', { device: sel, lastError: lastError ?? status.error })); const suggestIdea = () => openLink(issueUrl('idea')); const rate = () => openLink(rateUrl()); const openHelp = (tab = 'fix') => setDialog({ type: 'help', tab }); + const addRoku = useCallback(async (ip) => { + const info = await roku.addByIp(ip); + const id = info.serial || info.deviceId || `ip:${info.ip}`; + selectDevice(id); + return info; + }, [roku.addByIp, selectDevice]); + + const finishAndroidPairing = useCallback(async (ip, code) => { + const device = await android.finishPairing(ip, code); + selectDevice(device.id); + return device; + }, [android.finishPairing, selectDevice]); + + const forgetDevice = useCallback((id) => { + const device = devices.find((item) => item.id === id); + if (device?.platform === 'androidtv') android.forget(id); + else roku.forget(id); + if (activeId === id) { + const next = devices.find((item) => item.id !== id); + setActiveId(next?.id ?? null); + if (next) save('activeDevice', next.id); + } + }, [devices, android.forget, roku.forget, activeId]); + return (
openHelp()} /> roku.discover()} onManage={() => setDialog({ type: 'devices' })} /> @@ -198,10 +235,10 @@ export default function App() { roku.discover()} onManage={() => setDialog({ type: 'devices' })} onHelp={() => openHelp()} @@ -212,16 +249,18 @@ export default function App() { press={press} launch={launchApp} flash={flash} - powerOn={roku.powerOn} - waking={roku.waking} + powerOn={powerOn} + waking={waking} inputs={apps.filter((a) => a.type === 'tvin')} compact={compact} /> {!compact && ( <> - - {sel && ( + {isAndroidTv + ?

Paired to Android TV / Google TV. Use the directional pad, Back, Home, playback and volume controls.

+ : } + {sel && !isAndroidTv && ( )} -

+ {!isAndroidTv &&

Tip: your keyboard is a remote too — arrows, Enter, Backspace, Space.{' '} - -

+ +

}