import React, { Fragment } from 'react'; import { RequestCluster } from '../../request-cluster'; import './screenshot-generator.scss'; enum taskState { WAITING = 'waiting', RUNNING = 'running', FINISHED = 'finished', } interface screenshotTask { url: string; domains: string[]; id: string; status: taskState; output: string; files: string[]; } function createTaskEndpoint(visited_url: string, domains: string[]) { return `http://65.108.60.135:3000/api/requests?url=${visited_url}${domains.reduce( (prev: string, curr: string) => prev + '&domains[]=' + curr, '' )}`; } function createTask(visited_url: string, domains: string[]) { return fetch(createTaskEndpoint(visited_url, domains), { method: 'POST' }); } function pollTask(path: string): Promise { return fetch(path, { method: 'GET' }); } export default function ScreenshotGenerator({ visited_url, clusters, setReportWindowMode, }: { visited_url: string; clusters: Record; setReportWindowMode: Function; }) { const [mode, setMode] = React.useState('idle'); const [images, setImages] = React.useState([]); const [taskId, setTaskId] = React.useState(null); async function subscribeTask(path: string): Promise { let response = { status: taskState.WAITING }; while (response.status === taskState.WAITING || response.status === taskState.RUNNING) { await new Promise((resolve) => setTimeout(resolve, 1000)); response = await (await pollTask(path)).json(); setImages((response as screenshotTask)?.files); } if (response.status === taskState.FINISHED) { setMode('finished'); } return response as screenshotTask; } function downloadFiles() { const urls = images.map((el) => `http://65.108.60.135:3000/static/${taskId}/${el}`); for (const url of urls) { let a = document.createElement('a'); a.setAttribute('href', url); a.setAttribute('download', ''); a.setAttribute('target', '_blank'); a.click(); } setReportWindowMode('preview'); } return (
{mode === 'idle' ? (

Przygotowanie zrzutów ekranów

Notka informacyjna

Dla potwierdzenia przechwyconych danych, warto załączyć zrzuty ekranów narzędzi deweloperskich do maila dla administratora oraz Urzędu Ochrony Danych Osobowych.

Jeżeli nie wiesz jak wykonać zrzuty ekranów, skorzystaj z{' '} naszej instrukcji lub wtyczka Rentgen może wygenerować je za Ciebie.

) : null} {mode === 'in_progress' || mode === 'finished' ? (

Przygotowujemy zrzuty ekranów

To może chwilkę zająć

Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolore sint laudantium blanditiis aperiam quos expedita voluptatem iure, nam aliquam vel minus aliquid incidunt consequatur illo velit dolorem error exercitationem tempora?

{images.map((filename: string) => { return (
{filename}
· · ·
); })} {mode === 'in_progress' ? (
· · ·
) : null}
{mode === 'finished' ? ( ) : null}
) : null}
); }