删除多余

This commit is contained in:
sr7
2024-09-24 20:29:49 +08:00
parent b9e6dce193
commit 97099849b7
7 changed files with 3208 additions and 14741 deletions

View File

@@ -1,35 +1,12 @@
use tauri_specta::Event;
// demo command
#[tauri::command]
#[specta::specta]
fn greet(app: tauri::AppHandle, name: &str) -> String {
DemoEvent("Demo event fired from Rust 🦀".to_string())
.emit(&app)
.ok();
format!("Hello, {}! You've been greeted from Rust!", name)
}
// demo event
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, specta::Type, Event)]
pub struct DemoEvent(String);
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
#[cfg(debug_assertions)]
{
log::info!("App started!");
log::warn!("Example Rust Log: warning!");
log::error!("Example Rust Log: error!");
}
#[cfg(debug_assertions)]
let devtools = tauri_plugin_devtools::init();
let mut builder = tauri::Builder::default();
let specta_builder = tauri_specta::Builder::<tauri::Wry>::new()
.commands(tauri_specta::collect_commands![greet])
.events(tauri_specta::collect_events![crate::DemoEvent]);
let specta_builder = tauri_specta::Builder::<tauri::Wry>::new();
#[cfg(debug_assertions)]
{
@@ -47,21 +24,10 @@ pub fn run() {
builder
.plugin(tauri_plugin_shell::init())
// .plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_dialog::init())
.invoke_handler(specta_builder.invoke_handler())
.setup(move |app| {
specta_builder.mount_events(app);
// listen to demo event
DemoEvent::listen(app, |event| {
log::info!("DemoEvent received in Rust:: {:?}", event.payload);
});
// dispatch demo event
DemoEvent("Hello from Rust 🦀".to_string()).emit(app).ok();
// /dispatch demo event
Ok(())
})
.run(tauri::generate_context!())

View File

@@ -1,16 +1,4 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
// #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// fn main() {
// tauri::Builder::default()
// .plugin(tauri_plugin_window_state::Builder::default().build())
// .run(tauri::generate_context!())
// .expect("error while running tauri application");
// }
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
nextchat::run()
}

View File

@@ -1,8 +1,8 @@
{
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
"productName": "NextChat",
"identifier": "NextChat.template.dev",
"version": "0.1.0",
"identifier": "com.yida.chatgpt.next.web",
"version": "2.15.4",
"build": {
"beforeBuildCommand": "yarn export",
"beforeDevCommand": "yarn export:dev",
@@ -13,7 +13,7 @@
"app": {
"windows": [
{
"title": "quantum",
"title": "NextChat",
"width": 800,
"height": 600
}
@@ -21,7 +21,7 @@
"security": {
"csp": null
},
"withGlobalTauri": false
"withGlobalTauri": true
},
"bundle": {
"macOS": {