From 7858ee35464cd13b1d766d98d1aceeec0875cc0e Mon Sep 17 00:00:00 2001 From: Jonah <73760377+jonerrr@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:26:55 -0500 Subject: [PATCH] dont hash websites in private comment --- src/popup.tsx | 7 ++++--- src/utils.ts | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/popup.tsx b/src/popup.tsx index ffd67b0..3506e8a 100644 --- a/src/popup.tsx +++ b/src/popup.tsx @@ -7,6 +7,7 @@ import { ThemeProvider } from "~theme" import { type Alias, type Settings, fetchAliases, generateHash } from "~utils" export default function IndexPopup() { + //TODO: rename because its no longer a hash const [siteHash, setSiteHash] = useState() const [aliases, setAliases] = useState([]) const [loading, setLoading] = useState(true) @@ -18,8 +19,8 @@ export default function IndexPopup() { chrome.tabs.query( { active: true, windowId: chrome.windows.WINDOW_ID_CURRENT }, async (t) => - // create a sha-256 hash with the URL hostname - setSiteHash(await generateHash(new URL(t[0].url!).hostname)) + + setSiteHash(new URL(t[0].url!).hostname) ) const configured = @@ -35,7 +36,7 @@ export default function IndexPopup() { return } - ;(async () => { + ; (async () => { await new Promise((r) => setTimeout(r, 1000)) setAliases(await fetchAliases(settings as Required)) setLoading(false) diff --git a/src/utils.ts b/src/utils.ts index fc5436c..ead6ad2 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -114,7 +114,8 @@ export async function generateAlias( hostname?: string ): Promise { const address = generateEmail(settings, hostname) - const hash = await generateHash(hostname ?? "no") + // const hash = await generateHash(hostname ?? "no") + const hash = hostname ?? 'nohostname' // although mailcow has its own date, the format they use sucks const createdAt = Date.now() @@ -227,9 +228,8 @@ export function generateEmail( ): string { switch (settings.generationMethod) { case GenerationMethod.RandomCharacters: - return `${randAlphaNumeric({ length: 16 }).join("")}@${ - settings.aliasDomain - }` + return `${randAlphaNumeric({ length: 16 }).join("")}@${settings.aliasDomain + }` case GenerationMethod.RandomName: const domain = settings.aliasDomain.split(".") ?? "example.com"