mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 14:35:41 +00:00
refactor(lib_commands): drop super::* + glob in app_api + lib_commands root
Hotspot G final slice — replace cascade-imports in app_api/{core,
analysis,integration,remote,platform}.rs with explicit per-symbol
imports, and convert app_api/mod.rs from broad `pub(crate) use foo::*`
to a per-command list of every Tauri handler.
The remaining glob re-exports live only in lib_commands/mod.rs itself
— and those are deliberate: they flatten the explicitly-listed Tauri
commands one more level so lib.rs's `use lib_commands::*` keeps the
invoke_handler shape unchanged. Each level above is now explicit.
file_transfer.rs's `super::subsonic_wire_user_agent()` becomes
`crate::subsonic_wire_user_agent()` since the lib_commands cascade
no longer pulls lib.rs symbols into super scope.
`grep -rn 'use super::\*' src/lib_commands/` returns zero hits.
Behaviour-preserving.
This commit is contained in:
@@ -1,6 +1,14 @@
|
|||||||
use super::*;
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use tauri::Manager;
|
||||||
|
|
||||||
|
use crate::analysis_cache;
|
||||||
|
use crate::analysis_runtime::{
|
||||||
|
analysis_backfill_is_current_track, analysis_backfill_shared, prune_analysis_queues,
|
||||||
|
AnalysisBackfillEnqueueKind,
|
||||||
|
};
|
||||||
|
use crate::{LoudnessCachePayload, WaveformCachePayload};
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub(crate) fn analysis_get_waveform(
|
pub(crate) fn analysis_get_waveform(
|
||||||
track_id: String,
|
track_id: String,
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
use super::*;
|
use tauri::Manager;
|
||||||
|
|
||||||
|
use crate::lib_commands::sync::stop_audio_engine;
|
||||||
|
use crate::runtime_subsonic_wire_user_agent;
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub(crate) fn greet(name: &str) -> String {
|
pub(crate) fn greet(name: &str) -> String {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
use super::*;
|
use tauri::Emitter;
|
||||||
|
|
||||||
|
use crate::{MprisControls, ShortcutMap};
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub(crate) fn register_global_shortcut(
|
pub(crate) fn register_global_shortcut(
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use super::*;
|
|
||||||
|
|
||||||
mod cli_bridge;
|
mod cli_bridge;
|
||||||
mod core;
|
mod core;
|
||||||
mod navidrome;
|
mod navidrome;
|
||||||
@@ -9,11 +7,34 @@ mod remote;
|
|||||||
mod integration;
|
mod integration;
|
||||||
mod analysis;
|
mod analysis;
|
||||||
|
|
||||||
pub(crate) use cli_bridge::*;
|
// Tauri commands re-exported for the lib.rs invoke_handler.
|
||||||
pub(crate) use core::*;
|
pub(crate) use cli_bridge::{
|
||||||
pub(crate) use navidrome::*;
|
cli_publish_library_list, cli_publish_player_snapshot, cli_publish_search_results,
|
||||||
pub(crate) use perf::*;
|
cli_publish_server_list,
|
||||||
pub(crate) use platform::*;
|
};
|
||||||
pub(crate) use remote::*;
|
pub(crate) use core::{
|
||||||
pub(crate) use integration::*;
|
exit_app, export_runtime_logs, frontend_debug_log, greet, set_logging_mode,
|
||||||
pub(crate) use analysis::*;
|
set_subsonic_wire_user_agent,
|
||||||
|
};
|
||||||
|
pub(crate) use navidrome::{
|
||||||
|
delete_radio_cover, navidrome_login, nd_create_playlist, nd_create_user, nd_delete_playlist,
|
||||||
|
nd_delete_user, nd_get_playlist, nd_get_song_path, nd_list_albums_by_artist_role,
|
||||||
|
nd_list_artists_by_role, nd_list_libraries, nd_list_playlists, nd_list_songs, nd_list_users,
|
||||||
|
nd_set_user_libraries, nd_update_playlist, nd_update_user, upload_artist_image,
|
||||||
|
upload_playlist_cover, upload_radio_cover,
|
||||||
|
};
|
||||||
|
pub(crate) use perf::performance_cpu_snapshot;
|
||||||
|
pub(crate) use platform::{set_linux_webkit_smooth_scrolling, set_window_decorations};
|
||||||
|
pub(crate) use remote::{
|
||||||
|
fetch_icy_metadata, fetch_json_url, fetch_url_bytes, get_top_radio_stations, lastfm_request,
|
||||||
|
resolve_stream_url, search_radio_browser,
|
||||||
|
};
|
||||||
|
pub(crate) use integration::{
|
||||||
|
check_dir_accessible, mpris_set_metadata, mpris_set_playback, register_global_shortcut,
|
||||||
|
unregister_global_shortcut,
|
||||||
|
};
|
||||||
|
pub(crate) use analysis::{
|
||||||
|
analysis_delete_all_waveforms, analysis_delete_loudness_for_track,
|
||||||
|
analysis_enqueue_seed_from_url, analysis_get_loudness_for_track, analysis_get_waveform,
|
||||||
|
analysis_get_waveform_for_track, analysis_prune_pending_to_track_ids,
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Native-window + WebKitGTK platform tweaks exposed as Tauri commands.
|
//! Native-window + WebKitGTK platform tweaks exposed as Tauri commands.
|
||||||
|
|
||||||
use super::*;
|
use tauri::Manager;
|
||||||
|
|
||||||
/// Toggle native window decorations at runtime (Linux custom title bar opt-out).
|
/// Toggle native window decorations at runtime (Linux custom title bar opt-out).
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use super::*;
|
use crate::subsonic_wire_user_agent;
|
||||||
|
|
||||||
pub(crate) const RADIO_PAGE_SIZE: u32 = 25;
|
pub(crate) const RADIO_PAGE_SIZE: u32 = 25;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use std::time::Duration;
|
|||||||
/// downloads with progress events), build the client inline.
|
/// downloads with progress events), build the client inline.
|
||||||
pub(crate) fn subsonic_http_client(timeout: Duration) -> Result<reqwest::Client, String> {
|
pub(crate) fn subsonic_http_client(timeout: Duration) -> Result<reqwest::Client, String> {
|
||||||
reqwest::Client::builder()
|
reqwest::Client::builder()
|
||||||
.user_agent(super::subsonic_wire_user_agent())
|
.user_agent(crate::subsonic_wire_user_agent())
|
||||||
.timeout(timeout)
|
.timeout(timeout)
|
||||||
.build()
|
.build()
|
||||||
.map_err(|e| e.to_string())
|
.map_err(|e| e.to_string())
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
use super::*;
|
pub(crate) mod app_api;
|
||||||
|
pub(crate) mod cache;
|
||||||
mod app_api;
|
pub(crate) mod file_transfer;
|
||||||
mod cache;
|
pub(crate) mod sync;
|
||||||
mod file_transfer;
|
pub(crate) mod ui;
|
||||||
mod sync;
|
|
||||||
mod ui;
|
|
||||||
|
|
||||||
|
// Each subdirectory re-exports its Tauri commands explicitly. Flatten one
|
||||||
|
// more level here so `lib.rs`'s `use lib_commands::*;` lands every
|
||||||
|
// invoke-handler-registered name at lib.rs scope.
|
||||||
pub(crate) use app_api::*;
|
pub(crate) use app_api::*;
|
||||||
pub(crate) use cache::*;
|
pub(crate) use cache::*;
|
||||||
pub(crate) use sync::*;
|
pub(crate) use sync::*;
|
||||||
|
|||||||
Reference in New Issue
Block a user