Add option to classify data as location data
This commit is contained in:
		
							parent
							
								
									2bcf72f652
								
							
						
					
					
						commit
						fa988cd0f4
					
				| @ -5,6 +5,7 @@ import { Classifications, Sources } from "../stolen-data-entry"; | ||||
| const emailClassifications: Record<keyof typeof Classifications, string> = { | ||||
|   id: "sztucznie nadane mi ID", | ||||
|   history: "część mojej historii przeglądania", | ||||
|   location: "informacje na temat mojej lokalizacji geograficznej", | ||||
| }; | ||||
| 
 | ||||
| const emailSources: Record<Sources, string> = { | ||||
|  | ||||
| @ -1,6 +1,8 @@ | ||||
| import React from "react"; | ||||
| import ReactDOM from "react-dom"; | ||||
| import { getMemory } from "../memory"; | ||||
| import { Classifications } from "../stolen-data-entry"; | ||||
| import { useEmitter } from "../util"; | ||||
| import EmailTemplate from "./email-template"; | ||||
| import HARConverter from "./har-converter"; | ||||
| 
 | ||||
| @ -8,6 +10,10 @@ function Report() { | ||||
|   const origin = new URL(document.location.toString()).searchParams.get( | ||||
|     "origin" | ||||
|   ); | ||||
|   const [counter, setCounter] = useEmitter(getMemory()); | ||||
|   function refresh() { | ||||
|     setCounter((c) => c + 1); | ||||
|   } | ||||
|   const clusters = getMemory().getClustersForOrigin(origin); | ||||
|   const marked_entries = Object.values(clusters) | ||||
|     .map((cluster) => cluster.getMarkedRequests()) | ||||
| @ -51,10 +57,18 @@ function Report() { | ||||
|                 {entry.value} | ||||
|               </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"], | ||||
|                     ["id", "Sztucznie nadane id"], | ||||
|                     ["location", "Informacje na temat mojej lokalizacji"], | ||||
|                   ].map(([key, name]) => ( | ||||
|                     <option key={key} value={key}> | ||||
|                       {name} | ||||
|  | ||||
| @ -15,6 +15,7 @@ export type Sources = "cookie" | "pathname" | "queryparams" | "header"; | ||||
| export const Classifications = <const>{ | ||||
|   id: "Sztucznie nadane ID", | ||||
|   history: "Część historii przeglądania", | ||||
|   location: "Informacje na temat mojego położenia", | ||||
| }; | ||||
| 
 | ||||
| const id = (function* id() { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user