diff --git a/pom.xml b/pom.xml
index 3a54508162..56c74d2940 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.ghostchu.peerbanhelper
peerbanhelper
- 7.1.0
+ 7.1.1
jar
PeerBanHelper
diff --git a/src/main/java/com/ghostchu/peerbanhelper/PeerBanHelperServer.java b/src/main/java/com/ghostchu/peerbanhelper/PeerBanHelperServer.java
index e0be72e117..98e0df040b 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/PeerBanHelperServer.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/PeerBanHelperServer.java
@@ -186,8 +186,8 @@ public void start() throws SQLException {
registerBanListInvokers();
setupScriptEngine();
registerModules();
- registerHttpServer();
setupIPDB();
+ registerHttpServer();
resetKnownDownloaders();
loadBanListToMemory();
registerTimer();
diff --git a/src/main/java/com/ghostchu/peerbanhelper/btn/BtnNetwork.java b/src/main/java/com/ghostchu/peerbanhelper/btn/BtnNetwork.java
index 4d6794d7a1..82aad3edc4 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/btn/BtnNetwork.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/btn/BtnNetwork.java
@@ -153,7 +153,6 @@ private void setupHttpClient() {
.newBuilder()
.followRedirects(HttpClient.Redirect.ALWAYS)
.userAgent(userAgent)
- .defaultHeader("Accept-Encoding", "gzip,deflate")
.defaultHeader("Content-Type", "application/json")
.defaultHeader("BTN-AppID", appId)
.defaultHeader("BTN-AppSecret", appSecret)
diff --git a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/AlertDao.java b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/AlertDao.java
index d659c0d96c..f4c3871d0c 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/AlertDao.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/AlertDao.java
@@ -47,7 +47,7 @@ public boolean identifierAlertExistsIncludeRead(String identifier) throws SQLExc
public int deleteOldAlerts(Timestamp before) throws SQLException {
var builder = deleteBuilder();
builder.setWhere(
- queryBuilder().where().lt("createAt", new SelectArg(before))
+ queryBuilder().where().lt("createAt",before)
.and()
.isNotNull("readAt")
);
@@ -68,7 +68,7 @@ public void markAllAsRead() throws SQLException {
public void markAsRead(String identifier) throws SQLException {
update(updateBuilder()
.updateColumnValue("identifier", new SelectArg(identifier))
- .updateColumnValue("readAt", new SelectArg(new Timestamp(System.currentTimeMillis())))
+ .updateColumnValue("readAt", new Timestamp(System.currentTimeMillis()))
.prepare());
}
}
\ No newline at end of file
diff --git a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/PeerRecordDao.java b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/PeerRecordDao.java
index 8343e894ab..bcc4bee6f5 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/PeerRecordDao.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/PeerRecordDao.java
@@ -43,7 +43,7 @@ public void syncPendingTasks(Deque tasks) throws SQLException
public Page getPendingSubmitPeerRecords(Pageable pageable, Timestamp afterThan) throws SQLException {
var queryBuilder = queryBuilder().where()
- .gt("lastTimeSeen", new SelectArg(afterThan))
+ .gt("lastTimeSeen", afterThan)
.or()
.isNull("lastTimeSeen")
.queryBuilder()
@@ -101,7 +101,7 @@ public synchronized PeerRecordEntity createIfNotExists(PeerRecordEntity data) th
PeerRecordEntity existing = queryBuilder().where()
.eq("address", new SelectArg(data.getAddress()))
.and()
- .eq("torrent_id", new SelectArg(data.getTorrent().getId()))
+ .eq("torrent_id", data.getTorrent().getId())
.and()
.eq("downloader", new SelectArg(data.getDownloader()))
.queryForFirst();
diff --git a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/ProgressCheatBlockerPersistDao.java b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/ProgressCheatBlockerPersistDao.java
index 7d2ed70e43..0517835fe7 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/ProgressCheatBlockerPersistDao.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/ProgressCheatBlockerPersistDao.java
@@ -33,7 +33,7 @@ public List fetchFromDatabase(ProgressCheatBloc
.where()
.eq("torrentId", new SelectArg(client.getTorrentId()))
.and()
- .ge("lastTimeSeen", new SelectArg(after))
+ .ge("lastTimeSeen", after)
.query();
return entities.stream().filter(
entity -> address.contains(IPAddressUtil.getIPAddress(entity.getAddress()))
@@ -107,7 +107,7 @@ private ProgressCheatBlockerPersistEntity findExists(String ip, String torrentId
public int cleanupDatabase(Timestamp timestamp) throws SQLException {
var builder = deleteBuilder();
- var where = builder.where().lt("lastTimeSeen", new SelectArg(timestamp));
+ var where = builder.where().lt("lastTimeSeen", timestamp);
builder.setWhere(where);
return builder.delete();
}
diff --git a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/TrafficJournalDao.java b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/TrafficJournalDao.java
index 89f44ae1ba..d665a281af 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/TrafficJournalDao.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/TrafficJournalDao.java
@@ -4,6 +4,7 @@
import com.ghostchu.peerbanhelper.database.dao.AbstractPBHDao;
import com.ghostchu.peerbanhelper.database.table.TrafficJournalEntity;
import com.ghostchu.peerbanhelper.util.MiscUtil;
+import com.ghostchu.peerbanhelper.util.MsgUtil;
import com.j256.ormlite.stmt.SelectArg;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -73,9 +74,9 @@ public void fixTimezone(TrafficJournalDao.TrafficData data) {
public List getAllDownloadersOverallData(Timestamp start, Timestamp end) throws Exception {
try (var results = queryBuilder().selectRaw("timestamp", "SUM(dataOverallUploaded) AS totalUploaded", "SUM(dataOverallDownloaded) AS totalDownloaded")
.where()
- .ge("timestamp",new SelectArg( start.getTime()))
+ .ge("timestamp", start.getTime())
.and()
- .le("timestamp",new SelectArg( end.getTime()))
+ .le("timestamp", end.getTime())
.queryBuilder()
.groupBy("timestamp")
.queryRaw()) {
@@ -86,11 +87,11 @@ public List getAllDownloadersOverallData(Timestamp start, Timestamp
public List getSpecificDownloaderOverallData(String downloadName, Timestamp start, Timestamp end) throws Exception {
try (var results = queryBuilder().selectRaw("timestamp", "SUM(dataOverallUploaded) AS totalUploaded", "SUM(dataOverallDownloaded) AS totalDownloaded")
.where()
- .ge("timestamp", new SelectArg(start.getTime()))
+ .ge("timestamp", start.getTime())
.and()
- .le("timestamp", new SelectArg(end.getTime()))
+ .le("timestamp", end.getTime())
.and()
- .eq("downloader", new SelectArg(downloadName))
+ .eq("downloader", MsgUtil.escapeSql(downloadName))
.queryBuilder()
.groupBy("timestamp")
.queryRaw()) {
@@ -104,7 +105,7 @@ public synchronized TrafficJournalEntity createIfNotExists(TrafficJournalEntity
return null;
}
TrafficJournalEntity existing = queryBuilder().where()
- .eq("timestamp", new SelectArg(data.getTimestamp()))
+ .eq("timestamp", data.getTimestamp())
.and()
.eq("downloader", new SelectArg(data.getDownloader())).queryBuilder().queryForFirst();
if (existing == null) {
diff --git a/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/biglybt/BiglyBT.java b/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/biglybt/BiglyBT.java
index 9c30a6cd26..3b1225a0f2 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/biglybt/BiglyBT.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/biglybt/BiglyBT.java
@@ -69,7 +69,6 @@ public BiglyBT(String name, Config config, AlertManager alertManager) {
.followRedirects(HttpClient.Redirect.ALWAYS)
.defaultHeader("Authorization", "Bearer " + config.getToken())
.defaultHeader("Content-Type", "application/json")
- .defaultHeader("Accept-Encoding", "gzip,deflate")
.connectTimeout(Duration.of(10, ChronoUnit.SECONDS))
.headersTimeout(Duration.of(10, ChronoUnit.SECONDS))
.readTimeout(Duration.of(30, ChronoUnit.SECONDS))
diff --git a/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/bitcomet/BitComet.java b/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/bitcomet/BitComet.java
index 3cd446074b..e2a6f6ab1a 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/bitcomet/BitComet.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/bitcomet/BitComet.java
@@ -70,7 +70,6 @@ public BitComet(String name, Config config, AlertManager alertManager) {
cm.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
Methanol.Builder builder = Methanol.newBuilder()
.version(HttpClient.Version.valueOf(config.getHttpVersion()))
- .defaultHeader("Accept-Encoding", "gzip,deflate")
.defaultHeader("Content-Type", "application/json")
.defaultHeader("Client-Type", "BitComet WebUI")
.defaultHeader("User-Agent", "PeerBanHelper BitComet Adapter")
diff --git a/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/qbittorrent/AbstractQbittorrent.java b/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/qbittorrent/AbstractQbittorrent.java
index 05d6effa5c..352b8afa6e 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/qbittorrent/AbstractQbittorrent.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/downloader/impl/qbittorrent/AbstractQbittorrent.java
@@ -60,7 +60,6 @@ public AbstractQbittorrent(String name, QBittorrentConfig config, AlertManager a
Methanol.Builder builder = Methanol
.newBuilder()
.version(HttpClient.Version.valueOf(config.getHttpVersion()))
- .defaultHeader("Accept-Encoding", "gzip,deflate")
.followRedirects(HttpClient.Redirect.ALWAYS)
.connectTimeout(Duration.of(10, ChronoUnit.SECONDS))
.headersTimeout(Duration.of(10, ChronoUnit.SECONDS))
diff --git a/src/main/java/com/ghostchu/peerbanhelper/ipdb/IPDB.java b/src/main/java/com/ghostchu/peerbanhelper/ipdb/IPDB.java
index fd1a6e0769..20cb115fff 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/ipdb/IPDB.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/ipdb/IPDB.java
@@ -43,6 +43,7 @@
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -291,11 +292,10 @@ private void setupHttpClient() {
.version(HttpClient.Version.HTTP_1_1)
.followRedirects(HttpClient.Redirect.ALWAYS)
.userAgent(userAgent)
- .defaultHeader("Accept-Encoding", "gzip,deflate")
+ .requestTimeout(Duration.of(2, ChronoUnit.MINUTES))
.connectTimeout(Duration.of(15, ChronoUnit.SECONDS))
.headersTimeout(Duration.of(15, ChronoUnit.SECONDS))
- .readTimeout(Duration.of(30, ChronoUnit.SECONDS))
- .requestTimeout(Duration.of(2, ChronoUnit.MINUTES))
+ .readTimeout(Duration.of(30, ChronoUnit.SECONDS), Executors.newScheduledThreadPool(1, Thread.ofVirtual().factory()))
.authenticator(new Authenticator() {
@Override
public PasswordAuthentication requestPasswordAuthenticationInstance(String host, InetAddress addr, int port, String protocol, String prompt, String scheme, URL url, RequestorType reqType) {
diff --git a/src/main/java/com/ghostchu/peerbanhelper/metric/impl/persist/PersistMetrics.java b/src/main/java/com/ghostchu/peerbanhelper/metric/impl/persist/PersistMetrics.java
index 41ca8c02e2..45bf56e308 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/metric/impl/persist/PersistMetrics.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/metric/impl/persist/PersistMetrics.java
@@ -16,7 +16,6 @@
import com.ghostchu.peerbanhelper.util.MiscUtil;
import com.ghostchu.peerbanhelper.wrapper.BanMetadata;
import com.ghostchu.peerbanhelper.wrapper.PeerAddress;
-import com.j256.ormlite.stmt.SelectArg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -54,9 +53,9 @@ private void cleanup() {
builder.setWhere(builder
.where()
.le("banAt",
- new SelectArg(new Timestamp(LocalDateTime.now().minusDays(keepDays)
+ new Timestamp(LocalDateTime.now().minusDays(keepDays)
.toInstant(MiscUtil.getSystemZoneOffset())
- .toEpochMilli()))));
+ .toEpochMilli())));
log.info(tlUI(Lang.CLEANED_BANLOGS, builder.delete()));
} catch (Exception e) {
log.error("Unable to cleanup expired banlogs", e);
diff --git a/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/ActiveMonitoringModule.java b/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/ActiveMonitoringModule.java
index 184428eba9..458130b9b7 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/ActiveMonitoringModule.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/ActiveMonitoringModule.java
@@ -18,7 +18,6 @@
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.eventbus.Subscribe;
-import com.j256.ormlite.stmt.SelectArg;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
@@ -191,7 +190,7 @@ private void cleanup() {
try {
var deleteBuilder = peerRecordDao.deleteBuilder();
var where = deleteBuilder.where()
- .lt("lastTimeSeen", new SelectArg(dataRetentionTime));
+ .lt("lastTimeSeen", dataRetentionTime);
deleteBuilder.setWhere(where);
int deleted = deleteBuilder.delete();
log.info(tlUI(Lang.AMM_CLEANED_UP, deleted));
diff --git a/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHChartController.java b/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHChartController.java
index 163f5cfba7..26ede1d397 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHChartController.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHChartController.java
@@ -86,7 +86,9 @@ private void handleTraffic(Context ctx) throws Exception {
private void handleTrafficClassic(Context ctx) throws Exception {
var timeQueryModel = WebUtil.parseTimeQueryModel(ctx);
String downloader = ctx.queryParam("downloader");
- var records = trafficJournalDao.getDayOffsetData(downloader, timeQueryModel.startAt(), timeQueryModel.endAt(), d -> fixTimezone(ctx, d));
+ var records = trafficJournalDao.getDayOffsetData(downloader,
+ timeQueryModel.startAt(),
+ timeQueryModel.endAt(), d -> fixTimezone(ctx, d));
ctx.json(new StdResp(true, null, records));
}
@@ -106,18 +108,18 @@ private void handlePeerTrends(Context ctx) throws Exception {
var queryConnected = peerRecordDao.queryBuilder()
.selectColumns("id", "lastTimeSeen")
.where()
- .ge("lastTimeSeen", new SelectArg(timeQueryModel.startAt()))
+ .ge("lastTimeSeen", timeQueryModel.startAt())
.and()
- .le("lastTimeSeen", new SelectArg(timeQueryModel.endAt()));
+ .le("lastTimeSeen", timeQueryModel.endAt());
var queryBanned = historyDao.queryBuilder()
.selectColumns("id", "banAt")
.where()
- .ge("banAt", new SelectArg(timeQueryModel.startAt()))
+ .ge("banAt", timeQueryModel.startAt())
.and()
- .le("banAt", new SelectArg(timeQueryModel.endAt()));
+ .le("banAt", timeQueryModel.endAt());
if (downloader != null && !downloader.isBlank()) {
queryConnected.and().eq("downloader", new SelectArg(downloader));
- queryBanned.and().eq("downloader", new SelectArg( downloader));
+ queryBanned.and().eq("downloader", new SelectArg(downloader));
}
try (var it = queryConnected.iterator()) {
while (it.hasNext()) {
@@ -161,16 +163,16 @@ private void handleGeoIP(Context ctx) throws Exception {
.distinct()
.selectColumns("id", "ip")
.where()
- .ge("banAt", new SelectArg(timeQueryModel.startAt()))
+ .ge("banAt", timeQueryModel.startAt())
.and()
- .le("banAt", new SelectArg(timeQueryModel.endAt()));
+ .le("banAt", timeQueryModel.endAt());
var queryConnected = peerRecordDao.queryBuilder()
.distinct()
.selectColumns("id", "address")
.where()
- .ge("lastTimeSeen", new SelectArg(timeQueryModel.startAt()))
+ .ge("lastTimeSeen", timeQueryModel.startAt())
.and()
- .le("lastTimeSeen", new SelectArg(timeQueryModel.endAt()));
+ .le("lastTimeSeen", timeQueryModel.endAt());
if (downloader != null && !downloader.isBlank()) {
queryBanned.and().eq("downloader", new SelectArg(downloader));
queryConnected.and().eq("downloader", new SelectArg(downloader));
@@ -183,6 +185,7 @@ private void handleGeoIP(Context ctx) throws Exception {
public boolean hasNext() {
return bannedOnly ? itBanned.hasNext() : itConnected.hasNext();
}
+
@Override
public String next() {
return bannedOnly ? itBanned.next().getIp() : itConnected.next().getAddress();
diff --git a/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHMetricsController.java b/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHMetricsController.java
index 14a4c80a1a..328676b8c8 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHMetricsController.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHMetricsController.java
@@ -60,9 +60,9 @@ private void handleBanTrends(Context ctx) throws Exception {
var queryBanned = historyDao.queryBuilder()
.selectColumns("id", "banAt")
.where()
- .ge("banAt", new SelectArg(timeQueryModel.startAt()))
+ .ge("banAt", timeQueryModel.startAt())
.and()
- .le("banAt", new SelectArg(timeQueryModel.endAt()));
+ .le("banAt", timeQueryModel.endAt());
if (downloader != null && !downloader.isBlank()) {
queryBanned.and().eq("downloader", new SelectArg(downloader));
}
@@ -73,9 +73,9 @@ private void handleBanTrends(Context ctx) throws Exception {
}
}
ctx.json(new StdResp(true, null, bannedPeerTrends.entrySet().stream()
- .map((e) -> new PBHChartController.SimpleLongIntKV(e.getKey(), e.getValue().intValue()))
- .sorted(Comparator.comparingLong(PBHChartController.SimpleLongIntKV::key))
- .toList()
+ .map((e) -> new PBHChartController.SimpleLongIntKV(e.getKey(), e.getValue().intValue()))
+ .sorted(Comparator.comparingLong(PBHChartController.SimpleLongIntKV::key))
+ .toList()
));
}
@@ -87,8 +87,8 @@ private void handleHistoryDateAccess(Context ctx) throws Exception {
if (field == null) {
throw new IllegalArgumentException("startAt cannot be null");
}
- if(field.equalsIgnoreCase("banAt")){
- if("day".equals(type)){
+ if (field.equalsIgnoreCase("banAt")) {
+ if ("day".equals(type)) {
// 劫持单独处理以加快首屏请求
handlePeerBans(ctx);
return;
@@ -176,7 +176,7 @@ private void handleHistoryNumberAccess(Context ctx) throws Exception {
double filter = Double.parseDouble(Objects.requireNonNullElse(ctx.queryParam("filter"), "0.0"));
String downloader = ctx.queryParam("downloader");
Integer substringLength = null;
- if("peerId".equalsIgnoreCase(field)){
+ if ("peerId".equalsIgnoreCase(field)) {
substringLength = 8;
}
List results = switch (type) {
@@ -194,16 +194,16 @@ private void handlePeerBans(Context ctx) throws Exception {
try (var it = historyDao.queryBuilder()
.selectColumns("id", "banAt")
.where()
- .ge("banAt", new SelectArg(timeQueryModel.startAt()))
+ .ge("banAt", timeQueryModel.startAt())
.and()
- .le("banAt", new SelectArg(timeQueryModel.endAt()))
+ .le("banAt", timeQueryModel.endAt())
.iterator()) {
while (it.hasNext()) {
var startOfDay = MiscUtil.getStartOfToday(it.next().getBanAt().getTime());
bannedPeerTrends.computeIfAbsent(startOfDay, k -> new AtomicInteger()).addAndGet(1);
}
}
- ctx.json(new StdResp(true, null, bannedPeerTrends.entrySet().stream().map((e)-> new HistoryDao.UniversalFieldDateResult(e.getKey(), e.getValue().intValue() , 0)).toList()));
+ ctx.json(new StdResp(true, null, bannedPeerTrends.entrySet().stream().map((e) -> new HistoryDao.UniversalFieldDateResult(e.getKey(), e.getValue().intValue(), 0)).toList()));
}
private void handleBasicCounter(Context ctx) {
diff --git a/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHTorrentController.java b/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHTorrentController.java
index 806a8aa5f0..4e3c6938f5 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHTorrentController.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHTorrentController.java
@@ -112,12 +112,12 @@ private void handleTorrentQuery(Context ctx) throws SQLException {
for (TorrentEntity result : torrentEntityPage.getResults()) {
var peerBanCount = historyDao.queryBuilder()
.where()
- .eq("torrent_id", new SelectArg(result.getId()))
+ .eq("torrent_id", result.getId())
.countOf();
var peerAccessCount = peerRecordDao.queryBuilder()
.orderBy("lastTimeSeen", false)
.where()
- .eq("torrent_id", new SelectArg(result.getId()))
+ .eq("torrent_id", result.getId())
.countOf();
infoList.add(new TorrentInfo(result.getInfoHash(), result.getName(), result.getSize(), peerBanCount, peerAccessCount));
}
@@ -135,12 +135,12 @@ private void handleTorrentInfo(Context ctx) throws SQLException {
var t = torrent.get();
var peerBanCount = historyDao.queryBuilder()
.where()
- .eq("torrent_id", new SelectArg(t.getId()))
+ .eq("torrent_id",t.getId())
.countOf();
var peerAccessCount = peerRecordDao.queryBuilder()
.orderBy("lastTimeSeen", false)
.where()
- .eq("torrent_id", new SelectArg(t.getId()))
+ .eq("torrent_id", t.getId())
.countOf();
ctx.json(new StdResp(true, null, new TorrentInfo(t.getInfoHash(),
@@ -158,7 +158,7 @@ private void handleConnectHistory(Context ctx) throws SQLException {
Pageable pageable = new Pageable(ctx);
var t = torrent.get();
var queryBuilder = peerRecordDao.queryBuilder().orderBy("lastTimeSeen", false);
- var queryWhere = queryBuilder.where().eq("torrent_id", new SelectArg(t));
+ var queryWhere = queryBuilder.where().eq("torrent_id", t);
queryBuilder.setWhere(queryWhere);
Page page = peerRecordDao.queryByPaging(queryBuilder, pageable);
ctx.json(new StdResp(true, null, page));
diff --git a/src/main/java/com/ghostchu/peerbanhelper/text/TextManager.java b/src/main/java/com/ghostchu/peerbanhelper/text/TextManager.java
index 804842d442..affb38483e 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/text/TextManager.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/text/TextManager.java
@@ -135,8 +135,6 @@ public void load() {
// second, load the bundled language files
loadBundled().forEach(languageFilesManager::deploy);
// then, load the translations from Crowdin
- // and don't forget fix missing
- languageFilesManager.fillMissing(loadBuiltInFallback());
// finally, load override translations
Collection pending = getOverrideLocales(languageFilesManager.getDistributions().keySet());
log.debug("Pending: {}", Arrays.toString(pending.toArray()));
@@ -172,6 +170,7 @@ public void load() {
pending.add("en_us");
this.languageFilesManager.deploy("en_us", loadBuiltInFallback());
}
+ this.languageFilesManager.fillMissing( loadBuiltInFallback());
// Remember all available languages
availableLanguages.addAll(pending);
diff --git a/src/main/java/com/ghostchu/peerbanhelper/util/HTTPUtil.java b/src/main/java/com/ghostchu/peerbanhelper/util/HTTPUtil.java
index 0b6302b700..f44e95f9d1 100644
--- a/src/main/java/com/ghostchu/peerbanhelper/util/HTTPUtil.java
+++ b/src/main/java/com/ghostchu/peerbanhelper/util/HTTPUtil.java
@@ -89,7 +89,6 @@ public static HttpClient getHttpClient(boolean ignoreSSL, ProxySelector proxySel
Methanol.Builder builder = Methanol
.newBuilder()
.followRedirects(HttpClient.Redirect.ALWAYS)
- .defaultHeader("Accept-Encoding", "gzip,deflate")
.connectTimeout(Duration.of(10, ChronoUnit.SECONDS))
.headersTimeout(Duration.of(15, ChronoUnit.SECONDS))
.readTimeout(Duration.of(30, ChronoUnit.SECONDS))
diff --git a/src/main/java/cordelia/client/TrClient.java b/src/main/java/cordelia/client/TrClient.java
index 19340291a5..eb02c7db06 100644
--- a/src/main/java/cordelia/client/TrClient.java
+++ b/src/main/java/cordelia/client/TrClient.java
@@ -65,7 +65,7 @@ public TrClient(String url, String user, String password, boolean verifySSL, Htt
.newBuilder()
.version(httpVersion)
.followRedirects(HttpClient.Redirect.ALWAYS)
- .defaultHeader("Accept-Encoding", "gzip,deflate")
+
.connectTimeout(Duration.of(10, ChronoUnit.SECONDS))
.headersTimeout(Duration.of(10, ChronoUnit.SECONDS))
.readTimeout(Duration.of(15, ChronoUnit.SECONDS))
diff --git a/src/main/java/raccoonfink/deluge/DelugeServer.java b/src/main/java/raccoonfink/deluge/DelugeServer.java
index 3f46562aa9..6874ab9e8d 100644
--- a/src/main/java/raccoonfink/deluge/DelugeServer.java
+++ b/src/main/java/raccoonfink/deluge/DelugeServer.java
@@ -41,13 +41,12 @@ public DelugeServer(final String url, final String password, boolean verifySSL,
.newBuilder()
.version(httpVersion)
.followRedirects(HttpClient.Redirect.ALWAYS)
+ .defaultHeader("Accept", "application/json")
+ .defaultHeader("Content-Type", "application/json")
+ .requestTimeout(Duration.of(15, ChronoUnit.SECONDS))
.connectTimeout(Duration.of(10, ChronoUnit.SECONDS))
.headersTimeout(Duration.of(10, ChronoUnit.SECONDS))
.readTimeout(Duration.of(15, ChronoUnit.SECONDS))
- .requestTimeout(Duration.of(15, ChronoUnit.SECONDS))
- .defaultHeader("Accept", "application/json")
- .defaultHeader("Accept-Encoding", "gzip,deflate")
- .defaultHeader("Content-Type", "application/json")
.authenticator(new Authenticator() {
@Override
public PasswordAuthentication requestPasswordAuthenticationInstance(String host, InetAddress addr, int port, String protocol, String prompt, String scheme, URL url, RequestorType reqType) {