muaddib-scanner 2.2.18 → 2.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/monitor.js +13 -10
package/package.json
CHANGED
package/src/monitor.js
CHANGED
|
@@ -1148,11 +1148,13 @@ function loadStateRaw() {
|
|
|
1148
1148
|
function buildReportFromDisk() {
|
|
1149
1149
|
const scanData = loadScanStats();
|
|
1150
1150
|
const stateRaw = loadStateRaw();
|
|
1151
|
-
|
|
1152
|
-
const lastDate = stateRaw.lastDailyReportDate || getParisDateString();
|
|
1151
|
+
const lastDate = stateRaw.lastDailyReportDate || null;
|
|
1153
1152
|
|
|
1154
|
-
//
|
|
1155
|
-
|
|
1153
|
+
// If no report ever sent (null), include ALL daily entries (first report = full history).
|
|
1154
|
+
// After first send, lastDailyReportDate is set and subsequent reports show delta only.
|
|
1155
|
+
const sinceDays = lastDate
|
|
1156
|
+
? scanData.daily.filter(d => d.date > lastDate)
|
|
1157
|
+
: scanData.daily;
|
|
1156
1158
|
|
|
1157
1159
|
// Aggregate counters
|
|
1158
1160
|
const agg = { scanned: 0, clean: 0, suspect: 0 };
|
|
@@ -1164,9 +1166,9 @@ function buildReportFromDisk() {
|
|
|
1164
1166
|
|
|
1165
1167
|
// Load detections since last report for top suspects
|
|
1166
1168
|
const detections = loadDetections();
|
|
1167
|
-
const recentDetections =
|
|
1168
|
-
d => d.first_seen_at && d.first_seen_at.slice(0, 10) > lastDate
|
|
1169
|
-
|
|
1169
|
+
const recentDetections = lastDate
|
|
1170
|
+
? detections.detections.filter(d => d.first_seen_at && d.first_seen_at.slice(0, 10) > lastDate)
|
|
1171
|
+
: detections.detections;
|
|
1170
1172
|
|
|
1171
1173
|
const top3 = recentDetections
|
|
1172
1174
|
.slice()
|
|
@@ -1248,10 +1250,11 @@ function getReportStatus() {
|
|
|
1248
1250
|
const stateRaw = loadStateRaw();
|
|
1249
1251
|
const lastDate = stateRaw.lastDailyReportDate || null;
|
|
1250
1252
|
|
|
1251
|
-
// Count packages scanned since last report (
|
|
1253
|
+
// Count packages scanned since last report (all history if never sent)
|
|
1252
1254
|
const scanData = loadScanStats();
|
|
1253
|
-
const
|
|
1254
|
-
|
|
1255
|
+
const sinceDays = lastDate
|
|
1256
|
+
? scanData.daily.filter(d => d.date > lastDate)
|
|
1257
|
+
: scanData.daily;
|
|
1255
1258
|
|
|
1256
1259
|
let scannedSince = 0;
|
|
1257
1260
|
for (const d of sinceDays) {
|