V1.2
This commit is contained in:
parent
b15651b5b3
commit
05cfd6aaf8
3 changed files with 155 additions and 19 deletions
|
@ -1,27 +1,30 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Mailcow Temp Mail</title>
|
<title>Mailcow Temp Mail</title>
|
||||||
<style>
|
<link rel="stylesheet" href="style.css">
|
||||||
body { width: 250px; padding: 10px; font-family: Arial, sans-serif; }
|
|
||||||
button, input { width: 100%; padding: 5px; margin-top: 5px; }
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h3>Mailcow Temp Mail</h3>
|
<div class="container">
|
||||||
|
<h2>🐮 Mailcow Temp Mail</h2>
|
||||||
<div id="login-form">
|
|
||||||
<input type="text" id="username" placeholder="Email">
|
<div id="login-form">
|
||||||
<input type="password" id="password" placeholder="Password">
|
<input type="text" id="username" placeholder="📧 Email">
|
||||||
<button id="login">Login</button>
|
<input type="password" id="password" placeholder="🔒 Password">
|
||||||
</div>
|
<button id="login">Login</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="email-form" style="display: none;">
|
<div id="email-form" style="display: none;">
|
||||||
<input type="text" id="email" readonly placeholder="No email found">
|
<input type="text" id="email" readonly placeholder="No email found">
|
||||||
<button id="fetch">Get My Temp Email</button>
|
<div class="button-group">
|
||||||
<button id="generate">Generate New Email</button>
|
<button id="fetch">🔄 Get My Temp Email</button>
|
||||||
<button id="copy">Copy to Clipboard</button>
|
<button id="generate">✨ Generate New Email</button>
|
||||||
<button id="logout">Logout</button>
|
</div>
|
||||||
|
<button id="copy">📋 Copy to Clipboard</button>
|
||||||
|
<button id="logout" class="logout">🚪 Logout</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="popup.js"></script>
|
<script src="popup.js"></script>
|
||||||
|
|
|
@ -51,4 +51,57 @@ document.getElementById("fetch").addEventListener("click", async () => {
|
||||||
if (aliases.length > 0) {
|
if (aliases.length > 0) {
|
||||||
const latestEmail = aliases[0].address;
|
const latestEmail = aliases[0].address;
|
||||||
document.getElementById("email").value = latestEmail;
|
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";
|
||||||
|
}
|
||||||
|
|
80
Files/style.css
Normal file
80
Files/style.css
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue