Skip to content

Commit f1878ef

Browse files
committed
addded support for nns
1 parent 6a6a656 commit f1878ef

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

src-tauri/src/account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
};
1818

1919
#[derive(PartialEq, Clone, Debug)]
20-
enum AccType {
20+
pub enum AccType {
2121
CLAIMED,
2222
UNCLAIMED,
2323
}
@@ -34,7 +34,7 @@ pub struct Account {
3434
refresh_token: Option<String>,
3535
user: Option<String>,
3636
passwd: Option<String>,
37-
acc_type: AccType,
37+
pub acc_type: AccType,
3838
login_type: LoginType,
3939
time: DateTime<Utc>,
4040
}

src-tauri/src/sniper.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use reqwest::Proxy;
1010
use tauri::{window::Color, Emitter, Manager};
1111

1212
use crate::{
13-
account::Account,
13+
account::{AccType, Account},
1414
app_handle, get_ratelimit, get_thread_status,
1515
log::{alert, log},
1616
set_ratelimit, set_thread_status,
@@ -241,29 +241,31 @@ fn snipe(
241241
return;
242242
}
243243
};
244-
match claim.check_change_eligibility() {
245-
Some(b) => {
246-
if !b {
244+
if claim.acc_type == AccType::CLAIMED {
245+
match claim.check_change_eligibility() {
246+
Some(b) => {
247+
if !b {
248+
log(
249+
"ERROR",
250+
Color::from((255, 0, 0)),
251+
"Claimer can't namechange!",
252+
);
253+
alert("Claimer can't namechange!");
254+
app_handle().emit("stop", true).unwrap();
255+
return;
256+
}
257+
}
258+
None => {
247259
log(
248260
"ERROR",
249261
Color::from((255, 0, 0)),
250-
"Claimer can't namechange!",
262+
"Failed to check if claimer can change name!",
251263
);
252-
alert("Claimer can't namechange!");
264+
alert("Failed to check if claimer can change name!");
253265
app_handle().emit("stop", true).unwrap();
254266
return;
255267
}
256268
}
257-
None => {
258-
log(
259-
"ERROR",
260-
Color::from((255, 0, 0)),
261-
"Failed to check if claimer can change name!",
262-
);
263-
alert("Failed to check if claimer can change name!");
264-
app_handle().emit("stop", true).unwrap();
265-
return;
266-
}
267269
}
268270
let window = match app_handle().get_webview_window("main") {
269271
Some(w) => w,

0 commit comments

Comments
 (0)