import React from "react";
import memory from "./memory";
import { MergedStolenDataEntry, Sources } from "./request-cluster";
import { hyphenate } from "./util";
function StolenDataValueTable({
entry,
prefixKey = "",
}: {
entry: MergedStolenDataEntry;
prefixKey: string;
}) {
return (
{Object.keys(entry.getParsedValues(prefixKey)[0]).map((key) => (
{hyphenate(key)} |
|
))}
);
}
function StolenDataValue({
entry,
prefixKey = "",
}: {
entry: MergedStolenDataEntry;
prefixKey?: string;
}) {
const value = entry.getParsedValues(prefixKey)[0];
if (!value) {
return <>>;
}
if (typeof value === "string") {
return <>{entry.getParsedValues(prefixKey)[0] as string}>;
}
return ;
}
export default function StolenDataCluster({
origin,
shorthost,
minValueLength,
cookiesOnly,
}: {
origin: string;
shorthost: string;
refreshToken: number;
minValueLength: number;
cookiesOnly: boolean;
}) {
const cluster = memory.getClustersForOrigin(origin)[shorthost];
const icons: Record = {
cookie: "🍪",
pathname: "🛣",
queryparams: "🅿",
header: "H",
};
return (
{cluster
.getStolenData({ minValueLength, cookiesOnly })
.map((entry) => (
{entry.getNames().map(hyphenate).join(", ")}
|
{entry.getSources().map((source) => icons[source])} |
|
))}
);
}