Option to show only entries with either cookies or history
This commit is contained in:
parent
070ac44839
commit
9b40f88db3
12
options.tsx
12
options.tsx
|
@ -5,6 +5,8 @@ export default function Options({
|
|||
setMinValueLength,
|
||||
cookiesOnly,
|
||||
setCookiesOnly,
|
||||
cookiesOrOriginOnly,
|
||||
setCookiesOrOriginOnly,
|
||||
}) {
|
||||
return (
|
||||
<fieldset>
|
||||
|
@ -26,6 +28,16 @@ export default function Options({
|
|||
onChange={(e) => setCookiesOnly(e.target.checked)}
|
||||
/>
|
||||
<label htmlFor="cookiesOnly">Pokazuj tylko dane z cookiesów</label>
|
||||
<br />
|
||||
<input
|
||||
type="checkbox"
|
||||
id="cookiesOrOriginOnly"
|
||||
value={cookiesOrOriginOnly}
|
||||
onChange={(e) => setCookiesOrOriginOnly(e.target.checked)}
|
||||
/>
|
||||
<label htmlFor="cookiesOrOriginOnly">
|
||||
Pokazuj tylko dane z cookiesów lub z częścią historii przeglądania
|
||||
</label>
|
||||
</fieldset>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ export class RequestCluster extends EventEmitter {
|
|||
getStolenData(filter: {
|
||||
minValueLength: number;
|
||||
cookiesOnly: boolean;
|
||||
cookiesOrOriginOnly: boolean;
|
||||
}): MergedStolenDataEntry[] {
|
||||
return this.requests
|
||||
.map((request) => request.stolenData)
|
||||
|
@ -34,6 +35,12 @@ export class RequestCluster extends EventEmitter {
|
|||
return entry.value.length >= filter.minValueLength;
|
||||
})
|
||||
.filter((entry) => !filter.cookiesOnly || entry.source === "cookie")
|
||||
.filter(
|
||||
(entry) =>
|
||||
!filter.cookiesOrOriginOnly ||
|
||||
entry.source === "cookie" ||
|
||||
entry.classification === "history"
|
||||
)
|
||||
.sort((entryA, entryB) => (entryA.name > entryB.name ? -1 : 1))
|
||||
.filter((element, index, array) => {
|
||||
// remove duplicates by name/value
|
||||
|
@ -103,4 +110,8 @@ export class RequestCluster extends EventEmitter {
|
|||
.map((request) => request.getMarkedEntries())
|
||||
.reduce(reduceConcat, []);
|
||||
}
|
||||
|
||||
exposesOrigin() {
|
||||
return this.requests.some((request) => request.exposesOrigin());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user