import React from 'react'; import { getMemory } from '../../memory'; import { StolenDataEntry } from '../../stolen-data-entry'; import { maskString, useEmitter } from '../../util'; import './stolen-data-cluster.scss'; const MAX_STRING_VALUE_LENGTH = 100; function StolenDataValue({ entry }: { entry: StolenDataEntry; prefixKey?: string }) { const [version] = useEmitter(entry); let body = null; if (!entry.value) { body = <>; } else { body =
{entry.value}
; } return ( { entry.toggleMark(); getMemory().emit('change', entry.request.shorthost); e.stopPropagation(); }} title={entry.value} > {body} ); } function StolenDataRow({ entry }: { entry: StolenDataEntry }) { const [version] = useEmitter(entry); return ( { entry.toggleMark(); getMemory().emit('change', entry.request.shorthost); }} /> {entry.source === 'cookie' ? ( ) : entry.request.hasCookie() ? ( ) : null} {entry.exposesOrigin() ? ( ) : entry.request.exposesOrigin() ? ( ) : null} ); } export default function StolenDataCluster({ origin, shorthost, minValueLength, cookiesOnly, refreshToken, cookiesOrOriginOnly, detailsVisibility, }: { origin: string; shorthost: string; refreshToken: number; minValueLength: number; cookiesOnly: boolean; cookiesOrOriginOnly: boolean; detailsVisibility: boolean; }) { const cluster = getMemory().getClustersForOrigin(origin)[shorthost]; const fullHosts = cluster.getFullHosts(); const [version] = useEmitter(cluster); return (
{ cluster.hasMarks() ? cluster.undoMark() : cluster.autoMark(); getMemory().emit('change', cluster.id); }} /> {cluster.id}
{fullHosts.map((host, index) => ( {host} {`${fullHosts.length - 1 !== index ? '· ' : ''}`} ))}
{detailsVisibility ? (
{cluster .calculateRepresentativeStolenData({ minValueLength, cookiesOnly, cookiesOrOriginOnly, }) .map((entry) => ( ))}
Wysłane dane:
) : null}
); }