rentgen/sidebar/stolen-data.tsx

81 lines
2.0 KiB
TypeScript
Raw Normal View History

2021-11-07 09:17:19 +01:00
import React from "react";
2021-11-07 13:01:01 +01:00
import { RequestCluster } from "../request-cluster";
import StolenDataCluster from "./stolen-data-cluster";
2021-11-07 13:57:24 +01:00
import { getMemory, getshorthost } from "../util";
2021-11-07 09:17:19 +01:00
export function StolenData({
origin,
minValueLength,
refreshToken,
refresh,
2021-11-07 09:17:19 +01:00
cookiesOnly,
}: {
origin: string;
refreshToken: number;
refresh: () => void;
2021-11-07 09:17:19 +01:00
minValueLength: number;
cookiesOnly: boolean;
}) {
if (!origin) {
return <div></div>;
}
2021-11-07 13:57:24 +01:00
const clusters = Object.values(getMemory().getClustersForOrigin(origin)).sort(
2021-11-07 09:17:19 +01:00
RequestCluster.sortCompare
);
return (
<div style={{ padding: "5px" }}>
{" "}
<div>
<h1>
{origin}
<button
style={{ marginLeft: "1rem" }}
onClick={() =>
2021-11-07 13:57:24 +01:00
getMemory().removeCookiesFor(
2021-11-07 09:17:19 +01:00
origin,
getshorthost(new URL(origin).host)
)
}
>
Wyczyść cookiesy 1st party
</button>
<button
style={{ marginLeft: "1rem" }}
onClick={() => {
2021-11-07 13:57:24 +01:00
getMemory().removeRequestsFor(origin);
refresh();
}}
2021-11-07 09:17:19 +01:00
>
Wyczyść pamięć
</button>
2021-11-07 13:57:24 +01:00
<button
onClick={() =>
window.open(
2021-11-07 15:45:26 +01:00
`/report-window/report-window.html?origin=${origin}`,
2021-11-07 13:57:24 +01:00
"new_window",
"width=800,height=600"
)
}
>
Generuj maila
</button>
2021-11-07 09:17:19 +01:00
</h1>
{clusters
.filter((cluster) => !cookiesOnly || cluster.hasCookies())
.map((cluster) => {
return (
<StolenDataCluster
2021-11-07 09:17:19 +01:00
origin={origin}
shorthost={cluster.id}
key={cluster.id + origin}
refreshToken={refreshToken}
minValueLength={minValueLength}
cookiesOnly={cookiesOnly}
/>
);
})}
</div>
</div>
);
}