Working interface between rust and web
This commit is contained in:
@@ -27,28 +27,6 @@ pub fn toggle_mod(state: State<SharedState>, mod_id: String) {
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn discover_mods(query: String) -> Vec<Mod> {
|
||||
let all = vec![Mod {
|
||||
id: "modmenu".into(),
|
||||
name: "Mod Menu".into(),
|
||||
version: "7.2.2".into(),
|
||||
author: "TerraformersMC".into(),
|
||||
description: "Adds a mod menu.".into(),
|
||||
enabled: false,
|
||||
icon: None,
|
||||
supported_versions: vec!["1.20.1".into(), "1.20.4".into(), "1.21".into()],
|
||||
}];
|
||||
|
||||
if query.is_empty() {
|
||||
return all;
|
||||
}
|
||||
|
||||
all.into_iter()
|
||||
.filter(|m| m.name.to_lowercase().contains(&query.to_lowercase()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn install_mod(state: State<SharedState>, mut mod_item: Mod) {
|
||||
let mut state = state.lock().unwrap();
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use saturn_launcher_lib::commands::*;
|
||||
use saturn_launcher_lib::{commands::*, AppState};
|
||||
use std::sync::Mutex;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.manage(Mutex::new(AppState::default()))
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
get_versions,
|
||||
get_installed_mods,
|
||||
toggle_mod,
|
||||
discover_mods,
|
||||
install_mod,
|
||||
get_settings,
|
||||
update_settings,
|
||||
|
||||
Reference in New Issue
Block a user