c5e9c83ac9
Sets up Tauri v2 + React frontend with SQLite metadata store, sqlite-vec for CLIP embedding infrastructure, and r2d2 connection pool replacing the single Arc<Mutex<Connection>>. Indexer now uses rayon for parallel file metadata collection.
46 lines
1.3 KiB
Rust
46 lines
1.3 KiB
Rust
mod commands;
|
|
mod db;
|
|
mod indexer;
|
|
mod thumbnail;
|
|
mod vector;
|
|
|
|
use tauri::Manager;
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
pub fn run() {
|
|
tauri::Builder::default()
|
|
.plugin(tauri_plugin_opener::init())
|
|
.plugin(tauri_plugin_dialog::init())
|
|
.plugin(tauri_plugin_fs::init())
|
|
.setup(|app| {
|
|
let app_dir = app
|
|
.path()
|
|
.app_data_dir()
|
|
.expect("Failed to get app data dir");
|
|
|
|
std::fs::create_dir_all(&app_dir).expect("Failed to create app data dir");
|
|
|
|
let db_path = app_dir.join("gallery.db");
|
|
let pool = db::create_pool(&db_path).expect("Failed to create database pool");
|
|
|
|
{
|
|
let conn = pool.get().expect("Failed to get connection for migration");
|
|
db::migrate(&conn).expect("Failed to run migrations");
|
|
}
|
|
|
|
app.manage(pool);
|
|
|
|
Ok(())
|
|
})
|
|
.invoke_handler(tauri::generate_handler![
|
|
commands::add_folder,
|
|
commands::get_folders,
|
|
commands::remove_folder,
|
|
commands::get_images,
|
|
commands::reindex_folder,
|
|
commands::update_image_details,
|
|
])
|
|
.run(tauri::generate_context!())
|
|
.expect("error while running tauri application");
|
|
}
|