Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
Merge remote-tracking branch 'origin/dev' into mobile/dev
Vanalite262a1a954406
diff --cc src-tauri/src/core/setup.rsindex 301378695,68c7c44a1..38eca440e--- a/src-tauri/src/core/setup.rs+++ b/src-tauri/src/core/setup.rs@@@ -3,43 -3,23 +3,27 @@@ use std::fs::{self, File},io::Read,path::PathBuf,+ sync::Arc,};use tar::Archive;+use tauri::{- App, Emitter, Manager, Runtime,++ App, Emitter, Manager, Runtime, Wry+};++#[cfg(desktop)]use tauri::{menu::{Menu, MenuItem, PredefinedMenuItem},tray::{MouseButton, MouseButtonState, TrayIcon, TrayIconBuilder, TrayIconEvent},- App, Emitter, Manager, Wry,};- use tauri_plugin_store::StoreExt;- // use tokio::sync::Mutex;- // use tokio::time::{sleep, Duration}; // Using tokio::sync::Mutex- // // MCP+ use tauri_plugin_store::Store;++ use crate::core::mcp::helpers::add_server_config;- // MCPuse super::{- app::commands::get_jan_data_folder_path, extensions::commands::get_jan_extensions_path,- mcp::helpers::run_mcp_commands, state::AppState,+ extensions::commands::get_jan_extensions_path, mcp::helpers::run_mcp_commands, state::AppState,};-pub fn install_extensions(app: tauri::AppHandle, force: bool) -> Result<(), String> {+pub fn install_extensions<R: Runtime>(app: tauri::AppHandle<R>, force: bool) -> Result<(), String> {- let mut store_path = get_jan_data_folder_path(app.clone());- store_path.push("store.json");- let store = app.store(store_path).expect("Store not initialized");- let stored_version = store- .get("version")- .and_then(|v| v.as_str().map(String::from))- .unwrap_or_default();-- let app_version = app- .config()- .version- .clone()- .unwrap_or_else(|| "".to_string());-let extensions_path = get_jan_extensions_path(app.clone());let pre_install_path = app.path()diff --cc src-tauri/src/lib.rsindex d7ff7693c,a2b263c6a..abd12ddb7--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@@ -10,9 -10,12 +10,10 @@@ use jan_utils::generate_app_tokenuse std::{collections::HashMap, sync::Arc};use tauri::{Emitter, Manager, RunEvent};use tauri_plugin_llamacpp::cleanup_llama_processes;+ use tauri_plugin_store::StoreExt;use tokio::sync::Mutex;-use crate::core::setup::setup_tray;--#[cfg_attr(mobile, tauri::mobile_entry_point)]+#[cfg_attr(all(mobile, any(target_os = "android", target_os = "ios")), tauri::mobile_entry_point)]pub fn run() {let mut builder = tauri::Builder::default();#[cfg(desktop)]@@@ -132,16 -150,51 +133,51 @@@]).build(),)?;- app.handle()- .plugin(tauri_plugin_updater::Builder::new().build())?;+ #[cfg(not(any(target_os = "ios", target_os = "android")))]+ app.handle().plugin(tauri_plugin_updater::Builder::new().build())?;- // Install extensions- if let Err(e) = setup::install_extensions(app.handle().clone(), false) {++ // Start migration+ let mut store_path = get_jan_data_folder_path(app.handle().clone());+ store_path.push("store.json");+ let store = app+ .handle()+ .store(store_path)+ .expect("Store not initialized");+ let stored_version = store+ .get("version")+ .and_then(|v| v.as_str().map(String::from))+ .unwrap_or_default();+ let app_version = app+ .config()+ .version+ .clone()+ .unwrap_or_else(|| "".to_string());+ // Migrate extensions+ if let Err(e) =+ setup::install_extensions(app.handle().clone(), stored_version != app_version)+ {log::error!("Failed to install extensions: {}", e);}+ // Migrate MCP servers+ if let Err(e) = setup::migrate_mcp_servers(app.handle().clone(), store.clone()) {+ log::error!("Failed to migrate MCP servers: {}", e);+ }++ // Store the new app version+ store.set("version", serde_json::json!(app_version));+ store.save().expect("Failed to save store");+ // Migration completed-++++ #[cfg(desktop)]+ if option_env!("ENABLE_SYSTEM_TRAY_ICON").unwrap_or("false") == "true" {+ log::info!("Enabling system tray icon");- let _ = setup_tray(app);++ let _ = setup::setup_tray(app);+ }+- #[cfg(any(windows, target_os = "linux"))]+ #[cfg(all(feature = "deep-link", any(windows, target_os = "linux")))]{use tauri_plugin_deep_link::DeepLinkExt;-app.deep_link().register_all()?;}setup_mcp(app);diff --cc src-tauri/tauri.conf.jsonindex f559d79cc,10f4325e8..b0df3fc2f--- a/src-tauri/tauri.conf.json+++ b/src-tauri/tauri.conf.json@@@ -73,9 -72,11 +73,10 @@@"windows": {"installMode": "passive"}- },- "deep-link": { "schemes": ["jan"] }+ }},"bundle": {+ "publisher": "Menlo Research Pte. Ltd.","active": true,"createUpdaterArtifacts": false,"icon": [diff --cc web-app/src/containers/__tests__/SetupScreen.test.tsxindex c3c98f5b4,1ef654eee..17b16228f--- a/web-app/src/containers/__tests__/SetupScreen.test.tsx+++ b/web-app/src/containers/__tests__/SetupScreen.test.tsx@@@ -163,9 -137,10 +163,9 @@@ describe('SetupScreen', () =>})it('handles model installation', () => {- renderWithRouter()-+ renderSetupScreen()+// Component should handle model installation process- const setupContent = screen.getByText('setup:welcome').closest('div')- expect(setupContent).toBeInTheDocument()+ expect(screen.getByTestId('setup-screen')).toBeInTheDocument()})- })+ })