Compare commits
2 Commits
9c1eb31224
...
b1c84b99ac
Author | SHA1 | Date | |
---|---|---|---|
|
b1c84b99ac | ||
|
46e6c448b2 |
@ -1,6 +1,5 @@
|
|||||||
import esbuild from 'esbuild';
|
import esbuild from 'esbuild';
|
||||||
import scss from 'esbuild-plugin-sass';
|
import scss from 'esbuild-plugin-sass';
|
||||||
import svg from 'esbuild-plugin-svgr';
|
|
||||||
|
|
||||||
const watch = process.argv.includes('--watch') && {
|
const watch = process.argv.includes('--watch') && {
|
||||||
onRebuild(error) {
|
onRebuild(error) {
|
||||||
@ -9,6 +8,39 @@ const watch = process.argv.includes('--watch') && {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// see https://github.com/evanw/esbuild/issues/806#issuecomment-779138268
|
||||||
|
let skipReactImports = {
|
||||||
|
name: 'skipReactImports',
|
||||||
|
setup(build) {
|
||||||
|
build.onResolve({ filter: /^react(-dom)?$/ }, (args) => {
|
||||||
|
return {
|
||||||
|
path: args.path,
|
||||||
|
namespace: `globalExternal_${args.path}`,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
build.onLoad(
|
||||||
|
{ filter: /.*/, namespace: 'globalExternal_react' },
|
||||||
|
() => {
|
||||||
|
return {
|
||||||
|
contents: `module.exports = globalThis.React`,
|
||||||
|
loader: 'js',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
build.onLoad(
|
||||||
|
{ filter: /.*/, namespace: 'globalExternal_react-dom' },
|
||||||
|
() => {
|
||||||
|
return {
|
||||||
|
contents: `module.exports = globalThis.ReactDOM`,
|
||||||
|
loader: 'js',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
esbuild
|
esbuild
|
||||||
.build({
|
.build({
|
||||||
entryPoints: [
|
entryPoints: [
|
||||||
@ -21,7 +53,8 @@ esbuild
|
|||||||
// minify: true,
|
// minify: true,
|
||||||
outdir: './lib',
|
outdir: './lib',
|
||||||
loader: { '.woff': 'file', '.woff2': 'file' },
|
loader: { '.woff': 'file', '.woff2': 'file' },
|
||||||
plugins: [scss(), svg()],
|
plugins: [scss(), skipReactImports],
|
||||||
|
external: ['react', 'react-dom'],
|
||||||
watch,
|
watch,
|
||||||
})
|
})
|
||||||
.then(() => console.log('Add-on was built'))
|
.then(() => console.log('Add-on was built'))
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
"addons-linter": "^4.7.0",
|
"addons-linter": "^4.7.0",
|
||||||
"esbuild": "^0.14.14",
|
"esbuild": "^0.14.14",
|
||||||
"esbuild-plugin-sass": "^1.0.1",
|
"esbuild-plugin-sass": "^1.0.1",
|
||||||
"esbuild-plugin-svgr": "^1.0.0",
|
|
||||||
"web-ext": "^6.6.0",
|
"web-ext": "^6.6.0",
|
||||||
"web-ext-types": "^3.2.1"
|
"web-ext-types": "^3.2.1"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useState } from 'react';
|
|
||||||
import { RequestCluster } from '../request-cluster';
|
import { RequestCluster } from '../request-cluster';
|
||||||
import { StolenDataEntry } from '../stolen-data-entry';
|
import { StolenDataEntry } from '../stolen-data-entry';
|
||||||
import { getDate, toBase64 } from '../util';
|
import { getDate, toBase64 } from '../util';
|
||||||
@ -15,12 +14,13 @@ export default function EmailTemplate1({
|
|||||||
clusters: Record<string, RequestCluster>;
|
clusters: Record<string, RequestCluster>;
|
||||||
version: number;
|
version: number;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
const [popupState, setPopupState] = useState<PopupState>('not_clicked');
|
const [popupState, setPopupState] =
|
||||||
const [acceptAllName, setAcceptAllName] = useState<string>(
|
React.useState<PopupState>('not_clicked');
|
||||||
|
const [acceptAllName, setAcceptAllName] = React.useState<string>(
|
||||||
'Zaakceptuj wszystkie'
|
'Zaakceptuj wszystkie'
|
||||||
);
|
);
|
||||||
const [popupScreenshotBase64, setPopupScreenshotBase64] =
|
const [popupScreenshotBase64, setPopupScreenshotBase64] =
|
||||||
useState<string>(null);
|
React.useState<string>(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Dispatch, SetStateAction } from 'react';
|
|
||||||
import { toBase64 } from '../util';
|
import { toBase64 } from '../util';
|
||||||
import { EmailTemplate2Config } from './email-template-2';
|
import { EmailTemplate2Config } from './email-template-2';
|
||||||
|
|
||||||
@ -8,7 +7,7 @@ export default function EmailTemplate2Controls({
|
|||||||
setConfig,
|
setConfig,
|
||||||
}: {
|
}: {
|
||||||
config: EmailTemplate2Config;
|
config: EmailTemplate2Config;
|
||||||
setConfig: Dispatch<SetStateAction<EmailTemplate2Config>>;
|
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate2Config>>;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import { RequestCluster } from '../request-cluster';
|
import { RequestCluster } from '../request-cluster';
|
||||||
import { StolenDataEntry } from '../stolen-data-entry';
|
import { StolenDataEntry } from '../stolen-data-entry';
|
||||||
import { getDate, unique } from '../util';
|
import { getDate, unique } from '../util';
|
||||||
@ -75,7 +75,7 @@ export default function EmailTemplate2({
|
|||||||
clusters: Record<string, RequestCluster>;
|
clusters: Record<string, RequestCluster>;
|
||||||
version: number;
|
version: number;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
const [config, setConfig] = useState<EmailTemplate2Config>({
|
const [config, setConfig] = React.useState<EmailTemplate2Config>({
|
||||||
popup_type: 'none',
|
popup_type: 'none',
|
||||||
popup_action: 'ignored',
|
popup_action: 'ignored',
|
||||||
popup_screenshot_base64: null,
|
popup_screenshot_base64: null,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import { RequestCluster } from '../request-cluster';
|
import { RequestCluster } from '../request-cluster';
|
||||||
import { StolenDataEntry } from '../stolen-data-entry';
|
import { StolenDataEntry } from '../stolen-data-entry';
|
||||||
import EmailTemplate1 from './email-template-1';
|
import EmailTemplate1 from './email-template-1';
|
||||||
@ -13,7 +13,7 @@ export default function EmailTemplate({
|
|||||||
clusters: Record<string, RequestCluster>;
|
clusters: Record<string, RequestCluster>;
|
||||||
version: number;
|
version: number;
|
||||||
}) {
|
}) {
|
||||||
const [templateVersion, setTemplateVersion] = useState('2');
|
const [templateVersion, setTemplateVersion] = React.useState('2');
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<select
|
<select
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React from 'react';
|
||||||
import { HAREntry } from '../extended-request';
|
import { HAREntry } from '../extended-request';
|
||||||
import { StolenDataEntry } from '../stolen-data-entry';
|
import { StolenDataEntry } from '../stolen-data-entry';
|
||||||
import { getshorthost, unique } from '../util';
|
import { getshorthost, unique } from '../util';
|
||||||
@ -80,11 +80,11 @@ export default function HARConverter({
|
|||||||
}: {
|
}: {
|
||||||
entries: StolenDataEntry[];
|
entries: StolenDataEntry[];
|
||||||
}) {
|
}) {
|
||||||
const [filtered, setFiltered] = useState<Blob | null>(null);
|
const [filtered, setFiltered] = React.useState<Blob | null>(null);
|
||||||
const [filename, setFilename] = useState('');
|
const [filename, setFilename] = React.useState('');
|
||||||
const [fakeHAR, setFakeHAR] =
|
const [fakeHAR, setFakeHAR] =
|
||||||
useState<ReturnType<typeof generateFakeHAR>>();
|
React.useState<ReturnType<typeof generateFakeHAR>>();
|
||||||
useEffect(() => {
|
React.useEffect(() => {
|
||||||
setFakeHAR(generateFakeHAR(entries));
|
setFakeHAR(generateFakeHAR(entries));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { getMemory } from '../memory';
|
import { getMemory } from '../memory';
|
||||||
import { Classifications, StolenDataEntry } from '../stolen-data-entry';
|
import { Classifications, StolenDataEntry } from '../stolen-data-entry';
|
||||||
@ -88,15 +88,12 @@ function Report() {
|
|||||||
console.time('useMemory');
|
console.time('useMemory');
|
||||||
const [counter, setCounter] = useEmitter(getMemory());
|
const [counter, setCounter] = useEmitter(getMemory());
|
||||||
console.timeEnd('useMemory');
|
console.timeEnd('useMemory');
|
||||||
function refresh() {
|
|
||||||
setCounter((c) => c + 1);
|
|
||||||
}
|
|
||||||
console.time('getClustersForOrigin');
|
console.time('getClustersForOrigin');
|
||||||
const clusters = getMemory().getClustersForOrigin(origin);
|
const clusters = getMemory().getClustersForOrigin(origin);
|
||||||
console.timeEnd('getClustersForOrigin');
|
console.timeEnd('getClustersForOrigin');
|
||||||
const [entries, setEntries] = useState<StolenDataEntry[]>([]);
|
const [entries, setEntries] = React.useState<StolenDataEntry[]>([]);
|
||||||
console.time('useEffect report-window');
|
console.time('useEffect report-window');
|
||||||
useEffect(() => {
|
React.useEffect(() => {
|
||||||
setEntries(
|
setEntries(
|
||||||
Object.values(clusters)
|
Object.values(clusters)
|
||||||
.map((cluster) => {
|
.map((cluster) => {
|
||||||
|
@ -18,8 +18,10 @@
|
|||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="/lib/sidebar/sidebar.css"
|
href="/lib/sidebar/sidebar.css"
|
||||||
>
|
>
|
||||||
|
<script src="/node_modules/react/umd/react.production.min.js"></script>
|
||||||
|
<script src="/node_modules/react-dom/umd/react-dom.production.min.js"></script>
|
||||||
<script src="/lib/sidebar/sidebar.js"></script>
|
<script src="/lib/sidebar/sidebar.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { Fragment, useEffect, useState } from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import Options from '../options';
|
import Options from '../options';
|
||||||
import { StolenData } from './stolen-data';
|
import { StolenData } from './stolen-data';
|
||||||
@ -17,232 +17,247 @@ import './global.scss';
|
|||||||
import './sidebar.scss';
|
import './sidebar.scss';
|
||||||
|
|
||||||
const Sidebar = () => {
|
const Sidebar = () => {
|
||||||
const [origin, setOrigin] = useState<string | null>(null);
|
try {
|
||||||
const [minValueLength, setMinValueLength] = useState<number | null>(
|
const [origin, setOrigin] = React.useState<string | null>(null);
|
||||||
localStorage.getItem('minValueLength') === null
|
const [minValueLength, setMinValueLength] = React.useState<
|
||||||
? 7
|
number | null
|
||||||
: (localStorage.getItem('minValueLength') as unknown as number)
|
>(
|
||||||
);
|
localStorage.getItem('minValueLength') === null
|
||||||
const [cookiesOnly, setCookiesOnly] = useState<boolean>(false);
|
? 7
|
||||||
const [stolenDataView, setStolenDataView] = useState<boolean>(true);
|
: (localStorage.getItem('minValueLength') as unknown as number)
|
||||||
const [cookiesOrOriginOnly, setCookiesOrOriginOnly] =
|
);
|
||||||
useState<boolean>(false);
|
const [cookiesOnly, setCookiesOnly] = React.useState<boolean>(false);
|
||||||
const [counter, setCounter] = useEmitter(getMemory());
|
const [stolenDataView, setStolenDataView] =
|
||||||
const [marksOccurrence, setMarksOccurrence] = useState<boolean>(false);
|
React.useState<boolean>(true);
|
||||||
const [warningDataDialogAck, setWarningDataDialogAck] = useState<boolean>(
|
const [cookiesOrOriginOnly, setCookiesOrOriginOnly] =
|
||||||
localStorage.getItem('warningDataDialogAck') === null
|
React.useState<boolean>(false);
|
||||||
? true
|
const [counter, setCounter] = useEmitter(getMemory());
|
||||||
: localStorage.getItem('warningDataDialogAck') == 'true'
|
const [marksOccurrence, setMarksOccurrence] =
|
||||||
? true
|
React.useState<boolean>(false);
|
||||||
: false
|
const [warningDataDialogAck, setWarningDataDialogAck] =
|
||||||
);
|
React.useState<boolean>(
|
||||||
const [logoVisibility, setLogoVisibility] = useState<boolean>(
|
localStorage.getItem('warningDataDialogAck') === null
|
||||||
localStorage.getItem('logoVisibility') === null
|
? true
|
||||||
? false
|
: localStorage.getItem('warningDataDialogAck') == 'true'
|
||||||
: localStorage.getItem('logoVisibility') == 'true'
|
? true
|
||||||
? true
|
: false
|
||||||
: false
|
);
|
||||||
);
|
const [logoVisibility, setLogoVisibility] = React.useState<boolean>(
|
||||||
|
localStorage.getItem('logoVisibility') === null
|
||||||
|
? false
|
||||||
|
: localStorage.getItem('logoVisibility') == 'true'
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
React.useEffect(() => {
|
||||||
const listener = async (data: any) => {
|
const listener = async (data: any) => {
|
||||||
console.log('tab change!');
|
console.log('tab change!');
|
||||||
const tab = await getCurrentTab();
|
const tab = await getCurrentTab();
|
||||||
const url = new URL(tab.url);
|
const url = new URL(tab.url);
|
||||||
if (url.origin.startsWith('moz-extension')) {
|
if (url.origin.startsWith('moz-extension')) {
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
setOrigin(url.origin);
|
|
||||||
};
|
|
||||||
browser.tabs.onUpdated.addListener(listener);
|
|
||||||
return () => {
|
|
||||||
browser.tabs.onUpdated.removeListener(listener);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
for (const cluster of Object.values(
|
|
||||||
getMemory().getClustersForOrigin(origin)
|
|
||||||
)) {
|
|
||||||
if (cluster.hasMarks()) {
|
|
||||||
return setMarksOccurrence(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return setMarksOccurrence(false);
|
|
||||||
}, [counter, origin]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="sidebar">
|
|
||||||
<header
|
|
||||||
className={
|
|
||||||
logoVisibility ? 'header' : 'header header--without-logo'
|
|
||||||
}
|
}
|
||||||
>
|
setOrigin(url.origin);
|
||||||
<img
|
};
|
||||||
src="../assets/logo-internet-czas-dzialac.svg"
|
browser.tabs.onUpdated.addListener(listener);
|
||||||
height={40}
|
return () => {
|
||||||
style={!logoVisibility ? { display: 'none' } : null}
|
browser.tabs.onUpdated.removeListener(listener);
|
||||||
></img>
|
};
|
||||||
<div
|
});
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
for (const cluster of Object.values(
|
||||||
|
getMemory().getClustersForOrigin(origin)
|
||||||
|
)) {
|
||||||
|
if (cluster.hasMarks()) {
|
||||||
|
return setMarksOccurrence(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return setMarksOccurrence(false);
|
||||||
|
}, [counter, origin]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="sidebar">
|
||||||
|
<header
|
||||||
className={
|
className={
|
||||||
logoVisibility
|
logoVisibility
|
||||||
? 'webpage-metadata'
|
? 'header'
|
||||||
: 'webpage-metadata webpage-metadata--without-logo'
|
: 'header header--without-logo'
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{origin ? (
|
<img
|
||||||
<Fragment>
|
src="../assets/logo-internet-czas-dzialac.svg"
|
||||||
<span>Analiza strony</span>
|
height={40}
|
||||||
<span className="webpage-metadata--hyperlink">
|
style={!logoVisibility ? { display: 'none' } : null}
|
||||||
{origin}
|
></img>
|
||||||
</span>
|
<div
|
||||||
</Fragment>
|
className={
|
||||||
) : (
|
logoVisibility
|
||||||
<span>Przejdź do wybranej strony internetowej</span>
|
? 'webpage-metadata'
|
||||||
)}
|
: 'webpage-metadata webpage-metadata--without-logo'
|
||||||
</div>
|
|
||||||
{stolenDataView ? (
|
|
||||||
<a href="https://internet-czas-dzialac.pl">
|
|
||||||
<img
|
|
||||||
src="/assets/icons/info_circle_outline.svg"
|
|
||||||
width="20"
|
|
||||||
height="20"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
<button onClick={() => setStolenDataView(true)}>
|
|
||||||
<img
|
|
||||||
src="/assets/icons/short_left.svg"
|
|
||||||
width="20"
|
|
||||||
height="20"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{stolenDataView ? (
|
|
||||||
<nav>
|
|
||||||
<button onClick={() => setStolenDataView(!stolenDataView)}>
|
|
||||||
<img
|
|
||||||
src="/assets/icons/settings.svg"
|
|
||||||
width="20"
|
|
||||||
height="20"
|
|
||||||
/>
|
|
||||||
<span>Ustawienia</span>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={() => {
|
|
||||||
getMemory().removeRequestsFor(origin);
|
|
||||||
setCounter((c) => c + 1);
|
|
||||||
setMarksOccurrence(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="/assets/icons/trash_full.svg"
|
|
||||||
width="20"
|
|
||||||
height="20"
|
|
||||||
/>
|
|
||||||
<span>Wyczyść historię wtyczki</span>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={() => {
|
|
||||||
getMemory().removeCookiesFor(origin);
|
|
||||||
setCounter((c) => c + 1);
|
|
||||||
setMarksOccurrence(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="/assets/icons/cookie.svg"
|
|
||||||
width="20"
|
|
||||||
height="20"
|
|
||||||
/>
|
|
||||||
<span>Wyczyść ciasteczka</span>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
disabled={!marksOccurrence}
|
|
||||||
title={
|
|
||||||
marksOccurrence
|
|
||||||
? 'Kliknij, aby wygenerować wiadomość'
|
|
||||||
: 'Zaznacz poniżej elementy, aby móc wygenerować wiadomość'
|
|
||||||
}
|
}
|
||||||
onClick={() => {
|
|
||||||
const params = [
|
|
||||||
'height=' + screen.height,
|
|
||||||
'width=' + screen.width,
|
|
||||||
'fullscreen=yes',
|
|
||||||
].join(',');
|
|
||||||
window.open(
|
|
||||||
`/report-window/report-window.html?origin=${origin}`,
|
|
||||||
'new_window',
|
|
||||||
params
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<img
|
{origin ? (
|
||||||
src="/assets/icons/mail.svg"
|
<>
|
||||||
width="20"
|
<span>Analiza strony</span>
|
||||||
height="20"
|
<span className="webpage-metadata--hyperlink">
|
||||||
/>
|
{origin}
|
||||||
<span>Utwórz wiadomość dla administratora witryny</span>
|
|
||||||
</button>
|
|
||||||
</nav>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
<section>
|
|
||||||
{stolenDataView ? (
|
|
||||||
<Fragment>
|
|
||||||
{warningDataDialogAck ? (
|
|
||||||
<section className="warning-container">
|
|
||||||
<span>
|
|
||||||
<strong>Uwaga!</strong> Niekoniecznie każda
|
|
||||||
przechwycona poniżej informacja jest daną
|
|
||||||
osobową. Niektóre z podanych domen mogą
|
|
||||||
należeć do właściciela strony i nie
|
|
||||||
reprezentować podmiotów trzecich.
|
|
||||||
</span>
|
</span>
|
||||||
<button
|
</>
|
||||||
onClick={() => {
|
) : (
|
||||||
setWarningDataDialogAck(false);
|
<span>Przejdź do wybranej strony internetowej</span>
|
||||||
localStorage.setItem(
|
)}
|
||||||
'warningDataDialogAck',
|
</div>
|
||||||
false as unknown as string
|
{stolenDataView ? (
|
||||||
);
|
<a href="https://internet-czas-dzialac.pl">
|
||||||
}}
|
<img
|
||||||
>
|
src="/assets/icons/info_circle_outline.svg"
|
||||||
<img
|
width="20"
|
||||||
src="/assets/icons/close_big.svg"
|
height="20"
|
||||||
width="16"
|
/>
|
||||||
height="16"
|
</a>
|
||||||
/>
|
) : (
|
||||||
</button>
|
<button onClick={() => setStolenDataView(true)}>
|
||||||
</section>
|
<img
|
||||||
) : null}
|
src="/assets/icons/short_left.svg"
|
||||||
<StolenData
|
width="20"
|
||||||
origin={origin}
|
height="20"
|
||||||
refreshToken={counter}
|
/>
|
||||||
refresh={() => setCounter((c) => c + 1)}
|
</button>
|
||||||
minValueLength={minValueLength}
|
)}
|
||||||
cookiesOnly={cookiesOnly}
|
</header>
|
||||||
cookiesOrOriginOnly={cookiesOrOriginOnly}
|
|
||||||
/>
|
|
||||||
</Fragment>
|
|
||||||
) : (
|
|
||||||
<Options
|
|
||||||
minValueLength={minValueLength}
|
|
||||||
setMinValueLength={setMinValueLength}
|
|
||||||
cookiesOnly={cookiesOnly}
|
|
||||||
setCookiesOnly={setCookiesOnly}
|
|
||||||
cookiesOrOriginOnly={cookiesOrOriginOnly}
|
|
||||||
setCookiesOrOriginOnly={setCookiesOrOriginOnly}
|
|
||||||
warningDataDialogAck={warningDataDialogAck}
|
|
||||||
setWarningDataDialogAck={setWarningDataDialogAck}
|
|
||||||
logoVisibility={logoVisibility}
|
|
||||||
setLogoVisibility={setLogoVisibility}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
{stolenDataView ? (
|
||||||
|
<nav>
|
||||||
|
<button
|
||||||
|
onClick={() => setStolenDataView(!stolenDataView)}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/assets/icons/settings.svg"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
/>
|
||||||
|
<span>Ustawienia</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
getMemory().removeRequestsFor(origin);
|
||||||
|
setCounter((c) => c + 1);
|
||||||
|
setMarksOccurrence(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/assets/icons/trash_full.svg"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
/>
|
||||||
|
<span>Wyczyść historię wtyczki</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
getMemory().removeCookiesFor(origin);
|
||||||
|
setCounter((c) => c + 1);
|
||||||
|
setMarksOccurrence(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/assets/icons/cookie.svg"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
/>
|
||||||
|
<span>Wyczyść ciasteczka</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
disabled={!marksOccurrence}
|
||||||
|
title={
|
||||||
|
marksOccurrence
|
||||||
|
? 'Kliknij, aby wygenerować wiadomość'
|
||||||
|
: 'Zaznacz poniżej elementy, aby móc wygenerować wiadomość'
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
const params = [
|
||||||
|
'height=' + screen.height,
|
||||||
|
'width=' + screen.width,
|
||||||
|
'fullscreen=yes',
|
||||||
|
].join(',');
|
||||||
|
window.open(
|
||||||
|
`/report-window/report-window.html?origin=${origin}`,
|
||||||
|
'new_window',
|
||||||
|
params
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/assets/icons/mail.svg"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
Utwórz wiadomość dla administratora witryny
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<section>
|
||||||
|
{stolenDataView ? (
|
||||||
|
<>
|
||||||
|
{warningDataDialogAck ? (
|
||||||
|
<section className="warning-container">
|
||||||
|
<span>
|
||||||
|
<strong>Uwaga!</strong> Niekoniecznie
|
||||||
|
każda przechwycona poniżej informacja
|
||||||
|
jest daną osobową. Niektóre z podanych
|
||||||
|
domen mogą należeć do właściciela strony
|
||||||
|
i nie reprezentować podmiotów trzecich.
|
||||||
|
</span>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setWarningDataDialogAck(false);
|
||||||
|
localStorage.setItem(
|
||||||
|
'warningDataDialogAck',
|
||||||
|
false as unknown as string
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/assets/icons/close_big.svg"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</section>
|
||||||
|
) : null}
|
||||||
|
<StolenData
|
||||||
|
origin={origin}
|
||||||
|
refreshToken={counter}
|
||||||
|
refresh={() => setCounter((c) => c + 1)}
|
||||||
|
minValueLength={minValueLength}
|
||||||
|
cookiesOnly={cookiesOnly}
|
||||||
|
cookiesOrOriginOnly={cookiesOrOriginOnly}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Options
|
||||||
|
minValueLength={minValueLength}
|
||||||
|
setMinValueLength={setMinValueLength}
|
||||||
|
cookiesOnly={cookiesOnly}
|
||||||
|
setCookiesOnly={setCookiesOnly}
|
||||||
|
cookiesOrOriginOnly={cookiesOrOriginOnly}
|
||||||
|
setCookiesOrOriginOnly={setCookiesOrOriginOnly}
|
||||||
|
warningDataDialogAck={warningDataDialogAck}
|
||||||
|
setWarningDataDialogAck={setWarningDataDialogAck}
|
||||||
|
logoVisibility={logoVisibility}
|
||||||
|
setLogoVisibility={setLogoVisibility}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
debugger;
|
||||||
ReactDOM.render(<Sidebar />, document.getElementById('app'));
|
ReactDOM.render(<Sidebar />, document.getElementById('app'));
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useEffect, useState } from 'react';
|
|
||||||
|
|
||||||
export default function TabDropdown({
|
export default function TabDropdown({
|
||||||
setPickedTab,
|
setPickedTab,
|
||||||
@ -8,8 +7,8 @@ export default function TabDropdown({
|
|||||||
setPickedTab: (tab_id: number) => void;
|
setPickedTab: (tab_id: number) => void;
|
||||||
pickedTab: number;
|
pickedTab: number;
|
||||||
}) {
|
}) {
|
||||||
const [tabs, setTabs] = useState([]);
|
const [tabs, setTabs] = React.useState([]);
|
||||||
useEffect(() => {
|
React.useEffect(() => {
|
||||||
browser.tabs.query({ currentWindow: true }).then(setTabs);
|
browser.tabs.query({ currentWindow: true }).then(setTabs);
|
||||||
}, []);
|
}, []);
|
||||||
return (
|
return (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react",
|
"jsx": "react-jsx",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["es2017", "dom", "es2019"],
|
"lib": ["es2017", "dom", "es2019"],
|
||||||
|
8
util.ts
8
util.ts
@ -1,5 +1,5 @@
|
|||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export type Unpromisify<T> = T extends Promise<infer R> ? R : T;
|
export type Unpromisify<T> = T extends Promise<infer R> ? R : T;
|
||||||
export type Unarray<T> = T extends Array<infer R> ? R : T;
|
export type Unarray<T> = T extends Array<infer R> ? R : T;
|
||||||
@ -47,9 +47,9 @@ export function getshorthost(host: string) {
|
|||||||
|
|
||||||
export function useEmitter(
|
export function useEmitter(
|
||||||
e: EventEmitter
|
e: EventEmitter
|
||||||
): [number, Dispatch<SetStateAction<number>>] {
|
): [number, React.Dispatch<React.SetStateAction<number>>] {
|
||||||
const [counter, setCounter] = useState<number>(0);
|
const [counter, setCounter] = React.useState<number>(0);
|
||||||
useEffect(() => {
|
React.useEffect(() => {
|
||||||
const callback = () => {
|
const callback = () => {
|
||||||
setCounter((counter) => counter + 1);
|
setCounter((counter) => counter + 1);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user