Skip to content

Commit d4126ea

Browse files
committed
added option to authenticate without proxies
1 parent 78a2cfe commit d4126ea

File tree

6 files changed

+157
-71
lines changed

6 files changed

+157
-71
lines changed

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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 = "MCSniperRust"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
description = "A name sniper"
55
authors = ["sushi"]
66
edition = "2021"

src-tauri/src/sniper.rs

Lines changed: 114 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -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(

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<input id="claim_token" type="text" placeholder="Claim Account" autocomplete="off" />
1515
<textarea id="tokens" placeholder="Checker Accounts" autocomplete="off"></textarea>
1616
<textarea id="proxies" placeholder="Proxies" autocomplete="off"></textarea>
17-
<div class="auth">Use proxies for auth<input id="auth" type="checkbox"></div>
17+
<label class="auth">Use proxies for auth<input id="auth" type="checkbox" checked><span></span></label>
1818
</div>
1919
<div class="right">
2020
<div id="logs"></div>

src/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ let fastEl;
1010
let privEl;
1111
let startEl;
1212
let stopEl;
13+
let authEl;
1314

1415
window.addEventListener("DOMContentLoaded", () => {
1516
tokensEl = document.querySelector("#tokens");
@@ -21,6 +22,7 @@ window.addEventListener("DOMContentLoaded", () => {
2122
stopEl.addEventListener("click", stop);
2223
startEl = document.querySelector("#start");
2324
startEl.addEventListener("click", start);
25+
authEl = document.querySelector("#auth");
2426
});
2527

2628
listen("log", (event) => {
@@ -49,6 +51,7 @@ function start() {
4951
accounts: tokensEl.value.split("\n").filter((line) => line.trim() !== ""),
5052
proxies: proxiesEl.value.split("\n").filter((line) => line.trim() !== ""),
5153
name: nameEl.value,
54+
authWProxies: authEl.checked,
5255
};
5356
invoke("start", data).then((res) => {
5457
if (res) {

src/styles.css

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,52 @@ input {
155155
display: block;
156156
}
157157

158-
#auth {
158+
.auth {
159159
position: absolute;
160160
top: calc(50% + 1.5em);
161161
right: calc(50% + 1.5em);
162162
margin: 0;
163163
padding: 0;
164164
height: 1.5em;
165+
line-height: 1.5em;
166+
width: auto;
167+
}
168+
169+
#auth {
170+
position: absolute;
171+
opacity: 0;
172+
cursor: pointer;
173+
height: 0;
174+
width: 0;
175+
}
176+
177+
.auth>span {
178+
margin-left: .5em;
179+
background-color: #fe0000;
180+
height: 1.5em;
165181
width: 3em;
166-
background-color: #000;
167-
appearance: none;
168-
-webkit-appearance: none;
182+
float: right;
183+
border-radius: 0.75em;
184+
transition: background-color .15s linear;
169185
}
170186

171-
#auth::before {
187+
.auth>span::after {
188+
display: block;
172189
content: "";
173-
background-color: #fff;
174-
width: 1em;
175190
height: 1em;
191+
width: 1em;
192+
border-radius: 0.5em;
193+
background-color: black;
194+
top: .25em;
195+
left: .25em;
196+
position: relative;
197+
transition: left .15s linear;
198+
}
199+
200+
.auth>input:checked+span::after {
201+
left: 1.75em;
202+
}
203+
204+
.auth>input:checked+span {
205+
background-color: lime;
176206
}

0 commit comments

Comments
 (0)