@@ -18,9 +18,27 @@ use crate::{
1818
1919#[ tauri:: command]
2020pub fn stop ( ) {
21+ match app_handle ( ) . get_webview_window ( "main" ) {
22+ Some ( window) => {
23+ match window. set_title ( "MCSniperRust - Stopping..." ) {
24+ Ok ( _) => { }
25+ _ => {
26+ log (
27+ "ERROR" ,
28+ Color :: from ( ( 255 , 0 , 0 ) ) ,
29+ "Failed to change window title!" ,
30+ ) ;
31+ alert ( "Failed to change window title!" ) ;
32+ }
33+ } ;
34+ }
35+ _ => {
36+ log ( "ERROR" , Color :: from ( ( 255 , 0 , 0 ) ) , "Failed to get window!" ) ;
37+ alert ( "Failed to get window!" ) ;
38+ }
39+ } ;
2140 set_thread_status ( false ) ;
22- log ( "STOPPED" , Color :: from ( ( 255 , 0 , 0 ) ) , "Sniper stopped!" ) ;
23- alert ( "Sniper stopped!" ) ;
41+ log ( "STOPPING" , Color :: from ( ( 255 , 255 , 0 ) ) , "Sniper stopping..." ) ;
2442 app_handle ( ) . emit ( "stop" , true ) . unwrap ( ) ;
2543}
2644
@@ -225,18 +243,28 @@ fn snipe(name: String, accounts: Vec<String>, claim: String, proxies: Vec<String
225243 ) ;
226244 alert ( "Sniper started successfully!" ) ;
227245
228- log (
229- name. to_uppercase ( ) . as_str ( ) ,
230- Color :: from ( ( 0 , 255 , 0 ) ) ,
231- format ! ( "Sniping {}!" , name) . as_str ( ) ,
232- ) ;
233246 let ( tx_death, rx_death) = channel :: < ( ) > ( ) ;
234247 let ( tx_acc, rx_acc) = channel :: < Account > ( ) ;
235248
236249 let mut rl = calculate_ratelimit ( accounts_num, proxy_list. len ( ) as u32 ) ;
237250
238251 loop {
239252 if !get_thread_status ( ) {
253+ match window. set_title ( "MCSniperRust - Idle" ) {
254+ Ok ( _) => { }
255+ _ => {
256+ log (
257+ "ERROR" ,
258+ Color :: from ( ( 255 , 0 , 0 ) ) ,
259+ "Failed to change window title!" ,
260+ ) ;
261+ alert ( "Failed to change window title!" ) ;
262+ app_handle ( ) . emit ( "stop" , true ) . unwrap ( ) ;
263+ return ;
264+ }
265+ } ;
266+ log ( "STOPPED" , Color :: from ( ( 255 , 0 , 0 ) ) , "Sniper stopped!" ) ;
267+ alert ( "Sniper stopped!" ) ;
240268 return ;
241269 }
242270 if get_ratelimit ( ) {
0 commit comments