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)",
|
|
|
|
};
|
|
|
|
|
2021-11-21 22:38:32 +01:00
|
|
|
const source_priority: Array<Sources> = [
|
|
|
|
"cookie",
|
|
|
|
"pathname",
|
|
|
|
"queryparams",
|
|
|
|
"header",
|
|
|
|
];
|
|
|
|
|
2021-11-08 20:14:28 +01:00
|
|
|
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
|
2021-11-21 18:21:31 +01:00
|
|
|
.getMarks()
|
2021-11-21 22:38:32 +01:00
|
|
|
.sort((markA, markB) => {
|
|
|
|
if (markA.entry.value > markB.entry.value) {
|
|
|
|
return -1;
|
2021-11-21 23:14:33 +01:00
|
|
|
} else if (markA.entry.value < markB.entry.value) {
|
2021-11-21 22:38:32 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
})
|
2021-11-21 18:21:31 +01:00
|
|
|
.map((mark) => (
|
2021-11-08 20:14:28 +01:00
|
|
|
<li>
|
2021-11-21 18:21:31 +01:00
|
|
|
{emailClassifications[mark.classification]}{" "}
|
2021-11-21 22:38:32 +01:00
|
|
|
{emailSources[mark.source]} (nazwa: <code>{mark.name}</code>,{" "}
|
2021-11-21 18:21:31 +01:00
|
|
|
{mark.key ? (
|
|
|
|
<>
|
|
|
|
pozycja <code>{mark.key}</code>,
|
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
""
|
|
|
|
)}
|
|
|
|
wartość: <code>{mark.valuePreview}</code>)
|
2021-11-08 20:14:28 +01:00
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}
|