This is an automated email from the ASF dual-hosted git repository.

jky pushed a commit to branch mv3-migrate
in repository https://gitbox.apache.org/repos/asf/flagon.git

commit 08055fc6d20972eb00761f972b9992d6404f2b60
Merge: 54f7936 300afec
Author: Jason Young <jk...@pm.me>
AuthorDate: Mon Jun 23 14:20:19 2025 -0700

    Merge remote-tracking branch 'mederick/update-site' into mv3-migrate

 .husky/pre-commit                                  |   83 +
 eslint.config.js                                   |   34 +
 package-lock.json                                  | 1877 ++++++++++++++++++++
 package.json                                       |   23 +
 .../flagon-userale-ext/src/background/ports/log.ts |    4 +-
 .../packages/flagon-userale-ext/src/content.ts     |   13 +-
 .../flagon-userale-ext/src/options/auth.tsx        |   55 +-
 .../flagon-userale-ext/src/options/index.tsx       |    8 +-
 .../flagon-userale-ext/src/options/logging.tsx     |   32 +-
 .../packages/flagon-userale-ext/src/popup.tsx      |    8 +-
 .../flagon-userale-ext/src/utils/storage.ts        |   37 +-
 .../userale/packages/flagon-userale/src/main.ts    |    2 +-
 .../packages/flagon-userale/src/packageLogs.ts     |    2 +-
 .../packages/flagon-userale/src/sendLogs.ts        |   12 +-
 .../flagon-userale/src/utils/auth/index.ts         |    2 +-
 .../flagon-userale/src/utils/headers/index.ts      |    2 +-
 site/_includes/head.html                           |   10 +-
 site/_includes/useralejsDemo.html                  |    6 +-
 site/assets/d3.v4.min.js                           |    2 +
 site/assets/jquery.min.js                          |    4 +
 site/assets/leaflet/images/layers.svg              |    8 +
 site/assets/leaflet/images/marker.svg              |   61 +
 site/assets/leaflet/leaflet.css                    |  479 +++++
 site/assets/leaflet/leaflet.js                     |    9 +
 24 files changed, 2676 insertions(+), 97 deletions(-)

diff --cc 
products/userale/packages/flagon-userale-ext/src/background/ports/log.ts
index ec9f4ee,b2f43e6..445e34e
--- a/products/userale/packages/flagon-userale-ext/src/background/ports/log.ts
+++ b/products/userale/packages/flagon-userale-ext/src/background/ports/log.ts
@@@ -12,17 -14,4 +12,17 @@@ const handler: PlasmoMessaging.PortHand
    }
  }
  
 +let browserSessionId = generateSessionId();
 +
 +// TODO move this to a shared utils workspace (this is from 
packages/flagon-userale/src/, but shouldn't be publicly exported)
 +function generateSessionId(): string {
 +    // 32 digit hex -> 128 bits of info -> 2^64 ~= 10^19 sessions needed for 
50% chance of collison
 +    const len = 32;
 +    const arr = new Uint8Array(len / 2);
 +    self.crypto.getRandomValues(arr);
 +    return Array.from(arr, (dec) => {
 +      return dec.toString(16).padStart(2, "0");
 +    }).join("");
 +}
-  
- export default handler;
++
+ export default handler
diff --cc products/userale/packages/flagon-userale-ext/src/content.ts
index e2e5551,c2ab846..e31c14d
--- a/products/userale/packages/flagon-userale-ext/src/content.ts
+++ b/products/userale/packages/flagon-userale-ext/src/content.ts
@@@ -11,29 -12,10 +12,29 @@@ const logPort = getPort("log"
  
  userale.addCallbacks({
    rerouteLog(log) {
 -    console.log(log)
 -    logPort.postMessage(log)
 -    return false
 +    console.log(log);
 +    logPort.postMessage({body: log});
 +    return false;
    }
- });
+ })
  
 -userale.start()
 +chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
 +  if( message.type == "tab-event") {
 +    const { type, tab, data } = message.payload;
 +    userale.packageCustomLog(
 +      {type},
 +      () => { return data; },
 +      true,
 +    );
 +    sendResponse({ status: "received" });
 +  } else if (message.type === "issue-report") {
 +    userale.packageCustomLog(
 +      {type: message.type},
 +      () => { return message.payload; },
 +      true,
 +    );
 +    sendResponse({ status: "received" });
 +  }  
 +
 +  return true 
 +})
diff --cc products/userale/packages/flagon-userale-ext/src/popup.tsx
index 43a8ee4,f6055e4..42216a6
--- a/products/userale/packages/flagon-userale-ext/src/popup.tsx
+++ b/products/userale/packages/flagon-userale-ext/src/popup.tsx
@@@ -1,32 -1,16 +1,32 @@@
 -import { useState } from "react"
 -
 -import Options from "~/options"
 +import { useState } from "react";
 +import Options from "~/options";
 +import { sendToContent } from "~utils/messaging"
  
  function IndexPopup() {
-   const [issueType, setIssueType] = useState("Bug");
-   const [issueDescription, setIssueDescription] = useState("");
+   const [issueType, setIssueType] = useState("Bug")
+   const [issueDescription, setIssueDescription] = useState("")
  
 -  const handleSubmit = (e: React.FormEvent) => {
 +  const handleSubmit = async (e: React.FormEvent) => {
      e.preventDefault()
 -    // TODO add messaging
 -  }
  
 +    try {
 +      const [tab] = await chrome.tabs.query({ active: true, currentWindow: 
true });
 +      if (!tab?.id) throw new Error("No active tab found");
 +      const response = await sendToContent(tab.id, {
 +        type: "issue-report",
 +        payload: {
 +          issueType,
 +          issueDescription
 +        }
 +      });
 +      console.log("Content script response:", response)
 +      alert("Issue report sent!")
 +      setIssueDescription("") // clear after send
 +    } catch (error) {
 +      console.error("Failed to send message", error)
 +      alert("Failed to send issue report.")
 +    }
 +  }
    return (
      <div>
        <Options />
diff --cc products/userale/packages/flagon-userale-ext/src/utils/storage.ts
index 4e1e261,4c31132..034fc10
--- a/products/userale/packages/flagon-userale-ext/src/utils/storage.ts
+++ b/products/userale/packages/flagon-userale-ext/src/utils/storage.ts
@@@ -35,20 -36,16 +36,20 @@@ export async function getStoredOptions(
  
  // Only to be used in ~/options
  export async function setStoredOptions(values: Partial<StoredOptions>) {
 +  // Validate the new options
    try {
-     new RegExp(values.allowList);
-     new URL(values.loggingUrl);
+     new RegExp(values.allowList)
+     new URL(values.loggingUrl)
    } catch (error) {
-     return error;
+     return error
    }
 +  
 +  // Store the options for after the browser is closed
 +  await browser.storage.local.set(values);
  
 -  await browser.storage.local.set(values)
 +  // Notify the background script of the change
    return await sendToBackground({
      name: "config_change",
 -    body: { values }
 +    body: values
    })
 -}
 +}

Reply via email to