41 Commits
Author SHA1 Message Date
najdek 0bf2b5e78b reduce log spam from frontend polling
- Muted logs for automatically polled endpoints (`/list_payloads`, etc.)
- Added explicit log line for process kill requests to keep track of terminated PIDs
2026-06-04 02:46:47 +02:00
najdek 293f44b4ef feat(StorageHub): unify repository UI, add alphabetical sorting and payload update dates
- Refactored `StorageHub.jsx` to share a unified `enrichedSources` data flow between single-source and multi-source modes, eliminating duplicated rendering logic
- Payloads are now sorted alphabetically by name across all repository views (with available updates automatically pinned to the top)
- Updated `PayloadName` component to accept a `lastUpdate` prop, natively rendering the payload version and update date side-by-side
- Conditionally hide accordion headers and restore discrete grid-card styling for legacy single-source mode, preserving the original look while utilizing the normalized codebase
- Fixed a backend bug in `src/sources.c` where the `last_update` field was incorrectly omitted from the serialized JSON array during multi-source repository fetches
2026-06-04 02:37:40 +02:00
najdek 7a001e4579 reduce sleep duration during disc player suspension process 2026-06-03 21:57:11 +02:00
najdek 2a12e84283 fix: restore overwrite confirmation prompt for payload uploads
During the recent storage refactoring, `payload_mgr_check_existing` was updated to return a simplified `{"exists": true}` structure. However, the frontend (`App.jsx`) still relied on the `file_exists` and `folder_exists` boolean flags to display the overwrite confirmation modal when a duplicate payload is uploaded. Because those fields were missing, the frontend silently fell through and overwrote the files without asking.

This change restores the original JSON output format for the `/manage:check` endpoint (`file_exists`, `folder_exists`, and `folder_name`), ensuring the overwrite prompt appears again when an uploaded ELF already exists.
2026-06-03 19:37:56 +02:00
najdek 55ec5c1d00 fix: correct payload list JSON structure and remove duplicate scanning
- Revert `payload_mgr_list_json` to output an array of string paths
  for `"payloads"` rather than an array of objects, as expected by
  the React frontend.
- Move payload metadata extraction back to a separate `"meta"` object
  indexed by filename.
- Remove the redundant explicit recursive scan of `PAYLOADS_STORAGE_DIR`.
  Because the directory is `/data/pldmgr/payloads`, it is already
  covered by the recursive scan of `SCAN_DIRS[0]` (`/data/pldmgr`),
  which was causing all internal payloads to appear twice in the list.
2026-06-03 18:33:08 +02:00
najdek 2189ee962d refactor: decompose main.c and payload_mgr.c into focused modules
Split two monolithic files (main.c 1538→233 lines, payload_mgr.c
2355→467 lines) into 8 single-responsibility modules:

- http_server.c: MHD request router and all route handlers
- repository.c: repo cache, download, install/commit, self-update
- sources.c: multi-source repository management
- config.c: PldmgrConfig struct, read/write, JSON config handler
- log_server.c: ring buffer, SSE streaming, pldmgr_log()
- json_helpers.c: JsonListBuilder, JSON parser, file I/O utilities
- sha256.c: SHA256 hash implementation
- process_mgr.c: process listing and kill

Introduces PldmgrConfig struct to replace the 8-out-param
read_next_config_values() pattern. Renames extracted functions to
match their new modules (e.g. repository_install_download,
sources_add, process_kill). No HTTP route changes — frontend
is unaffected.
2026-06-03 18:22:26 +02:00
najdek 631e7de0c6 feat: add active processes management tab
Introduces a new "Active Processes" feature that enables users to view and
manage background processes running on the PS5.

Backend:
- Add `payload_mgr_process_list_json` using `sysctl` with `KERN_PROC_PROC`
  to fetch the kernel process list and memory footprints.
- Retrieve `appinfo` via `sceKernelGetAppInfo` to filter for user-spawned
  daemons (requires appid == `0000`).
- Implement `payload_mgr_process_kill` utilizing `SIGKILL`.
- Expose `/processes_list` and `/process_kill` endpoints.

Frontend:
- Add `ActiveProcessesView.jsx` with a real-time table of running processes.
- Implement background auto-refresh every 15s to maintain the UI state.
- Add safety nets to completely disable killing critical processes
  (`pldmgr.elf` and `elfldr.elf`).
- Implement kill confirmation modal to avoid accidental terminations.
- Integrate "Active Processes" tab with the sidebar and mobile bottom navigation.
2026-06-03 17:58:04 +02:00
najdek 93b1281c59 remove legacy repository fallback logic for payload badges and update comments 2026-06-03 00:11:17 +02:00
najdek f4c76fbfb4 feat: add multi-source payload repository support
- Add MULTI_SOURCES_ENABLED config flag with toggle in Settings
- New "Manage Sources" view: add/remove/reorder third-party payload sources
  via URL; default source is locked and non-removable
