mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 22:45:41 +00:00
refactor(app_api): extract cli_bridge wrappers into own submodule
Lift the four cli_publish_* Tauri commands (player_snapshot, library_list, server_list, search_results) out of app_api/core.rs into app_api/cli_bridge.rs. Each is a thin pass-through to `crate::cli::write_*_response` — the renderer-side counterpart to the file-based IPC layer in cli/exchange.rs. This is the "cli-bridge" slice from cucadmuh's plan for splitting core.rs's mixed concerns. Together with the earlier perf split, core.rs is now down to runtime-control + platform + logging slices — one possible follow-up but each is small enough to leave as-is for now. app_api/core.rs: 122 → 99 LOC.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//! Tauri commands the frontend invokes to push player state and list payloads
|
||||
//! to the JSON response files that `psysonic --info` / `--player library list`
|
||||
//! / `--player server list` / `--player search …` then read.
|
||||
|
||||
/// Writes `psysonic-cli-snapshot.json` for `psysonic --info` (debounced from the frontend).
|
||||
#[tauri::command]
|
||||
pub(crate) fn cli_publish_player_snapshot(snapshot: serde_json::Value) -> Result<(), String> {
|
||||
crate::cli::write_cli_snapshot(&snapshot)
|
||||
}
|
||||
|
||||
/// Writes `psysonic-cli-library.json` for `psysonic --player library list`.
|
||||
#[tauri::command]
|
||||
pub(crate) fn cli_publish_library_list(payload: serde_json::Value) -> Result<(), String> {
|
||||
crate::cli::write_library_cli_response(&payload)
|
||||
}
|
||||
|
||||
/// Writes `psysonic-cli-servers.json` for `psysonic --player server list`.
|
||||
#[tauri::command]
|
||||
pub(crate) fn cli_publish_server_list(payload: serde_json::Value) -> Result<(), String> {
|
||||
crate::cli::write_server_list_cli_response(&payload)
|
||||
}
|
||||
|
||||
/// Writes `psysonic-cli-search.json` for `psysonic --player search …`.
|
||||
#[tauri::command]
|
||||
pub(crate) fn cli_publish_search_results(payload: serde_json::Value) -> Result<(), String> {
|
||||
crate::cli::write_search_cli_response(&payload)
|
||||
}
|
||||
@@ -11,30 +11,6 @@ pub(crate) fn exit_app(app_handle: tauri::AppHandle) {
|
||||
app_handle.exit(0);
|
||||
}
|
||||
|
||||
/// Writes `psysonic-cli-snapshot.json` for `psysonic --info` (debounced from the frontend).
|
||||
#[tauri::command]
|
||||
pub(crate) fn cli_publish_player_snapshot(snapshot: serde_json::Value) -> Result<(), String> {
|
||||
crate::cli::write_cli_snapshot(&snapshot)
|
||||
}
|
||||
|
||||
/// Writes `psysonic-cli-library.json` for `psysonic --player library list`.
|
||||
#[tauri::command]
|
||||
pub(crate) fn cli_publish_library_list(payload: serde_json::Value) -> Result<(), String> {
|
||||
crate::cli::write_library_cli_response(&payload)
|
||||
}
|
||||
|
||||
/// Writes `psysonic-cli-servers.json` for `psysonic --player server list`.
|
||||
#[tauri::command]
|
||||
pub(crate) fn cli_publish_server_list(payload: serde_json::Value) -> Result<(), String> {
|
||||
crate::cli::write_server_list_cli_response(&payload)
|
||||
}
|
||||
|
||||
/// Writes `psysonic-cli-search.json` for `psysonic --player search …`.
|
||||
#[tauri::command]
|
||||
pub(crate) fn cli_publish_search_results(payload: serde_json::Value) -> Result<(), String> {
|
||||
crate::cli::write_search_cli_response(&payload)
|
||||
}
|
||||
|
||||
/// Toggle native window decorations at runtime (Linux custom title bar opt-out).
|
||||
#[tauri::command]
|
||||
pub(crate) fn set_window_decorations(enabled: bool, app_handle: tauri::AppHandle) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
mod cli_bridge;
|
||||
mod core;
|
||||
mod navidrome;
|
||||
mod perf;
|
||||
@@ -7,6 +8,7 @@ mod remote;
|
||||
mod integration;
|
||||
mod analysis;
|
||||
|
||||
pub(crate) use cli_bridge::*;
|
||||
pub(crate) use core::*;
|
||||
pub(crate) use navidrome::*;
|
||||
pub(crate) use perf::*;
|
||||
|
||||
Reference in New Issue
Block a user