From 6f5f61c5f77b103d424b94652c27edfe65a90ca8 Mon Sep 17 00:00:00 2001 From: Belim Date: Wed, 21 May 2025 17:46:25 +0200 Subject: [PATCH] update log analyzer tool --- docs/log-analyzer/index.bak.html | 52 ------------------ docs/log-analyzer/index.html | 92 +------------------------------- docs/log-analyzer/js/main.js | 86 +++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 142 deletions(-) delete mode 100644 docs/log-analyzer/index.bak.html create mode 100644 docs/log-analyzer/js/main.js diff --git a/docs/log-analyzer/index.bak.html b/docs/log-analyzer/index.bak.html deleted file mode 100644 index 4515c70..0000000 --- a/docs/log-analyzer/index.bak.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Crapfixer Log Analyzer - - - -

๐Ÿง  Crapfixer Log Analyzer

-

- To get started, please follow these simple steps: -

    -
  1. Run the analysis in your Crapfixer app and export or copy the full log from the results window.
  2. -
  3. Come back here and paste the entire log into the textbox below.
  4. -
  5. Click the ๐Ÿ” Analyze button to see a detailed breakdown of issues, registry keys, and plugin files.
  6. -
-

- - -
- - - - diff --git a/docs/log-analyzer/index.html b/docs/log-analyzer/index.html index 651217c..1936a97 100644 --- a/docs/log-analyzer/index.html +++ b/docs/log-analyzer/index.html @@ -141,96 +141,8 @@
- - + + diff --git a/docs/log-analyzer/js/main.js b/docs/log-analyzer/js/main.js new file mode 100644 index 0000000..58618fa --- /dev/null +++ b/docs/log-analyzer/js/main.js @@ -0,0 +1,86 @@ +// read text from clipboard +async function pasteResult() { + try { + const text = await navigator.clipboard.readText(); + if (!text) { + alert("Clipboard is empty"); + return; + } + document.getElementById("logInput").value = text; + analyzeLog(); // direkt analysieren + } catch (err) { + alert("No access to clipboard " + err); + } +} + +// Analyze the pasted log and extract issues, registry keys, and plugin info +function analyzeLog() { + const log = document.getElementById("logInput").value; + const output = document.getElementById("output"); + const lines = log.split("\n"); + + const issues = lines.filter((line) => line.startsWith("โŒ")); + const regKeys = lines.filter((line) => line.includes("HKEY_") || line.includes("โžค")); + const plugins = lines.filter((line) => line.match(/Plugin ready: .*\.ps1/i)); + + output.innerHTML = ` +

๐Ÿงช Found ${issues.length} issues

+
${issues.map((i) => `
${i}
`).join("")}
+
+

๐Ÿ—‚ Registry Keys

+
${regKeys.map((k) => `
${k}
`).join("")}
+
+

๐Ÿ“ฆ Loaded Plugins

+
${plugins.map((p) => `
${p}
`).join("")}
+ `; +} + +// Save screenshot of the output section +function captureResult() { + html2canvas(document.getElementById("output")).then((canvas) => { + const link = document.createElement("a"); + link.download = "CrapFixer-results.png"; + link.href = canvas.toDataURL(); + link.click(); + }); +} + +// Native share (for mobile browsers) +function shareResult() { + const text = document.getElementById("output").innerText; + if (navigator.share) { + navigator + .share({ + title: "CrapFixer Analysis Results", + text: text, + }) + .catch((err) => console.log("Share failed:", err)); + } else { + alert("Sharing is not supported by your browser."); + } +} + +// Share the result as an image on Twitter/X +function shareOnTwitter() { + const outputEl = document.getElementById("output"); + if (!outputEl.innerText.trim()) return alert("No results to share yet."); + + // Create screenshot from result div + html2canvas(outputEl).then((canvas) => { + const dataUrl = canvas.toDataURL("image/png"); + + // Convert image to base64 string (can't upload directly to Twitter) + // Instead, show preview and user uploads manually via prompt + const win = window.open(); + win.document.write(`

๐Ÿ“ท Screenshot ready for X / Twitter

`); + win.document.write( + `

Right-click the image below and save it to upload on Twitter manually.

` + ); + win.document.write( + `` + ); + win.document.write( + `

โžก๏ธ Click here to post on X

` + ); + }); +}