From 68b4469dec4d3c4b8ed067ccd0291032a6b25353 Mon Sep 17 00:00:00 2001 From: Twelveeee Date: Wed, 22 Apr 2026 16:23:16 +0800 Subject: [PATCH] feat: improve Cloudflare Temp Email random subdomain flow and sidepanel UX --- background.js | 3 + background/generated-email-helpers.js | 1 + sidepanel/sidepanel.css | 13 + sidepanel/sidepanel.html | 75 +++-- sidepanel/sidepanel.js | 126 +++++++- ...und-cloudflare-temp-email-settings.test.js | 145 +++++++++ .../background-generated-email-module.test.js | 169 +++++++++- ...dflare-temp-email-random-subdomain.test.js | 297 ++++++++++++++++++ tests/sidepanel-contribution-mode.test.js | 3 + 9 files changed, 792 insertions(+), 40 deletions(-) create mode 100644 tests/background-cloudflare-temp-email-settings.test.js create mode 100644 tests/sidepanel-cloudflare-temp-email-random-subdomain.test.js diff --git a/background.js b/background.js index 7297909..3b68339 100644 --- a/background.js +++ b/background.js @@ -280,6 +280,7 @@ const PERSISTED_SETTING_DEFAULTS = { cloudflareTempEmailAdminAuth: '', cloudflareTempEmailCustomAuth: '', cloudflareTempEmailReceiveMailbox: '', + cloudflareTempEmailUseRandomSubdomain: false, cloudflareTempEmailDomain: '', cloudflareTempEmailDomains: [], hotmailAccounts: [], @@ -827,6 +828,7 @@ function getCloudflareTempEmailConfig(state = {}) { adminAuth: String(state.cloudflareTempEmailAdminAuth || ''), customAuth: String(state.cloudflareTempEmailCustomAuth || ''), receiveMailbox: normalizeCloudflareTempEmailReceiveMailbox(state.cloudflareTempEmailReceiveMailbox), + useRandomSubdomain: Boolean(state.cloudflareTempEmailUseRandomSubdomain), domain: normalizeCloudflareTempEmailDomain(state.cloudflareTempEmailDomain), domains: normalizeCloudflareTempEmailDomains(state.cloudflareTempEmailDomains), }; @@ -895,6 +897,7 @@ function normalizePersistentSettingValue(key, value) { return normalizeEmailGenerator(value); case 'autoDeleteUsedIcloudAlias': case 'accountRunHistoryTextEnabled': + case 'cloudflareTempEmailUseRandomSubdomain': return Boolean(value); case 'icloudHostPreference': return normalizeIcloudHost(value) || 'auto'; diff --git a/background/generated-email-helpers.js b/background/generated-email-helpers.js index 3d924a7..7db5c98 100644 --- a/background/generated-email-helpers.js +++ b/background/generated-email-helpers.js @@ -146,6 +146,7 @@ const requestedName = String(options.localPart || options.name || '').trim().toLowerCase() || generateCloudflareAliasLocalPart(); const payload = { enablePrefix: true, + enableRandomSubdomain: Boolean(config.useRandomSubdomain), name: requestedName, domain: config.domain, }; diff --git a/sidepanel/sidepanel.css b/sidepanel/sidepanel.css index f40f857..aa9e607 100644 --- a/sidepanel/sidepanel.css +++ b/sidepanel/sidepanel.css @@ -2393,6 +2393,19 @@ header { line-height: 1.55; color: var(--text-secondary); margin-bottom: 14px; + white-space: pre-line; +} + +.modal-message a, +.modal-alert a { + color: var(--blue); + text-decoration: underline; + text-underline-offset: 2px; +} + +.modal-message a:hover, +.modal-alert a:hover { + color: var(--cyan); } .modal-alert { diff --git a/sidepanel/sidepanel.html b/sidepanel/sidepanel.html index 6b75d35..7cb4fba 100644 --- a/sidepanel/sidepanel.html +++ b/sidepanel/sidepanel.html @@ -235,31 +235,6 @@ - - - - - +