import React from "react"; import { RequestCluster } from "../request-cluster"; import { Classifications, Sources } from "../stolen-data-entry"; const emailClassifications: Record = { id: "sztucznie nadane mi ID", history: "część mojej historii przeglądania", location: "informacje na temat mojej lokalizacji geograficznej", }; const emailSources: Record = { header: "w nagłówku HTTP", cookie: "z pliku Cookie", pathname: "jako części adresu URL", queryparams: "jako część adresu URL (query-params)", }; const source_priority: Array = [ "cookie", "pathname", "queryparams", "header", ]; export default function DomainSummary({ cluster, }: { cluster: RequestCluster; }) { return (
  • Właściciel domeny {cluster.id} otrzymał:{" "}
    • Mój adres IP
    • {cluster .getMarks() .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},{" "} {mark.key ? ( <> pozycja {mark.key}, ) : ( "" )} wartość: {mark.valuePreview})
    • ))}
  • ); }