- Source JSON format: top-level `name` field sets display name; falls back
  to hostname extraction if absent; checksums are optional
- PS5 mode shows QR code + URL for Manage Sources; desktop shows full list UI
- Source removal uses shared confirm modal; reorder auto-saves with toast
- Backend (payload_mgr.c):
  - CRUD for sources list persisted to /data/pldmgr/sources.json
  - Multi-source repository list/install routes; each source has its
    own independent payload catalog
  - Bounded name parsing: only searches before "payloads" key to avoid
    capturing payload item names; domain fallback when name absent
  - list_payloads response now includes `meta` map: walks
    PAYLOADS_STORAGE_DIR subdirectories for .elf/.bin/.lua sidecar
    files and emits source_name per payload
  - Fallback for pre-feature sidecars: extracts hostname from
    install_source_detail, skipping the official repository URL
- Frontend: source badge (Globe icon + name) shown in bottom-right corner
  of each payload card on Dashboard and Management tab when
  MULTI_SOURCES_ENABLED is on and payload has a non-default source
- StorageHub: accordion-style per-source catalogs when multi-source enabled
- showConfirm helper in App.jsx auto-closes modal before executing callback
2026-06-02 21:59:35 +02:00
najdek 0380757957 backend: remove payload scanning logs 2026-06-02 00:36:10 +02:00
najdek 5ff5295120 fix: clean up empty directory after payload deletion
fixes issue #24
2026-06-01 22:57:44 +02:00
najdek bfc4d096c5 Fix loading payloads from USB root
- Allow /mnt/usb paths in is_allowed_payload_path
- Expose pldmgr_read_config_bool globally

Closes #18
2026-05-28 13:03:29 +02:00
najdek 6772ae3a4e Merge branches 'pr-12', 'pr-13', 'pr-15' and 'pr-17' 2026-05-28 00:13:55 +02:00
owendswang a34ecffa22 Replace existing daemon instance on startup 2026-05-28 02:49:09 +08:00
owendswang 38b112496e Report payload launch failures 2026-05-28 02:48:01 +08:00
owendswang 73d31753d6 Limit USB root payload scan to root directory 2026-05-28 01:38:04 +08:00
najdek c8c380b4f1 feat: add favicon and app icons
- Update favicon to match the LogoIcon.
- Serve icons from the native C web server.
- Ignore generated asset headers in .gitignore.
2026-05-27 00:12:22 +02:00
najdek 90cd196f5b fix: resolve autoload synchronization, rendering, and layout issues 2026-05-02 13:40:08 +02:00
najdek 3efc4f4565 Fix frontend caching & self-update logic 2026-04-30 23:42:40 +02:00
najdek 0d1c0078ea refactor: implement precision millisecond tracking for autoload countdown and lock execution from abort calls 2026-04-30 01:31:01 +02:00
najdek b007ceaf5b fix: prevent endless loop in self-update by enforcing greater version check 2026-04-30 00:54:12 +02:00
najdek 0bfb763eab add offline cache page 2026-04-29 19:38:26 +02:00
najdek 45738a7e43 feat: implement automatic self-update for payload manager
- Embeds version signature dynamically into ELF
- Scans 'pldmgr' or 'payload-manager' ELFs for version on startup
- Auto-launches updated ELF without infinite loops
- Hides payload manager from UI lists to prevent accidental deletion
2026-04-29 02:33:55 +02:00
najdek 3282e14305 Feat: Migrate payload downloads from frontend to backend using libcurl
- Shift payload downloading from browser-side fetching to the backend C daemon
- Add OpenSSL and libcurl dependencies to the Docker SDK build environment
- Embed CA certificate bundle for secure HTTPS downloads
- Introduce the /repository_install endpoint in the internal API
2026-04-28 23:32:38 +02:00
najdek 840ab2293c rename project to Payload Manager 2026-04-28 20:45:38 +02:00
najdek 4c9697800e security: harden HTTP server against path traversal and thread safety issues
Address code review findings:
- Validate USB paths (restrict to /mnt/usbN/, block .., require .elf/.bin)
- Sanitize /loadpayload route (resolve via known scan dirs only)
- Add filename validation to /manage:check endpoint
- Fix autoload config OOB write (swap fgets/line_count check order)
- Escape JSON strings in /log and /get_config responses
- Move json_escape to utils.c as nm_json_escape for reuse
- Replace global response_buffer with per-request malloc + MUST_FREE
- Add alloc_response_buffer helper to deduplicate OOM handling
- Fix overwrite flag being ignored in USB move
- Handle truncated repository JSON with proper error status
- Centralize CORS headers via add_cors_headers helper
- Fix dangling pointer in loadpayload resolved_path scope
2026-04-28 13:19:48 +02:00
najdek bc9451fb52 Add automatic app launcher installer for Next Menu 2026-04-28 01:23:05 +02:00
najdek 47d4b2e9ea feat: unified payload storage structure and installation source tracking
- Implemented folder-based storage (/payloads/<clean_name>/) for all methods
- Added install_source and install_source_detail metadata to tracking JSON
- Synchronized naming logic between frontend and backend to handle platform suffixes (-ps5/-ps4)
- Added overwrite confirmation prompts for web uploads, USB moves, and repository updates
- Updated repository installer to track source URLs dynamically
2026-04-23 00:11:15 +02:00
najdek c90e3cc316 feat: add USB payload scanning option and UI improvements
- added SCAN_USB_PAYLOADS setting
- implemented recursive USB root scanning (depth limit 1)
- skip hidden files/directories starting with a dot
- display full path for USB payloads in dashboard
- sort USB payloads to the bottom of the list
2026-04-22 22:38:21 +02:00
najdek edce49e8bb refactor: integrate logging into notification system and refine kill logic
- Update nm_notify to automatically log messages via nm_log.
- Clean up redundant logging in ps5_launcher.c.
- Improve feedback during Disc Player termination sequence.
- Reorganize headers and format main.c.
2026-04-22 19:35:26 +02:00
najdek 73c0c8e0e1 feat: add configurable disc player termination on startup
- Implement automatic termination of the 'Disc Player' app (BD-JB host) when the menu starts.
- Add toggle in System Settings to enable/disable this feature.
- Credits to BenNoxXD for the original termination logic:
  Source: https://github.com/BenNoxXD/PS5-BDJ-HEN-loader/blob/main/HENloader_C_part/src/kill_disc_player.c
