Better HAR sorting, option to mention pop-up being closed
This commit is contained in:
		
							parent
							
								
									b0dd58fa9c
								
							
						
					
					
						commit
						da1789503b
					
				| @ -279,7 +279,7 @@ export default class ExtendedRequest { | |||||||
|         cookies: [], |         cookies: [], | ||||||
|         content: { |         content: { | ||||||
|           mimeType: "text/plain", |           mimeType: "text/plain", | ||||||
|           size: 15, |           size: this.getBalancedPriority(), | ||||||
|           encoding: "base64", |           encoding: "base64", | ||||||
|           text: "ZG9lc24ndCBtYXR0ZXIK", |           text: "ZG9lc24ndCBtYXR0ZXIK", | ||||||
|         }, |         }, | ||||||
| @ -304,7 +304,27 @@ export default class ExtendedRequest { | |||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getMaxPriority() { |   getMaxPriority(): number { | ||||||
|     return Math.max(...this.stolenData.map((entry) => entry.getPriority())); |     return Math.max(...this.stolenData.map((entry) => entry.getPriority())); | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|  |   getBalancedPriority(): number { | ||||||
|  |     let result = 0; | ||||||
|  |     if (this.stolenData.some((e) => e.exposesPath())) { | ||||||
|  |       result += 50; | ||||||
|  |     } | ||||||
|  |     if (this.stolenData.some((e) => e.exposesHost())) { | ||||||
|  |       result += 50; | ||||||
|  |     } | ||||||
|  |     if (this.hasCookie()) { | ||||||
|  |       result += 50; | ||||||
|  |     } | ||||||
|  |     if (this.stolenData.some((e) => e.classification === "location")) { | ||||||
|  |       result += 300; | ||||||
|  |     } | ||||||
|  |     if (this.url.includes("facebook")) { | ||||||
|  |       result += 50; | ||||||
|  |     } | ||||||
|  |     return result; | ||||||
|  |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -92,8 +92,30 @@ export default function EmailTemplate2Controls({ | |||||||
|           <option value="accepted"> |           <option value="accepted"> | ||||||
|             Kliknięte „{config.popup_accept_all_text}” |             Kliknięte „{config.popup_accept_all_text}” | ||||||
|           </option> |           </option> | ||||||
|  |           <option value="closed"> | ||||||
|  |             Zamkn*ł*m okienko (np. przyciskiem "X") | ||||||
|  |           </option> | ||||||
|         </select> |         </select> | ||||||
|       </div> |       </div> | ||||||
|  |       {config.popup_action === "closed" ? ( | ||||||
|  |         <div> | ||||||
|  |           <label htmlFor="popup_closed_how"> | ||||||
|  |             Jak okienko zostało zamknięte? Poprzez | ||||||
|  |           </label> | ||||||
|  |           <input | ||||||
|  |             id="popup_closed_how" | ||||||
|  |             type="text" | ||||||
|  |             placeholder="kliknięcie przycisku „X”" | ||||||
|  |             value={config.popup_closed_how} | ||||||
|  |             style={{ width: "300px" }} | ||||||
|  |             onChange={(e) => | ||||||
|  |               setConfig((v) => ({ ...v, popup_closed_how: e.target.value })) | ||||||
|  |             } | ||||||
|  |           /> | ||||||
|  |         </div> | ||||||
|  |       ) : ( | ||||||
|  |         "" | ||||||
|  |       )} | ||||||
|       {config.popup_type !== "none" ? ( |       {config.popup_type !== "none" ? ( | ||||||
|         <div> |         <div> | ||||||
|           <input |           <input | ||||||
|  | |||||||
| @ -7,7 +7,8 @@ import EmailTemplate2Controls from "./email-template-2-controls"; | |||||||
| 
 | 
 | ||||||
| export type EmailTemplate2Config = { | export type EmailTemplate2Config = { | ||||||
|   popup_type: "none" | "passive_cookie_banner" | "consent"; |   popup_type: "none" | "passive_cookie_banner" | "consent"; | ||||||
|   popup_action: "ignored" | "accepted"; |   popup_action: "ignored" | "accepted" | "closed"; | ||||||
|  |   popup_closed_how: string; | ||||||
|   popup_screenshot_base64: string | null; |   popup_screenshot_base64: string | null; | ||||||
|   popup_accept_all_text: string; |   popup_accept_all_text: string; | ||||||
|   popup_mentions_passive_consent: boolean; |   popup_mentions_passive_consent: boolean; | ||||||
| @ -73,6 +74,7 @@ export default function EmailTemplate2({ | |||||||
|     popup_accept_all_text: "Zaakceptuj wszystkie", |     popup_accept_all_text: "Zaakceptuj wszystkie", | ||||||
|     popup_mentions_passive_consent: false, |     popup_mentions_passive_consent: false, | ||||||
|     popup_passive_consent_text: "", |     popup_passive_consent_text: "", | ||||||
|  |     popup_closed_how: "kliknięcie  przycisku „X”", | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   const visited_url = entries[0].request.originalURL; |   const visited_url = entries[0].request.originalURL; | ||||||
| @ -191,7 +193,7 @@ export default function EmailTemplate2({ | |||||||
|             )} |             )} | ||||||
|             . |             . | ||||||
|           </> |           </> | ||||||
|         ) : ( |         ) : config.popup_action === "accepted" ? ( | ||||||
|           <> |           <> | ||||||
|             o ile po wejściu na stronę wcisnąłem w wyskakującym okienku przycisk |             o ile po wejściu na stronę wcisnąłem w wyskakującym okienku przycisk | ||||||
|             „{config.popup_accept_all_text}”, o tyle nie stanowi to według mnie |             „{config.popup_accept_all_text}”, o tyle nie stanowi to według mnie | ||||||
| @ -206,10 +208,20 @@ export default function EmailTemplate2({ | |||||||
|             osobowych, gdyż nie spełnia warunku dobrowolności wspomnianego w |             osobowych, gdyż nie spełnia warunku dobrowolności wspomnianego w | ||||||
|             Art. 4. pkt 11. RODO. |             Art. 4. pkt 11. RODO. | ||||||
|           </> |           </> | ||||||
|  |         ) : config.popup_action === "closed" ? ( | ||||||
|  |           <> | ||||||
|  |             zamknąłem okienko pytające o zgodę poprzez {config.popup_closed_how} | ||||||
|  |             . Nie może być to uznane za zgodę, bo nie spełnia to warunku | ||||||
|  |             jednoznaczności opisanego w motywie (32) Rozporządzenia 2016/679.{" "} | ||||||
|  |           </> | ||||||
|  |         ) : ( | ||||||
|  |           "" | ||||||
|         )}{" "} |         )}{" "} | ||||||
|         Za zgodę nie można też uznać posiadania włączonej obsługi cookies w |         Za zgodę nie można też uznać posiadania włączonej obsługi cookies w | ||||||
|         przeglądarce, jakichkolwiek innych ustawień przeglądarki, ani pasywnych |         przeglądarce (gdyż aby zgoda była ważna, musi być szczegółowa dla | ||||||
|         działań z mojej strony (np. „kontynuowanie korzystania ze strony”) |         każdego celów z osobna), jakichkolwiek innych ustawień przeglądarki, ani | ||||||
|  |         pasywnych działań z mojej strony (np. „kontynuowanie korzystania ze | ||||||
|  |         strony”) | ||||||
|         {config.popup_mentions_passive_consent ? ( |         {config.popup_mentions_passive_consent ? ( | ||||||
|           <> |           <> | ||||||
|             {" "} |             {" "} | ||||||
| @ -382,5 +394,4 @@ export default function EmailTemplate2({ | |||||||
|       </p> |       </p> | ||||||
|     </> |     </> | ||||||
|   ); |   ); | ||||||
|   return result; |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -29,29 +29,21 @@ function generateFakeHAR(entries: StolenDataEntry[]) { | |||||||
|       } else if (request1.shorthost > request2.shorthost) { |       } else if (request1.shorthost > request2.shorthost) { | ||||||
|         return 1; |         return 1; | ||||||
|       } else { |       } else { | ||||||
|         return request2.getMaxPriority() - request1.getMaxPriority(); |         return request2.getBalancedPriority() - request1.getBalancedPriority(); | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
|     .filter((_, index, array) => { |     .filter((_, index, array) => { | ||||||
|       if (index !== 0 && array[index].shorthost == array[index - 1].shorthost) { |       if (index == 0) return true; | ||||||
|  |       if (array[index].shorthost == array[index - 1].shorthost) { | ||||||
|         return false; |         return false; | ||||||
|       } |       } | ||||||
|       return true; |       return true; | ||||||
|     }) |     }) | ||||||
|     .sort( |     .sort( | ||||||
|       (entry1, entry2) => entry2.getMaxPriority() - entry1.getMaxPriority() |       (entry1, entry2) => | ||||||
|  |         entry2.getBalancedPriority() - entry1.getBalancedPriority() | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|   console.log( |  | ||||||
|     "GENERATEHAR! Got", |  | ||||||
|     entries.length, |  | ||||||
|     "entries, ", |  | ||||||
|     unique(entries.map((e) => e.request)), |  | ||||||
|     "requests. Filtered down to", |  | ||||||
|     requests.length, |  | ||||||
|     "requests" |  | ||||||
|   ); |  | ||||||
| 
 |  | ||||||
|   return { |   return { | ||||||
|     log: { |     log: { | ||||||
|       version: "1.2", |       version: "1.2", | ||||||
|  | |||||||
| @ -214,13 +214,7 @@ export class StolenDataEntry extends EventEmitter { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   exposesOrigin(): boolean { |   exposesOrigin(): boolean { | ||||||
|     const result = [this.value, decodeURIComponent(this.value)].some( |     return this.exposesHost() || this.exposesPath(); | ||||||
|       (haystack) => |  | ||||||
|         haystack.includes(getshorthost(this.request.origin)) || |  | ||||||
|         (this.request.originalPathname !== "/" && |  | ||||||
|           haystack.includes(this.request.originalPathname)) |  | ||||||
|     ); |  | ||||||
|     return result; |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   autoMark() { |   autoMark() { | ||||||
| @ -245,4 +239,19 @@ export class StolenDataEntry extends EventEmitter { | |||||||
|       this.mark(); |       this.mark(); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|  |   exposesPath() { | ||||||
|  |     return ( | ||||||
|  |       this.request.originalPathname !== "/" && | ||||||
|  |       [this.value, decodeURIComponent(this.value)].some((haystack) => | ||||||
|  |         haystack.includes(this.request.originalPathname) | ||||||
|  |       ) | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   exposesHost() { | ||||||
|  |     return [this.value, decodeURIComponent(this.value)].some((haystack) => | ||||||
|  |       haystack.includes(getshorthost(this.request.origin)) | ||||||
|  |     ); | ||||||
|  |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user