Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,25 @@ private static UploadResult parseUploadResult(ArrayList<String> lines) {
boolean already = message.toLowerCase(java.util.Locale.ROOT).contains("already");
return new UploadResult(already ? UploadOutcome.ALREADY : UploadOutcome.SUCCESS, message);
}
// Current OnlineHashCrack API responds with accepted/skipped/rejected counts
// instead of a success flag: {"accepted":{"count":1,...},"skipped":{...},"rejected":{...}}
org.json.JSONObject accepted = json.optJSONObject("accepted");
org.json.JSONObject skipped = json.optJSONObject("skipped");
org.json.JSONObject rejected = json.optJSONObject("rejected");
if (accepted != null || skipped != null || rejected != null) {
int acc = accepted != null ? accepted.optInt("count", 0) : 0;
int skp = skipped != null ? skipped.optInt("count", 0) : 0;
int rej = rejected != null ? rejected.optInt("count", 0) : 0;
if (acc > 0) {
return new UploadResult(UploadOutcome.SUCCESS, message);
}
if (skp > 0) {
String reason = skipped != null ? skipped.optString("reason", "") : "";
return new UploadResult(UploadOutcome.ALREADY, reason);
}
String reason = rejected != null ? rejected.optString("reason", "") : "";
return new UploadResult(UploadOutcome.FAILED, reason);
}
return new UploadResult(UploadOutcome.FAILED, message);
} catch (org.json.JSONException ignored) {
}
Expand Down