import React, { useEffect, useState } from 'react'; import ReactDOM from 'react-dom'; import { getMemory } from '../memory'; import { Classifications, StolenDataEntry } from '../stolen-data-entry'; import { reduceConcat, useEmitter } from '../util'; import EmailTemplate from './email-template'; import HARConverter from './har-converter'; function DataPreview({ entries, refresh, }: { entries: StolenDataEntry[]; refresh: () => void; }) { // currently not used, maybe scraped entirely in the future return ( {entries.map((entry) => ( ))}
Adres docelowy Źródło danych Treść danych Klasyfikacja
{entry.request.shorthost} {entry.source}:{entry.name} {entry.getValuePreview()} {/* always gonna have one key, because unwrapEntry is called above */}
); } function Report() { console.time('getOrigin'); const origin = new URL(document.location.toString()).searchParams.get( 'origin' ); console.timeEnd('getOrigin'); console.time('useMemory'); const [counter, setCounter] = useEmitter(getMemory()); console.timeEnd('useMemory'); function refresh() { setCounter((c) => c + 1); } console.time('getClustersForOrigin'); const clusters = getMemory().getClustersForOrigin(origin); console.timeEnd('getClustersForOrigin'); const [entries, setEntries] = useState([]); console.time('useEffect report-window'); useEffect(() => { setEntries( Object.values(clusters) .map((cluster) => { cluster.calculateRepresentativeStolenData(); return cluster.representativeStolenData; }) .reduce(reduceConcat, []) .filter((entry) => entry.isMarked) ); }, []); console.timeEnd('useEffect report-window'); if (entries.length == 0) { return <>Wczytywanie...; } console.time('rendering template'); const result = (

Generuj treść maila dla {origin}

); console.timeEnd('rendering template'); return result; } ReactDOM.render(, document.getElementById('app'));