Skip to content

Commit

Permalink
添加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Jan 6, 2025
1 parent d561ba9 commit 0e1af18
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.ghostchu.btn.sparkle.module.githubupdate;

import com.ghostchu.btn.sparkle.module.analyse.AnalyseService;
import com.ghostchu.btn.sparkle.module.analyse.impl.AnalysedRule;
import com.ghostchu.btn.sparkle.module.banhistory.BanHistoryService;
import com.ghostchu.btn.sparkle.module.banhistory.internal.BanHistoryRepository;
import com.ghostchu.btn.sparkle.util.IPUtil;
Expand Down Expand Up @@ -65,13 +64,19 @@ public void githubRuleUpdate() throws IOException, InterruptedException {

private String generateTrackerHighRiskIps() {
var strJoiner = new StringJoiner("\n");
analyseService.getTrackerHighRisk().forEach(r -> strJoiner.add(r.getIp()));
analyseService.getTrackerHighRisk().forEach(r -> {
strJoiner.add("# " + r.getComment());
strJoiner.add(r.getIp());
});
return strJoiner.toString();
}

private String generateUntrustedIps() {
var strJoiner = new StringJoiner("\n");
analyseService.getUntrustedIPAddresses().forEach(r -> strJoiner.add(r.getIp()));
analyseService.getUntrustedIPAddresses().forEach(r -> {
strJoiner.add("# " + r.getComment());
strJoiner.add(r.getIp());
});
return strJoiner.toString();
}

Expand All @@ -91,7 +96,10 @@ private String generateUntrustedIps() {

private String generateHighRiskIps() {
var strJoiner = new StringJoiner("\n");
analyseService.getHighRiskIps().forEach(r -> strJoiner.add(r.getIp()));
analyseService.getHighRiskIps().forEach(r -> {
strJoiner.add("# " + r.getComment());
strJoiner.add(r.getIp());
});
return strJoiner.toString();
}

Expand Down Expand Up @@ -207,7 +215,12 @@ private void updateFile(GHRepository repository, String file, Supplier<byte[]> c


private String generateOverDownloadIps() {
return String.join("\n", analyseService.getOverDownloadIPAddresses().stream().map(AnalysedRule::getIp).toList());
var strJoiner = new StringJoiner("\n");
analyseService.getOverDownloadIPAddresses().forEach(r -> {
strJoiner.add("# " + r.getComment());
strJoiner.add(r.getIp());
});
return strJoiner.toString();
}

private OffsetDateTime nowTimestamp() {
Expand Down

0 comments on commit 0e1af18

Please sign in to comment.