diff --git a/memory.ts b/memory.ts index 95cbfb6..f6da3e4 100644 --- a/memory.ts +++ b/memory.ts @@ -8,7 +8,7 @@ export default class Memory extends EventEmitter { private throttle = makeThrottle(200); async register(request: ExtendedRequest) { await request.init(); - console.log("registering request for", request.origin); + // console.log("registering request for", request.origin); if (!request.isThirdParty()) { return; } diff --git a/report-window/domain-summary.tsx b/report-window/domain-summary.tsx index 274519a..e44ee4f 100644 --- a/report-window/domain-summary.tsx +++ b/report-window/domain-summary.tsx @@ -15,6 +15,13 @@ const emailSources: Record = { queryparams: "jako część adresu URL (query-params)", }; +const source_priority: Array = [ + "cookie", + "pathname", + "queryparams", + "header", +]; + export default function DomainSummary({ cluster, }: { @@ -27,13 +34,37 @@ export default function DomainSummary({
  • Mój adres IP
  • {cluster .getMarks() - .sort((markA, markB) => - markA.entry.value > markB.entry.value ? -1 : 1 - ) + .sort((markA, markB) => { + if (markA.entry.value > markB.entry.value) { + return -1; + } else if (markA.entry.value > markB.entry.value) { + return 1; + } else { + const indexA = source_priority.indexOf(markA.source); + const indexB = source_priority.indexOf(markB.source); + if (indexA < indexB) { + return -1; + } else if (indexA > indexB) { + return 1; + } else { + return markA.name > markB.name ? -1 : 1; + } + } + }) + .filter((_, index, array) => { + if (index == 0) { + return true; + } + if (array[index].valuePreview === array[index - 1].valuePreview) { + return false; + } else { + return true; + } + }) .map((mark) => (
  • {emailClassifications[mark.classification]}{" "} - {emailSources[mark.source]} (nazwa: {mark.name},{" "} + {emailSources[mark.source]} (nazwa: {mark.name},{" "} {mark.key ? ( <> pozycja {mark.key}, diff --git a/report-window/report-window.tsx b/report-window/report-window.tsx index 3d76534..5a96be6 100644 --- a/report-window/report-window.tsx +++ b/report-window/report-window.tsx @@ -59,7 +59,7 @@ function Report() { > {mark.valuePreview} {/* always gonna have - one key, because unwrapEntry is calle above */} + one key, because unwrapEntry is called above */}