Skip to content

Commit

Permalink
feat: error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
cubewhy committed Oct 13, 2024
1 parent eb26220 commit d317de9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
@NoArgsConstructor
@Builder
public class VapeAuthorizeDTO {
String token;
Status status;
private String token;
private Status status;

public enum Status {
OK,
SERVLET_ERROR, NO_ACCOUNT, BANNED_OR_INCORRECT
SERVLET_ERROR, NO_ACCOUNT, INCORRECT, BANNED, CLOUDFLARE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,25 @@ public VapeAuthorizeDTO doAuth(VapeAccount vapeAccount) {
}
if (responseString.length() != 33) {
// not a valid token
log.error("Account {} seems banned or incorrect ({})", vapeAccount.getUsername(), responseString);
if (responseString.equals("1006")) {
// Cloudflare captcha
log.error("Your IP address was banned by Manthe. Please switch your VPN endpoint or use a Gateway. ({})", responseString);
return VapeAuthorizeDTO.builder()
.token("Cloudflare")
.status(VapeAuthorizeDTO.Status.CLOUDFLARE)
.build();
}
if (responseString.equals("102")) {
log.error("Vape account {} was banned. ({})", vapeAccount.getUsername(), responseString);
return VapeAuthorizeDTO.builder()
.token("Disabled")
.status(VapeAuthorizeDTO.Status.BANNED)
.build();
}
log.error("Auth server responded an error: {} (Account: {})", responseString, vapeAccount.getUsername());
return VapeAuthorizeDTO.builder()
.token(responseString)
.status(VapeAuthorizeDTO.Status.BANNED_OR_INCORRECT)
.status(VapeAuthorizeDTO.Status.INCORRECT)
.build();
}
}
Expand Down

0 comments on commit d317de9

Please sign in to comment.