import React 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'; import './report-window.scss'; 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() { try { const origin = new URL(document.location.toString()).searchParams.get('origin'); const [counter, setCounter] = useEmitter(getMemory()); const clusters = getMemory().getClustersForOrigin(origin); const [entries, setEntries] = React.useState([]); React.useEffect(() => { setEntries( Object.values(clusters) .map((cluster) => { cluster.calculateRepresentativeStolenData(); return cluster.representativeStolenData; }) .reduce(reduceConcat, []) .filter((entry) => entry.isMarked) ); }, []); if (entries.length == 0) { return <>Wczytywanie...; } const result = (
{/* */}
); return result; } catch (e) { console.error(e); return
ERROR! {JSON.stringify(e)}
; } } ReactDOM.render(, document.getElementById('app'));