Skip to content

feat(webui): add engine routes for Saves/Screenshots/Videos/Processes/Power/Users/SMP#186

Open
Twice6804 wants to merge 1 commit into
phantomptr:mainfrom
Twice6804:feat/web-ui-phase2
Open

feat(webui): add engine routes for Saves/Screenshots/Videos/Processes/Power/Users/SMP#186
Twice6804 wants to merge 1 commit into
phantomptr:mainfrom
Twice6804:feat/web-ui-phase2

Conversation

@Twice6804

Copy link
Copy Markdown
Contributor

Description

Phase 2 of browser-accessible ps5upload (#151, follow-up to #171): thin
axum handlers for the PS5-side screens whose Tauri commands previously
called ps5upload-core in-process with no HTTP equivalent, so the
browser web UI can drive Saves, Screenshots, Videos, Processes, Power
control/telemetry, and the SMP panel too.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring

Changes Made

  • engine/crates/ps5upload-engine/src/lib.rs: 9 new routes, each a direct spawn_blocking wrapper over an existing ps5upload-core function, following the exact pattern used by every other handler in the file:
    • GET /api/ps5/saves/list, GET /api/ps5/screenshots/list, GET /api/ps5/videos/list
    • GET /api/ps5/process/list, POST /api/ps5/process/kill
    • POST /api/ps5/power/control, GET /api/ps5/power/telemetry
    • GET /api/ps5/users/list
    • GET /api/ps5/smp/status
  • engine/crates/ps5upload-core/src/smp.rs (new): moved the ShadowMount+ status-snapshot logic out of the Tauri shell into core, so both the desktop command and the new engine route share one implementation instead of drifting into two copies. client/src-tauri/src/commands/smp.rs is now a 3-line delegation to ps5upload_core::smp::collect_status.
  • client/src/lib/browserInvoke.ts: matching cases for saves_list, screenshots_list, videos_list, process_list_get, process_kill_pid, power_reboot/power_shutdown/power_standby/power_tick, power_telemetry_get, user_list_get, smp_status.

Note: /api/ps5/process/list (process_mgr's detailed pid/name/title_id/memory/kind view with kill support) is intentionally distinct from the existing /api/ps5/proc/list (hw's lightweight PROC_LIST snapshot) — different core function, different struct shape.

Documentation Updates

Did you update the documentation? [ ] Yes [x] No

If no documentation updates: same reasoning as #171 — the self-hosted README section covering Dockerfile.webui + PS5UPLOAD_ALLOW_IP is planned once capability gating (hiding native-only affordances like local file pickers/save-to-USB in the browser) lands, so the docs describe one complete browser experience rather than piecemeal per-PR notes.

Testing

  • npm run validate equivalent: typecheck, lint, full Vitest suite (72 files / 782 tests) — all green.
  • npm run coverage
  • Built PS5 payload successfully
  • Cross-platform CI target checks passed
  • Tested on real PS5 hardware
  • Tested desktop app
  • Verified all example commands in docs work — installed a working Rust toolchain (system rustc was too old for this dependency tree, same issue noted in feat(webui): serve the full React client from the engine over HTTP #171), ran cargo build/cargo build --features webui/cargo test --workspace/cargo fmt --check/cargo clippy (all clean), then started the engine locally and curled all 9 new routes: confirmed correct request parsing, 502 on unreachable PS5, 422 on a missing required field, 400 on an invalid power action, and that SMP status never hard-fails (per-probe errors land in the errors[] array as designed).
  • Tested edge cases and error handling — confirmed the moved SMP tests (6 unit tests) still pass under ps5upload-core, and that /api/ps5/process/list doesn't collide with the pre-existing /api/ps5/proc/list.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation to reflect my changes
  • My changes generate no new warnings
  • I have tested my changes on PS5 hardware (or simulated environment)
  • All example code in documentation has been tested and works

Additional Notes

Couldn't compile the Tauri desktop shell locally (missing system GTK/WebKit dev libraries, no sudo access in this environment) to verify client/src-tauri/src/commands/smp.rs directly — it's a 3-line delegation matching the exact error-conversion pattern used by every sibling command in the same file (saves_screenshots.rs, process_mgr.rs, system_power.rs), and the underlying ps5upload_core::smp::collect_status it calls is fully compiled and tested via the engine crate.

Remaining before the browser web UI is "complete": capability gating (hide host-filesystem-only features — local pickers, save-to-USB archive zip/unzip, payload send from a local file — when !isTauriEnv()) and the README self-hosted docs section.

🤖 Generated with Claude Code

…/Power/Users/SMP

Phase 2 of browser-accessible ps5upload: thin axum handlers for the
PS5-side screens whose Tauri commands previously called
ps5upload-core in-process with no HTTP equivalent. Each new route is
a direct spawn_blocking wrapper over the existing core function,
mirroring the pattern already used by every other GET/POST handler
in the engine.

- GET  /api/ps5/saves/list, /api/ps5/screenshots/list, /api/ps5/videos/list
- GET  /api/ps5/process/list, POST /api/ps5/process/kill
- POST /api/ps5/power/control, GET /api/ps5/power/telemetry
- GET  /api/ps5/users/list
- GET  /api/ps5/smp/status

The ShadowMount+ status snapshot logic (previously Tauri-crate-local)
moved to ps5upload-core::smp so both the desktop command and the new
engine route share one implementation instead of two copies drifting
apart; the Tauri command is now a 3-line delegation.

browserInvoke.ts gained matching cases for saves_list, screenshots_list,
videos_list, process_list_get, process_kill_pid, power_reboot/shutdown/
standby/tick, power_telemetry_get, user_list_get, and smp_status.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant