Skip to content

Commit acda442

Browse files
authored
Merge pull request #904 from PBH-BTN/master
v7.3.2
2 parents d1e411f + 2512963 commit acda442

File tree

14 files changed

+98
-32
lines changed

14 files changed

+98
-32
lines changed

.github/workflows/jvm-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
type=raw,ci
6464
type=sha
6565
- name: Build and push Docker image
66-
uses: docker/build-push-action@v6.10.0
66+
uses: docker/build-push-action@v6.11.0
6767
with:
6868
context: .
6969
file: ./Dockerfile
@@ -98,7 +98,7 @@ jobs:
9898
type=raw,ci
9999
type=sha
100100
- name: Build and push Docker image
101-
uses: docker/build-push-action@v6.10.0
101+
uses: docker/build-push-action@v6.11.0
102102
with:
103103
context: .
104104
file: ./Dockerfile

.github/workflows/jvm-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ jobs:
159159
type=raw,latest
160160
type=sha
161161
- name: Build and push Docker image
162-
uses: docker/build-push-action@v6.10.0
162+
uses: docker/build-push-action@v6.11.0
163163
with:
164164
context: .
165165
file: ./Dockerfile
@@ -195,7 +195,7 @@ jobs:
195195
type=raw,latest
196196
type=sha
197197
- name: Build and push Aliyun ACR
198-
uses: docker/build-push-action@v6.10.0
198+
uses: docker/build-push-action@v6.11.0
199199
with:
200200
context: .
201201
file: ./Dockerfile-Release

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ dependency-reduced-pom.xml
5151
PeerBanHelper.jar
5252
*.pkg
5353
install4j/output
54+
install4j/project.install4j~

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.ghostchu.peerbanhelper</groupId>
88
<artifactId>peerbanhelper</artifactId>
9-
<version>7.3.1</version>
9+
<version>7.3.2</version>
1010
<packaging>jar</packaging>
1111

1212
<name>PeerBanHelper</name>
@@ -258,7 +258,7 @@
258258
<dependency>
259259
<groupId>org.bspfsystems</groupId>
260260
<artifactId>yamlconfiguration</artifactId>
261-
<version>3.0.1</version>
261+
<version>3.0.2</version>
262262
<scope>compile</scope>
263263
</dependency>
264264
<dependency>
@@ -398,7 +398,7 @@
398398
<dependency>
399399
<groupId>org.apache.james</groupId>
400400
<artifactId>apache-mime4j-dom</artifactId>
401-
<version>0.8.11</version>
401+
<version>0.8.12</version>
402402
<exclusions>
403403
<exclusion>
404404
<artifactId>commons-io</artifactId>
@@ -409,7 +409,7 @@
409409
<dependency>
410410
<groupId>org.apache.james</groupId>
411411
<artifactId>apache-mime4j-core</artifactId>
412-
<version>0.8.11</version>
412+
<version>0.8.12</version>
413413
<exclusions>
414414
<exclusion>
415415
<artifactId>commons-io</artifactId>
@@ -420,7 +420,7 @@
420420
<dependency>
421421
<groupId>org.apache.james</groupId>
422422
<artifactId>apache-mime4j-storage</artifactId>
423-
<version>0.8.11</version>
423+
<version>0.8.12</version>
424424
<exclusions>
425425
<exclusion>
426426
<artifactId>commons-io</artifactId>

src/main/java/com/ghostchu/peerbanhelper/PeerBanHelperServer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ private void runTestCode() {
201201
return;
202202
}
203203
// run some junky test code here
204+
// ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory
205+
// .getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
206+
// root.setLevel(ch.qos.logback.classic.Level.TRACE);
207+
204208
}
205209

206210

src/main/java/com/ghostchu/peerbanhelper/database/DatabaseHelper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ private void performUpgrade() throws SQLException {
7575
TableUtils.createTableIfNotExists(database.getDataSource(), AlertEntity.class);
7676
v = 7;
7777
}
78+
if (v == 7) {
79+
TableUtils.dropTable(getDataSource(), AlertEntity.class, true);
80+
TableUtils.createTableIfNotExists(database.getDataSource(), AlertEntity.class);
81+
v = 8;
82+
}
7883
version.setValue(String.valueOf(v));
7984
metadata.update(version);
8085
}

