Add option to classify data as location data

This commit is contained in:
Kuba Orlik 2021-11-11 20:25:06 +01:00
parent 2bcf72f652
commit fa988cd0f4
3 changed files with 17 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import { Classifications, Sources } from "../stolen-data-entry";
const emailClassifications: Record<keyof typeof Classifications, string> = { const emailClassifications: Record<keyof typeof Classifications, string> = {
id: "sztucznie nadane mi ID", id: "sztucznie nadane mi ID",
history: "część mojej historii przeglądania", history: "część mojej historii przeglądania",
location: "informacje na temat mojej lokalizacji geograficznej",
}; };
const emailSources: Record<Sources, string> = { const emailSources: Record<Sources, string> = {

View File

@ -1,6 +1,8 @@
import React 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 } from "../stolen-data-entry";
import { useEmitter } from "../util";
import EmailTemplate from "./email-template"; import EmailTemplate from "./email-template";
import HARConverter from "./har-converter"; import HARConverter from "./har-converter";
@ -8,6 +10,10 @@ function Report() {
const origin = new URL(document.location.toString()).searchParams.get( const origin = new URL(document.location.toString()).searchParams.get(
"origin" "origin"
); );
const [counter, setCounter] = useEmitter(getMemory());
function refresh() {
setCounter((c) => c + 1);
}
const clusters = getMemory().getClustersForOrigin(origin); const clusters = getMemory().getClustersForOrigin(origin);
const marked_entries = Object.values(clusters) const marked_entries = Object.values(clusters)
.map((cluster) => cluster.getMarkedRequests()) .map((cluster) => cluster.getMarkedRequests())
@ -51,10 +57,18 @@ function Report() {
{entry.value} {entry.value}
</td> </td>
<td> <td>
<select value={entry.classification}> <select
value={entry.classification}
onChange={(e) => {
entry.classification = e.target
.value as keyof typeof Classifications;
refresh();
}}
>
{[ {[
["history", "Historia przeglądania"], ["history", "Historia przeglądania"],
["id", "Sztucznie nadane id"], ["id", "Sztucznie nadane id"],
["location", "Informacje na temat mojej lokalizacji"],
].map(([key, name]) => ( ].map(([key, name]) => (
<option key={key} value={key}> <option key={key} value={key}>
{name} {name}

View File

@ -15,6 +15,7 @@ export type Sources = "cookie" | "pathname" | "queryparams" | "header";
export const Classifications = <const>{ export const Classifications = <const>{
id: "Sztucznie nadane ID", id: "Sztucznie nadane ID",
history: "Część historii przeglądania", history: "Część historii przeglądania",
location: "Informacje na temat mojego położenia",
}; };
const id = (function* id() { const id = (function* id() {