mirror of
https://github.com/DeNNiiInc/Advanced-Smtp-Tester.git
synced 2026-04-18 01:45:58 +00:00
Feat: Add git commit info badge
This commit is contained in:
108
index.html
108
index.html
@@ -1,10 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Advanced SMTP Tester - Test your SMTP configurations securely and easily." />
|
||||
<meta
|
||||
name="description"
|
||||
content="Advanced SMTP Tester - Test your SMTP configurations securely and easily."
|
||||
/>
|
||||
<title>Advanced SMTP Tester</title>
|
||||
<link rel="icon" type="image/png" href="public/Logo.png" />
|
||||
<link rel="stylesheet" href="public/styles.css" />
|
||||
@@ -14,10 +16,11 @@
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap"
|
||||
rel="stylesheet" />
|
||||
</head>
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body>
|
||||
<!-- Theme Toggle -->
|
||||
<button class="theme-toggle" id="themeToggle" aria-label="Toggle theme">
|
||||
🌙
|
||||
@@ -36,11 +39,16 @@
|
||||
<p class="subtitle">
|
||||
Advanced SMTP Configuration & Delivery Testing Utility
|
||||
</p>
|
||||
<a href="https://www.youtube.com/@beyondcloudtechnology" target="_blank" rel="noopener noreferrer"
|
||||
class="youtube-link">
|
||||
<a
|
||||
href="https://www.youtube.com/@beyondcloudtechnology"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="youtube-link"
|
||||
>
|
||||
<svg class="youtube-icon" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path
|
||||
d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
|
||||
d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"
|
||||
/>
|
||||
</svg>
|
||||
Watch on YouTube @beyondcloudtechnology
|
||||
</a>
|
||||
@@ -74,11 +82,23 @@
|
||||
<!-- Server Details -->
|
||||
<div class="form-group">
|
||||
<label for="host">SMTP Host</label>
|
||||
<input type="text" id="host" name="host" placeholder="smtp.example.com" required />
|
||||
<input
|
||||
type="text"
|
||||
id="host"
|
||||
name="host"
|
||||
placeholder="smtp.example.com"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="port">Port</label>
|
||||
<input type="number" id="port" name="port" placeholder="587" required />
|
||||
<input
|
||||
type="number"
|
||||
id="port"
|
||||
name="port"
|
||||
placeholder="587"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="secure">Encryption</label>
|
||||
@@ -92,13 +112,29 @@
|
||||
<!-- Auth Details -->
|
||||
<div class="form-group">
|
||||
<label for="user">Username / Email</label>
|
||||
<input type="text" id="user" name="user" placeholder="user@example.com" required />
|
||||
<input
|
||||
type="text"
|
||||
id="user"
|
||||
name="user"
|
||||
placeholder="user@example.com"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pass">Password</label>
|
||||
<div class="password-input-wrapper">
|
||||
<input type="password" id="pass" name="pass" placeholder="••••••••" required />
|
||||
<button type="button" class="toggle-password" onclick="togglePassword()">
|
||||
<input
|
||||
type="password"
|
||||
id="pass"
|
||||
name="pass"
|
||||
placeholder="••••••••"
|
||||
required
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="toggle-password"
|
||||
onclick="togglePassword()"
|
||||
>
|
||||
👁️
|
||||
</button>
|
||||
</div>
|
||||
@@ -107,11 +143,22 @@
|
||||
<!-- Email Details -->
|
||||
<div class="form-group">
|
||||
<label for="from">From Address (Optional)</label>
|
||||
<input type="email" id="from" name="from" placeholder="Defaults to Username" />
|
||||
<input
|
||||
type="email"
|
||||
id="from"
|
||||
name="from"
|
||||
placeholder="Defaults to Username"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="to">To Address</label>
|
||||
<input type="email" id="to" name="to" placeholder="recipient@example.com" required />
|
||||
<input
|
||||
type="email"
|
||||
id="to"
|
||||
name="to"
|
||||
placeholder="recipient@example.com"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -147,10 +194,14 @@
|
||||
<div class="history-panel" id="historyPanel">
|
||||
<div class="history-header">
|
||||
<h3>📋 Test History</h3>
|
||||
<button class="clear-history-btn" id="clearHistoryBtn">Clear All</button>
|
||||
<button class="clear-history-btn" id="clearHistoryBtn">
|
||||
Clear All
|
||||
</button>
|
||||
</div>
|
||||
<div id="historyList">
|
||||
<div class="history-empty">No test history yet. Run a test to see it here!</div>
|
||||
<div class="history-empty">
|
||||
No test history yet. Run a test to see it here!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -159,19 +210,30 @@
|
||||
<!-- Footer -->
|
||||
<footer class="footer">
|
||||
<p>© 2025 Beyond Cloud Technology. All rights reserved.</p>
|
||||
<a href="https://github.com/DeNNiiInc/Advanced-Smtp-Tester" target="_blank" rel="noopener noreferrer"
|
||||
class="github-link">
|
||||
<a
|
||||
href="https://github.com/DeNNiiInc/Advanced-Smtp-Tester"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="github-link"
|
||||
>
|
||||
<svg class="github-icon" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path
|
||||
d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
|
||||
d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"
|
||||
/>
|
||||
</svg>
|
||||
View on GitHub
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<!-- Version Badge -->
|
||||
<div id="versionBadge" class="version-badge hidden">
|
||||
<span class="commit-hash"></span>
|
||||
<span class="commit-sep">•</span>
|
||||
<span class="commit-date"></span>
|
||||
</div>
|
||||
|
||||
<script src="public/db.js"></script>
|
||||
<script src="public/script.js"></script>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -469,6 +469,53 @@ document.getElementById('autoTestBtn').addEventListener('click', async function
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// ===================================
|
||||
// VERSION INFO
|
||||
// ===================================
|
||||
async function loadVersionInfo() {
|
||||
try {
|
||||
const response = await fetch('/api/version');
|
||||
const data = await response.json();
|
||||
|
||||
if (data.hash && data.hash !== 'Unknown') {
|
||||
const badge = document.getElementById('versionBadge');
|
||||
const hashSpan = badge.querySelector('.commit-hash');
|
||||
const dateSpan = badge.querySelector('.commit-date');
|
||||
|
||||
hashSpan.textContent = data.hash; // e.g., 9f3a914
|
||||
dateSpan.textContent = timeAgo(new Date(data.date)); // e.g., 3d ago
|
||||
|
||||
badge.classList.remove('hidden');
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Failed to load version info:', e);
|
||||
}
|
||||
}
|
||||
|
||||
function timeAgo(date) {
|
||||
const seconds = Math.floor((new Date() - date) / 1000);
|
||||
|
||||
let interval = seconds / 31536000;
|
||||
if (interval > 1) return Math.floor(interval) + "y ago";
|
||||
|
||||
interval = seconds / 2592000;
|
||||
if (interval > 1) return Math.floor(interval) + "mo ago";
|
||||
|
||||
interval = seconds / 86400;
|
||||
if (interval > 1) return Math.floor(interval) + "d ago";
|
||||
|
||||
interval = seconds / 3600;
|
||||
if (interval > 1) return Math.floor(interval) + "h ago";
|
||||
|
||||
interval = seconds / 60;
|
||||
if (interval > 1) return Math.floor(interval) + "m ago";
|
||||
|
||||
return Math.floor(seconds) + "s ago";
|
||||
}
|
||||
|
||||
// ===================================
|
||||
// INITIALIZATION
|
||||
// ===================================
|
||||
@@ -482,6 +529,9 @@ window.addEventListener('DOMContentLoaded', async () => {
|
||||
// Load history
|
||||
await loadHistory();
|
||||
|
||||
// Load Version Info
|
||||
await loadVersionInfo();
|
||||
|
||||
// Load last used configuration
|
||||
const settings = await window.smtpDB.getSettings();
|
||||
if (settings) {
|
||||
|
||||
@@ -77,12 +77,12 @@ body {
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: radial-gradient(circle at 15% 50%,
|
||||
background: radial-gradient(
|
||||
circle at 15% 50%,
|
||||
var(--gradient-bg-1) 0%,
|
||||
transparent 25%),
|
||||
radial-gradient(circle at 85% 30%,
|
||||
var(--gradient-bg-2) 0%,
|
||||
transparent 25%);
|
||||
transparent 25%
|
||||
),
|
||||
radial-gradient(circle at 85% 30%, var(--gradient-bg-2) 0%, transparent 25%);
|
||||
z-index: -1;
|
||||
pointer-events: none;
|
||||
transition: background 0.3s ease;
|
||||
@@ -276,9 +276,11 @@ select:focus {
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: linear-gradient(135deg,
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--accent-primary),
|
||||
var(--accent-hover));
|
||||
var(--accent-hover)
|
||||
);
|
||||
color: white;
|
||||
box-shadow: 0 4px 12px var(--accent-glow);
|
||||
}
|
||||
@@ -449,7 +451,7 @@ select:focus {
|
||||
.github-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}/* Theme Toggle Button */
|
||||
} /* Theme Toggle Button */
|
||||
.theme-toggle {
|
||||
position: fixed;
|
||||
top: 1.5rem;
|
||||
@@ -663,3 +665,51 @@ select:focus {
|
||||
.log-output::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* Version Badge */
|
||||
.version-badge {
|
||||
position: fixed;
|
||||
bottom: 1.5rem;
|
||||
right: 1.5rem;
|
||||
background: rgba(15, 23, 42, 0.8);
|
||||
backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 20px;
|
||||
padding: 0.4rem 0.8rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.85rem;
|
||||
z-index: 1000;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
[data-theme="light"] .version-badge {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
border-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.version-badge:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.commit-hash {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
color: #a78bfa; /* Slightly purple to match example */
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
[data-theme="light"] .commit-hash {
|
||||
color: #7c3aed;
|
||||
}
|
||||
|
||||
.commit-sep {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.6rem;
|
||||
}
|
||||
|
||||
.commit-date {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
20
server.js
20
server.js
@@ -3,10 +3,25 @@ const nodemailer = require("nodemailer");
|
||||
const bodyParser = require("body-parser");
|
||||
const cors = require("cors");
|
||||
const path = require("path");
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3000;
|
||||
|
||||
// Get Git Commit Info
|
||||
let gitInfo = {
|
||||
hash: 'Unknown',
|
||||
date: 'Unknown'
|
||||
};
|
||||
|
||||
try {
|
||||
const hash = execSync('git log -1 --format="%h"').toString().trim();
|
||||
const date = execSync('git log -1 --format="%cd"').toString().trim();
|
||||
gitInfo = { hash, date };
|
||||
} catch (e) {
|
||||
console.warn("Could not retrieve git info:", e.message);
|
||||
}
|
||||
|
||||
app.use(cors());
|
||||
app.use(bodyParser.json());
|
||||
|
||||
@@ -18,6 +33,11 @@ app.get('/', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'index.html'));
|
||||
});
|
||||
|
||||
// API Endpoint for Version Info
|
||||
app.get('/api/version', (req, res) => {
|
||||
res.json(gitInfo);
|
||||
});
|
||||
|
||||
app.post('/api/test-smtp', async (req, res) => {
|
||||
const { host, port, secure, user, pass, from, to } = req.body;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user