src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/HistoryDao.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ public Page<PeerBanCount> getBannedIps(Pageable pageable, String filter) throws
4444
.selectRaw("ip, COUNT(*) AS count")
4545
.groupBy("ip")
4646
.orderByRaw("count DESC");
47+
String[] args = new String[0];
4748
if (filter != null) {
48-
builder.setWhere(builder.where().like("ip", new SelectArg(filter + "%")));
49+
builder.setWhere(builder.where().like("ip", new SelectArg()));
50+
args = new String[]{filter + "%"};
4951
}
50-
List<PeerBanCount> mapped;
51-
try (GenericRawResults<String[]> banLogs = builder
52+
var queryBuilder = builder
5253
.limit(pageable.getSize())
53-
.offset(pageable.getZeroBasedPage() * pageable.getSize())
54-
// .where().ge("banAt", twoWeeksAgo)
55-
.queryRaw()) {
54+
.offset(pageable.getZeroBasedPage() * pageable.getSize());
55+
List<PeerBanCount> mapped;
56+
try (GenericRawResults<String[]> banLogs = queryRaw(queryBuilder.prepareStatementString(), args)) {
5657
var results = banLogs.getResults();
5758
mapped = results.stream().map(arr -> new PeerBanCount(arr[0], Long.parseLong(arr[1]))).toList();
5859
}

src/main/java/com/ghostchu/peerbanhelper/database/table/AlertEntity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.ghostchu.peerbanhelper.database.table;
22

33
import com.ghostchu.peerbanhelper.alert.AlertLevel;
4+
import com.ghostchu.peerbanhelper.database.TranslationComponentPersistener;
45
import com.ghostchu.peerbanhelper.text.TranslationComponent;
5-
import com.j256.ormlite.field.DataType;
66
import com.j256.ormlite.field.DatabaseField;
77
import com.j256.ormlite.table.DatabaseTable;
88
import lombok.AllArgsConstructor;
@@ -26,8 +26,8 @@ public final class AlertEntity {
2626
private AlertLevel level;
2727
@DatabaseField(canBeNull = false, index = true)
2828
private String identifier;
29-
@DatabaseField(canBeNull = false, dataType = DataType.SERIALIZABLE)
29+
@DatabaseField(canBeNull = false, persisterClass = TranslationComponentPersistener.class)
3030
private TranslationComponent title;
31-
@DatabaseField(canBeNull = false, dataType = DataType.SERIALIZABLE)
31+
@DatabaseField(canBeNull = false, persisterClass = TranslationComponentPersistener.class)
3232
private TranslationComponent content;
3333
}

src/main/java/com/ghostchu/peerbanhelper/downloader/impl/qbittorrent/AbstractQbittorrent.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ public boolean isLoggedIn() {
162162
}
163163
return !info.getQt().isBlank();
164164
} catch (Exception e) {
165-
log.error("Failed to check login status", e);
166165
return false;
167166
}
168167
}

src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PBHPeerController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private void handleInfo(Context ctx) throws SQLException {
153153

154154

155155
private void handleBanHistory(Context ctx) throws SQLException {
156-
String ip = IPAddressUtil.getIPAddress(ctx.pathParam("ip")).toString();
156+
String ip = IPAddressUtil.getIPAddress(ctx.pathParam("ip")).toNormalizedString();
157157
Pageable pageable = new Pageable(ctx);
158158
var builder = historyDao.queryBuilder()
159159
.orderBy("banAt", false);
@@ -168,7 +168,7 @@ private void handleBanHistory(Context ctx) throws SQLException {
168168

169169
private void handleAccessHistory(Context ctx) throws SQLException {
170170
activeMonitoringModule.flush();
171-
String ip = IPAddressUtil.getIPAddress(ctx.pathParam("ip")).toString();
171+
String ip = IPAddressUtil.getIPAddress(ctx.pathParam("ip")).toNormalizedString();
172172
Pageable pageable = new Pageable(ctx);
173173
var builder = peerRecordDao.queryBuilder()
174174
.orderBy("lastTimeSeen", false);

0 commit comments

Comments
 (0)