Human readable entry source

This commit is contained in:
Kuba Orlik 2021-11-07 19:19:38 +01:00
parent e989d6d33d
commit 070ac44839

View File

@ -2,7 +2,7 @@ import React, { useState } from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import { getMemory } from "../memory"; import { getMemory } from "../memory";
import { RequestCluster } from "../request-cluster"; import { RequestCluster } from "../request-cluster";
import { Classifications } from "../stolen-data-entry"; import { Classifications, Sources } from "../stolen-data-entry";
import { getDate } from "../util"; import { getDate } from "../util";
const emailClassifications: Record<keyof typeof Classifications, string> = { const emailClassifications: Record<keyof typeof Classifications, string> = {
@ -10,6 +10,13 @@ const emailClassifications: Record<keyof typeof Classifications, string> = {
history: "część mojej historii przeglądania", history: "część mojej historii przeglądania",
}; };
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)",
};
type PopupState = "not_clicked" | "clicked_but_invalid"; type PopupState = "not_clicked" | "clicked_but_invalid";
function DomainSummary({ cluster }: { cluster: RequestCluster }) { function DomainSummary({ cluster }: { cluster: RequestCluster }) {
@ -31,7 +38,8 @@ function DomainSummary({ cluster }: { cluster: RequestCluster }) {
}, []) }, [])
.map((entry) => ( .map((entry) => (
<li> <li>
{emailClassifications[entry.classification]} w {entry.source} {emailClassifications[entry.classification]}{" "}
{emailSources[entry.source]}
&nbsp;(<code>{entry.name.trim()}</code>) &nbsp;(<code>{entry.name.trim()}</code>)
</li> </li>
))} ))}