2026-04-22 00:22:33 +02:00
najdek 505d90a07b feat: finalize PS5 menu UI and autoload synchronization
- Frontend: Fixed autoload progress circle scaling for variable delays.
- Frontend: Implemented robust CSS spinner for PS5 WebKit compatibility.
- Frontend: Redesigned Remote Management footer and fixed IP address display.
- Backend: Updated /autoload_status API to include configured delay.
- Backend: Integrated system statistics (CPU/RAM/Storage) monitoring.
- Daemon: Suppressed redundant startup notifications when auto-browser is enabled.
- Build: Automated dynamic page title injection and UTC build timestamps.
2026-04-21 02:04:04 +02:00
najdek b8b83e8cc7 feat: implement backend repository management and SHA256 verification
- Implement repository JSON caching and metadata management in payload_mgr.c
- Add native SHA256 implementation and integrity verification for payload installs
- Introduce POST /repository_push and /repository_install_push endpoints for browser-delegated downloads
- Synchronize autoload.txt entries automatically during payload updates and deletions
- Add frontend auto-refresh on tab switch to sync with backend configuration changes
- Update mock-server.js and fix deploy.sh timeout for more reliable development
2026-04-20 20:09:45 +02:00
najdek 38b10d40c3 feat: replace polling log mechanism with server-sent events (SSE) for real-time updates 2026-04-19 22:59:01 +02:00
najdek 64a5df3bd2 feat: overhaul autoload UX and cloud repository management
- Implement fixed-height stable header in Autoload overlay with progress circle
- Add autoscrolling checklist for long payload sequences (15+ items)
- Refactor Cloud Repository to use deferred loading with loading/error states
- Improve update detection by stripping version tags from filenames
- Transition backend to config-based persistence (next_config.txt)
- Fix Rules of Hooks violation and frontend build syntax errors
2026-04-19 22:52:00 +02:00
najdek e99812224b feat: improve daemon stability with system service registration and sleep/resume recovery 2026-04-19 19:18:29 +02:00
najdek ac4e2ca04b feat: polish native autoload sequence with progress tracking, abort support, and UI checklist 2026-04-19 17:32:17 +02:00
najdek 0f1ed6e9a1 feat: implement native PS5 autoload system with custom delays and abort support 2026-04-19 15:42:32 +02:00
najdek 574871d34d feat: add native notifications, real IP resolution, and automated deployment
- Implemented native PS5 on-screen debug notifications via sceKernelSendNotificationRequest.
- Added robust local IP resolution using getifaddrs to replace placeholder IP.
- Migrated server port from 50005 to 8084 across the entire stack.
- Added a startup notification on the PS5 screen displaying version, IP, and port.
- Created deploy.sh script for fully automated build and deployment:
    - Automatically requests shutdown of previous instance.
    - Rebuilds both React frontend and native ELF.
    - Performs unidirectional ELF transfer via socat and exits immediately.
- Updated Makefile and README with new deployment workflow.
2026-04-19 15:27:27 +02:00
najdek 62fcb3fbce feat: implement native logging and remove keepalive spam
- Implemented a circular log buffer (100 lines) in the native core.
- Added /log endpoint to expose backend logs to the frontend.
- Added /version, /getip, and /get_config endpoints for UI parity.
- Replaced printf with nm_log to capture all system messages.
- Filtered out spammy GET requests from the log buffer.
- Removed legacy /keepalive interval from the frontend.
2026-04-19 15:03:49 +02:00
najdek 989ce764eb initial commit 2026-04-19 14:48:42 +02:00