Skip to content

Commit

Permalink
修复 WebAPI - /bans
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Jan 8, 2025
1 parent 944d6c8 commit e1ffe78
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.biglybt.pif.download.DownloadStats;
import com.biglybt.pif.ipfilter.IPBanned;
import com.biglybt.pif.ipfilter.IPFilter;
import com.biglybt.pif.ipfilter.IPFilterException;
import com.biglybt.pif.messaging.Message;
import com.biglybt.pif.peers.*;
import com.biglybt.pif.tag.Tag;
Expand Down Expand Up @@ -305,19 +304,17 @@ private void handleDownloads(Context ctx) {
public void handleBans(Context ctx) {
boolean includeNonPBH = Boolean.parseBoolean(ctx.queryParam("includeNonPBH"));
List<String> banned = new ArrayList<>();
for (IPBanned bannedIP : pluginInterface.getIPFilter().getBannedIPs()) {
if (!includeNonPBH) {
if (!PBH_IDENTIFIER.equals(bannedIP.getBannedTorrentName())) {
continue;
}
banList.nodeIterator(false).forEachRemaining(node -> banned.add(node.toString()));
if (includeNonPBH) {
for (IPBanned bannedIP : pluginInterface.getIPFilter().getBannedIPs()) {
banned.add(bannedIP.getBannedIP());
}
banned.add(bannedIP.getBannedIP());
}
ctx.status(HttpStatus.OK);
ctx.json(banned);
}

private void handleBatchUnban(Context ctx) throws IPFilterException {
private void handleBatchUnban(Context ctx) {
UnBanBean banBean = ctx.bodyAsClass(UnBanBean.class);
AtomicInteger unbanned = new AtomicInteger();
AtomicInteger failed = new AtomicInteger();
Expand Down

0 comments on commit e1ffe78

Please sign in to comment.