From 05cfd6aaf81e4782e7d9e5d643e6681100317f68 Mon Sep 17 00:00:00 2001 From: ByakuraRinne Date: Thu, 20 Feb 2025 00:13:19 +0100 Subject: [PATCH] V1.2 --- Files/popup.html | 39 ++++++++++++----------- Files/popup.js | 55 ++++++++++++++++++++++++++++++++- Files/style.css | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+), 19 deletions(-) create mode 100644 Files/style.css diff --git a/Files/popup.html b/Files/popup.html index b32d215..5b5e3a0 100644 --- a/Files/popup.html +++ b/Files/popup.html @@ -1,27 +1,30 @@ - + + + Mailcow Temp Mail - + -

Mailcow Temp Mail

- -
- - - -
+
+

🐮 Mailcow Temp Mail

+ +
+ + + +
- diff --git a/Files/popup.js b/Files/popup.js index 3d94ac5..ed94cff 100644 --- a/Files/popup.js +++ b/Files/popup.js @@ -51,4 +51,57 @@ document.getElementById("fetch").addEventListener("click", async () => { if (aliases.length > 0) { const latestEmail = aliases[0].address; document.getElementById("email").value = latestEmail; - } + } else { + document.getElementById("email").value = "No temp email found"; + } + } catch (error) { + console.error(error); + alert("Error fetching email"); + } +}); + +document.getElementById("generate").addEventListener("click", async () => { + const emailPrefix = "temp" + Date.now(); + const domain = "pandem.fr"; + const newEmail = `${emailPrefix}@${domain}`; + + const requestData = { + address: newEmail, + goto: "your_main@pandem.fr", + active: true + }; + + try { + const response = await fetch(API_BASE + ADD_ALIAS_ENDPOINT, { + method: "POST", + credentials: "include", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(requestData) + }); + + if (!response.ok) throw new Error("Failed to generate email"); + + document.getElementById("email").value = newEmail; + alert("New email created: " + newEmail); + } catch (error) { + console.error(error); + alert("Error creating email"); + } +}); + +document.getElementById("copy").addEventListener("click", () => { + const emailField = document.getElementById("email"); + emailField.select(); + document.execCommand("copy"); + alert("Copied: " + emailField.value); +}); + +function showEmailForm() { + document.getElementById("login-form").style.display = "none"; + document.getElementById("email-form").style.display = "block"; +} + +function showLoginForm() { + document.getElementById("login-form").style.display = "block"; + document.getElementById("email-form").style.display = "none"; +} diff --git a/Files/style.css b/Files/style.css new file mode 100644 index 0000000..4b0bd59 --- /dev/null +++ b/Files/style.css @@ -0,0 +1,80 @@ +/* General Styles */ +body { + font-family: "Arial", sans-serif; + background: #f0f4ff; + margin: 0; + padding: 0; + width: 300px; + text-align: center; + } + + /* Container */ + .container { + background: white; + border-radius: 12px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + padding: 20px; + margin: 20px; + } + + /* Heading */ + h2 { + color: #0078D4; + font-size: 18px; + margin-bottom: 15px; + } + + /* Inputs */ + input { + width: 90%; + padding: 10px; + margin-bottom: 10px; + border: 2px solid #0078D4; + border-radius: 6px; + text-align: center; + font-size: 14px; + outline: none; + } + + input:focus { + border-color: #005bb5; + } + + /* Buttons */ + button { + width: 95%; + padding: 10px; + border: none; + background: #0078D4; + color: white; + font-size: 14px; + font-weight: bold; + border-radius: 6px; + cursor: pointer; + transition: 0.3s; + } + + button:hover { + background: #005bb5; + } + + /* Button Group */ + .button-group { + display: flex; + justify-content: space-between; + gap: 5px; + } + + .button-group button { + flex: 1; + } + + /* Logout Button */ + .logout { + background: #D9534F; + } + + .logout:hover { + background: #c9302c; + } + \ No newline at end of file