MCPcopy Create free account
hub / github.com/Moosync/Moosync / run

Function run

src-tauri/src/lib.rs:123–433  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121#[tracing::instrument(level = "debug", skip())]
122#[cfg_attr(mobile, tauri::mobile_entry_point)]
123pub fn run() {
124 rustls::crypto::ring::default_provider()
125 .install_default()
126 .expect("Failed to install rustls crypto provider");
127
128 let filter = if cfg!(mobile) {
129 EnvFilter::try_new("debug").unwrap()
130 } else {
131 EnvFilter::from_env("MOOSYNC_LOG")
132 };
133
134 #[cfg(desktop)]
135 let args = Args::parse();
136
137 let mut builder = tauri::Builder::default();
138
139 #[cfg(desktop)]
140 {
141 // #[cfg(debug_assertions)]
142 // {
143 // builder = tauri::Builder::default().plugin(tauri_plugin_devtools::init());
144 // }
145
146 builder = builder
147 .plugin(tauri_plugin_updater::Builder::new().build())
148 .plugin(tauri_plugin_single_instance::init(|app, argv, _cwd| {
149 if let Some(url) = argv.get(1) {
150 tracing::info!("Got url {}", url);
151 let state: State<OAuthHandler> = app.state();
152 state.handle_oauth(app.clone(), url.to_string()).unwrap();
153 }
154 }))
155 .plugin(tauri_plugin_dialog::init())
156 .plugin(tauri_plugin_autostart::init(
157 tauri_plugin_autostart::MacosLauncher::LaunchAgent,
158 None,
159 ))
160 .on_window_event(|window, event| {
161 if let tauri::WindowEvent::CloseRequested { api, .. } = event {
162 if let Ok(should_close) = handle_window_close(window.app_handle()) {
163 if !should_close {
164 window.hide().unwrap();
165 api.prevent_close();
166 }
167 }
168 }
169 });
170 }
171
172 #[cfg(mobile)]
173 {
174 builder = builder
175 .plugin(tauri_plugin_file_scanner::init())
176 .plugin(tauri_plugin_audioplayer::init());
177 }
178
179 #[cfg(desktop)]
180 let is_mobile_init_script = format!(

Callers 1

mainFunction · 0.70

Calls 15

handle_window_closeFunction · 0.85
get_db_stateFunction · 0.85
get_cache_stateFunction · 0.85
get_preference_stateFunction · 0.85
get_oauth_stateFunction · 0.85
get_window_stateFunction · 0.85
get_scanner_stateFunction · 0.85
get_librespot_stateFunction · 0.85
get_theme_handler_stateFunction · 0.85
get_mpris_stateFunction · 0.85
get_lyrics_stateFunction · 0.85

Tested by

no test coverage detected