fix(statistics): preserve private account history safely
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { defaultSettings } from "../src/main/constants";
|
||||
import { buildAccountSummary } from "../src/main/support-data";
|
||||
import { buildAccountSummary, buildStatsPayload } from "../src/main/support-data";
|
||||
import { serializeRealDebridApiAccounts } from "../src/shared/real-debrid-accounts";
|
||||
import { createVisualFixture } from "./visual/fixtures";
|
||||
|
||||
describe("Real-Debrid support summary", () => {
|
||||
it("reports pool counts without exposing account IDs or credentials", () => {
|
||||
@@ -29,4 +30,27 @@ describe("Real-Debrid support summary", () => {
|
||||
expect(serialized).not.toContain("rdw_private");
|
||||
expect(serialized).not.toContain("secret-");
|
||||
});
|
||||
|
||||
it("removes rolling account IDs and labels from support statistics", () => {
|
||||
const snapshot = structuredClone(createVisualFixture("empty").snapshot);
|
||||
snapshot.stats.rolling24Hours = {
|
||||
from: 1,
|
||||
to: 2,
|
||||
downloadedBytes: 4_096,
|
||||
accounts: [{
|
||||
id: "rdw_private_account",
|
||||
provider: "realdebrid",
|
||||
label: "private-user@example.test",
|
||||
bytes: 4_096
|
||||
}]
|
||||
};
|
||||
|
||||
const payload = buildStatsPayload(snapshot);
|
||||
const serialized = JSON.stringify(payload);
|
||||
|
||||
expect(serialized).not.toContain("rdw_private_account");
|
||||
expect(serialized).not.toContain("private-user@example.test");
|
||||
expect(serialized).toContain("realdebrid");
|
||||
expect(serialized).toContain("4096");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user