2021-11-08 20:14:28 +01:00
|
|
|
import React from "react";
|
|
|
|
import { RequestCluster } from "../request-cluster";
|
|
|
|
import { Classifications, Sources } from "../stolen-data-entry";
|
|
|
|
|
|
|
|
const emailClassifications: Record<keyof typeof Classifications, string> = {
|
|
|
|
id: "sztucznie nadane mi ID",
|
|
|
|
history: "część mojej historii przeglądania",
|
2021-11-11 20:25:06 +01:00
|
|
|
location: "informacje na temat mojej lokalizacji geograficznej",
|
2021-11-08 20:14:28 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const emailSources: Record<Sources, string> = {
|
|
|
|
header: "w nagłówku HTTP",
|
|
|
|
cookie: "z pliku Cookie",
|
|
|
|
pathname: "jako części adresu URL",
|
|
|
|
queryparams: "jako część adresu URL (query-params)",
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function DomainSummary({
|
|
|
|
cluster,
|
|
|
|
}: {
|
|
|
|
cluster: RequestCluster;
|
|
|
|
}) {
|
|
|
|
return (
|
|
|
|
<li>
|
|
|
|
Właściciel domeny <strong>{cluster.id}</strong> otrzymał:{" "}
|
|
|
|
<ul>
|
2021-11-09 17:47:42 +01:00
|
|
|
<li>Mój adres IP</li>
|
2021-11-08 20:14:28 +01:00
|
|
|
{cluster
|
|
|
|
.getMarkedEntries()
|
|
|
|
.sort((entryA, entryB) => (entryA.value > entryB.value ? -1 : 1))
|
|
|
|
.reduce((acc, entry, index, arr) => {
|
|
|
|
if (index === 0) {
|
|
|
|
return [entry];
|
|
|
|
}
|
|
|
|
if (entry.value != arr[index - 1].value) {
|
|
|
|
acc.push(entry);
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}, [])
|
|
|
|
.map((entry) => (
|
|
|
|
<li>
|
|
|
|
{emailClassifications[entry.classification]}{" "}
|
|
|
|
{emailSources[entry.source]}
|
|
|
|
(<code>{entry.name.trim()}</code>)
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}
|