@@ -43,13 +43,25 @@ pub fn stop() {
4343}
4444
4545#[ tauri:: command]
46- pub fn start ( claim : String , accounts : Vec < String > , proxies : Vec < String > , name : String ) -> bool {
47- thread:: spawn ( move || snipe ( name, accounts, claim, proxies) ) ;
46+ pub fn start (
47+ claim : String ,
48+ accounts : Vec < String > ,
49+ proxies : Vec < String > ,
50+ name : String ,
51+ auth_w_proxies : bool ,
52+ ) -> bool {
53+ thread:: spawn ( move || snipe ( name, accounts, claim, proxies, auth_w_proxies) ) ;
4854 set_thread_status ( true ) ;
4955 true
5056}
5157
52- fn snipe ( name : String , accounts : Vec < String > , claim : String , proxies : Vec < String > ) {
58+ fn snipe (
59+ name : String ,
60+ accounts : Vec < String > ,
61+ claim : String ,
62+ proxies : Vec < String > ,
63+ auth_w_proxies : bool ,
64+ ) {
5365 thread:: sleep ( Duration :: from_secs ( 1 ) ) ;
5466
5567 let mut proxy_list = VecDeque :: new ( ) ;
@@ -73,68 +85,109 @@ fn snipe(name: String, accounts: Vec<String>, claim: String, proxies: Vec<String
7385 & format ! ( "Added {} proxies." , proxy_list. len( ) - 1 ) ,
7486 ) ;
7587
76- let accounts = accounts
77- . chunks ( ( accounts. len ( ) / proxy_list. len ( ) ) . max ( 1 ) )
78- . map ( |accs| accs. to_vec ( ) ) ;
88+ let mut accounts = if auth_w_proxies {
89+ let accounts = accounts
90+ . chunks ( ( accounts. len ( ) / proxy_list. len ( ) ) . max ( 1 ) )
91+ . map ( |accs| accs. to_vec ( ) ) ;
92+ let mut threads = Vec :: new ( ) ;
7993
80- let mut threads = Vec :: new ( ) ;
81-
82- for ( i, accs) in accounts. enumerate ( ) {
83- let proxy = proxy_list[ i] . clone ( ) ;
84- threads. push ( thread:: spawn ( move || {
85- let mut out = Vec :: new ( ) ;
86- let mut sleep_toggle = false ;
87- for ( i, acc) in accs. iter ( ) . enumerate ( ) {
88- if let Some ( acc) =
89- if acc. len ( ) > 200 && !acc. contains ( ":" ) && acc. starts_with ( "eyJ" ) {
90- Account :: new_bearer ( acc. to_owned ( ) , proxy. clone ( ) )
91- } else {
92- if sleep_toggle {
93- sleep ( Duration :: from_secs ( 21 ) ) ;
94+ for ( i, accs) in accounts. enumerate ( ) {
95+ let proxy = proxy_list[ i] . clone ( ) ;
96+ threads. push ( thread:: spawn ( move || {
97+ let mut out = Vec :: new ( ) ;
98+ let mut sleep_toggle = false ;
99+ for acc in accs {
100+ if let Some ( acc) =
101+ if acc. len ( ) > 200 && !acc. contains ( ":" ) && acc. starts_with ( "eyJ" ) {
102+ Account :: new_bearer ( acc. to_owned ( ) , proxy. clone ( ) )
103+ } else {
104+ if sleep_toggle {
105+ sleep ( Duration :: from_secs ( 21 ) ) ;
106+ sleep_toggle = false
107+ }
108+ let mut split = acc. split ( ":" ) ;
109+ let Some ( user) = split. next ( ) else {
110+ log (
111+ "ERROR" ,
112+ Color :: from ( ( 255 , 0 , 0 ) ) ,
113+ & format ! ( "{} isn't a valid account!" , acc) ,
114+ ) ;
115+ continue ;
116+ } ;
117+ let Some ( pass) = split. next ( ) else {
118+ log (
119+ "ERROR" ,
120+ Color :: from ( ( 255 , 0 , 0 ) ) ,
121+ & format ! ( "{} isn't a valid account!" , acc) ,
122+ ) ;
123+ continue ;
124+ } ;
125+ sleep_toggle = true ;
126+ Account :: new ( user. to_owned ( ) , pass. to_owned ( ) , proxy. clone ( ) )
94127 }
95- let mut split = acc. split ( ":" ) ;
96- let Some ( user) = split. next ( ) else {
97- log (
98- "ERROR" ,
99- Color :: from ( ( 255 , 0 , 0 ) ) ,
100- & format ! ( "{} isn't a valid account!" , i) ,
101- ) ;
102- continue ;
103- } ;
104- let Some ( pass) = split. next ( ) else {
105- log (
106- "ERROR" ,
107- Color :: from ( ( 255 , 0 , 0 ) ) ,
108- & format ! ( "{} isn't a valid account!" , i) ,
109- ) ;
110- continue ;
111- } ;
112- sleep_toggle = true ;
113- Account :: new ( user. to_owned ( ) , pass. to_owned ( ) , proxy. clone ( ) )
114- }
115- {
116- out. push ( acc) ;
117- } ;
118- }
119- if proxy. is_none ( ) && sleep_toggle {
120- sleep ( Duration :: from_secs ( 21 ) ) ;
121- }
122- out
123- } ) ) ;
124- }
128+ {
129+ out. push ( acc) ;
130+ } ;
131+ }
132+ if proxy. is_none ( ) && sleep_toggle {
133+ sleep ( Duration :: from_secs ( 21 ) ) ;
134+ }
135+ out
136+ } ) ) ;
137+ }
125138
126- let mut accounts = VecDeque :: new ( ) ;
139+ let mut accounts = VecDeque :: new ( ) ;
127140
128- for i in threads {
129- match i. join ( ) {
130- Ok ( accs) => accounts. append ( & mut VecDeque :: from ( accs) ) ,
131- Err ( _) => log (
132- "ERROR" ,
133- Color :: from ( ( 255 , 0 , 0 ) ) ,
134- "A thread to sign in accounts failed." ,
135- ) ,
141+ for i in threads {
142+ match i. join ( ) {
143+ Ok ( accs) => accounts. append ( & mut VecDeque :: from ( accs) ) ,
144+ Err ( _) => log (
145+ "ERROR" ,
146+ Color :: from ( ( 255 , 0 , 0 ) ) ,
147+ "A thread to sign in accounts failed." ,
148+ ) ,
149+ }
136150 }
137- }
151+ accounts
152+ } else {
153+ let mut out = VecDeque :: new ( ) ;
154+ let mut sleep_toggle = false ;
155+ for acc in accounts {
156+ if let Some ( acc) = if acc. len ( ) > 200 && !acc. contains ( ":" ) && acc. starts_with ( "eyJ" ) {
157+ Account :: new_bearer ( acc. to_owned ( ) , None )
158+ } else {
159+ if sleep_toggle {
160+ sleep ( Duration :: from_secs ( 21 ) ) ;
161+ sleep_toggle = false
162+ }
163+ let mut split = acc. split ( ":" ) ;
164+ let Some ( user) = split. next ( ) else {
165+ log (
166+ "ERROR" ,
167+ Color :: from ( ( 255 , 0 , 0 ) ) ,
168+ & format ! ( "{} isn't a valid account!" , acc) ,
169+ ) ;
170+ continue ;
171+ } ;
172+ let Some ( pass) = split. next ( ) else {
173+ log (
174+ "ERROR" ,
175+ Color :: from ( ( 255 , 0 , 0 ) ) ,
176+ & format ! ( "{} isn't a valid account!" , acc) ,
177+ ) ;
178+ continue ;
179+ } ;
180+ sleep_toggle = true ;
181+ Account :: new ( user. to_owned ( ) , pass. to_owned ( ) , None )
182+ } {
183+ out. push_front ( acc) ;
184+ } ;
185+ }
186+ if sleep_toggle {
187+ sleep ( Duration :: from_secs ( 21 ) ) ;
188+ }
189+ out
190+ } ;
138191 let mut accounts_num = accounts. len ( ) as u32 ;
139192
140193 if accounts_num == 0 {
@@ -354,7 +407,7 @@ fn snipe(name: String, accounts: Vec<String>, claim: String, proxies: Vec<String
354407 }
355408 Err ( err) => log ( "ERROR" , Color :: from ( ( 255 , 0 , 0 ) ) , & err) ,
356409 }
357- match account. opt_reauth ( proxy_pass) {
410+ match account. opt_reauth ( if auth_w_proxies { proxy_pass } else { None } ) {
358411 Some ( _) => match tx_acc_pass. send ( account) {
359412 Ok ( _) => ( ) ,
360413 Err ( _) => log (
0 commit comments