Skip to content

Commit e228d2b

Browse files
version
1 parent 54e8005 commit e228d2b

File tree

5 files changed

+26
-25
lines changed

5 files changed

+26
-25
lines changed

latest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "v1.0.0",
2+
"version": "v0.1.0",
33
"notes": "Test version",
44
"pub_date": "2024-06-26T19:25:57Z",
55
"platforms": {

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "Tzcode"
3-
version = "1.0.0"
3+
version = "0.1.0"
44
description = "Tzdoe"
55
authors = ["Zhangzijie <[email protected]>"]
66
repository = "https://github.com/zhangzijie-pro/Tzcode.git"

src-tauri/src/main.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
22
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
33

4+
use tauri::api::dialog::message;
45
use tauri::{generate_context, generate_handler};
56

67
mod page;
@@ -10,9 +11,7 @@ mod extension;
1011
mod splashscreen;
1112

1213
use std::process::Command;
13-
use std::sync::Arc;
1414
use tauri::Manager;
15-
use std::sync::Mutex;
1615
use splashscreen::close_init;
1716
use page::file::*;
1817
use page::terimal::{pwd_tauri,whoami_tauri,run_command};
@@ -30,34 +29,36 @@ fn main() {
3029
Command::new("../target/release/tiks").status().expect("Failed run");
3130
}
3231

33-
let python_server = Command::new("python")
32+
let _python_server = Command::new("python")
3433
.arg("../py/server.py")
3534
.spawn()
3635
.expect("Failed to start Python server");
3736

38-
// Use Arc and Mutex to share the Python server process between threads
39-
let python_server = Arc::new(Mutex::new(python_server));
40-
4137

4238
tauri::Builder::default()
4339
.setup({
44-
let python_server = Arc::clone(&python_server);
4540
move |app| {
46-
let main_window = app.get_window("main").unwrap();
47-
main_window.on_window_event({
48-
let python_server = Arc::clone(&python_server);
49-
move |event| {
50-
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
51-
let mut server = python_server.lock().unwrap();
52-
server.kill().expect("Failed to kill Python server");
53-
api.prevent_close();
54-
}
41+
let main_window = app.get_window("main").unwrap();
42+
43+
// 添加更新检查逻辑
44+
let app_handle = app.handle().clone();
45+
tauri::async_runtime::spawn(async move {
46+
match app_handle.updater().check().await {
47+
Ok(update) => {
48+
if update.is_update_available() {
49+
message(Some(&main_window), "Update Available", "A new version is available. It will be installed when you restart the application.");
50+
update.download_and_install().await.unwrap();
5551
}
56-
});
57-
Ok(())
52+
},
53+
Err(e) => {
54+
eprintln!("Failed to check for updates: {}", e);
55+
}
56+
}
57+
});
58+
Ok(())
5859
}
5960
})
6061
.invoke_handler(generate_handler![open_setting,open_new_window,read_directory, read_file, whoami_tauri,pwd_tauri,run_command,close_init,open_workspace,read_workspace_config,write_workspace_config,get_file_language,write_file,get_all_file,get_files_with_pattern,find_file,create_dir,create_file])
61-
.run(generate_context!())
62+
.run(generate_context!("./tauri.conf.json"))
6263
.expect("error while running tauri application");
6364
}

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"icons/Tzcode.icns",
5252
"icons/Tzcode.png"
5353
],
54-
"identifier": "com.Tzcode.Tzcode1.0.0",
54+
"identifier": "com.Tzcode.Tzcode0.1.0",
5555
"longDescription": "",
5656
"macOS": {
5757
"entitlements": null,

ui/js/plugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ document.addEventListener('keydown', async(event) => {
1414
const isFullscreen = await appWindow.isFullscreen();
1515
appWindow.setFullscreen(!isFullscreen);
1616
}
17-
/* if(event.ctrlKey && event.key=='1'){
17+
if(event.ctrlKey && event.key=='q'){
1818
event.preventDefault();
1919
menu_forward();
2020
}
21-
if(event.ctrlKey && event.key=='2'){
21+
if(event.ctrlKey && event.key=='e'){
2222
event.preventDefault();
2323
menu_back();
24-
} */
24+
}
2525
});
2626

2727
// Save active file

0 commit comments

Comments
 (0)