- internal/mailfetch: stdlib-only read-only IMAP client (LOGIN, SELECT, UID SEARCH, UID FETCH) that always dials tcp4; IPv6 to Gmail is broken from .13 and caused a socket EOF. - MIME parsing to text, RFC2047 header decoding, FR-2 source address: X-Pm-Original-To -> To -> Received 'for <addr>' -> Return-Path, never Delivered-To. The matched header is recorded for audit. - store: Message upsert/list/count + LogAction; schema migration v2 adds imap_uid and imap_uidvalidity. - server: dashboard and /partials/inbox render real mail grouped by category with a recommended action; POST /actions/fetch runs a scan (CSRF-checked); nav counts; 'Check mail' button. - config: GMAIL_USER, GMAIL_APP_PASSWORD, IMAP host/port/lookback/max. - cmd: -fetch runs one scan and exits (n8n/CLI entry point, FR-1). - compose/.env.example expose the Gmail + IMAP settings. - tests: FR-2 precedence, MIME bodies, IMAP literal/parser, store upsert/migration, inbox rendering. Co-Authored-By: Paperclip <noreply@paperclip.ing>
110 lines
4.0 KiB
HTML
110 lines
4.0 KiB
HTML
<!doctype html>
|
|
<html lang="en" data-theme="light">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Email Agent</title>
|
|
<link rel="stylesheet" href="/static/tokens.css">
|
|
<link rel="stylesheet" href="/static/app.css">
|
|
<script>
|
|
(function () {
|
|
try {
|
|
var t = localStorage.getItem("ea-theme");
|
|
if (!t) t = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
document.documentElement.setAttribute("data-theme", t);
|
|
} catch (e) {}
|
|
})();
|
|
function eaToggleTheme() {
|
|
var el = document.documentElement;
|
|
var next = el.getAttribute("data-theme") === "dark" ? "light" : "dark";
|
|
el.setAttribute("data-theme", next);
|
|
try { localStorage.setItem("ea-theme", next); } catch (e) {}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<header class="nav-bar">
|
|
<span class="wordmark">Email Agent</span>
|
|
<div class="nav-actions">
|
|
<button class="btn btn-utility theme-toggle" type="button" onclick="eaToggleTheme()" aria-label="Toggle dark mode">
|
|
<span class="icon-light" aria-hidden="true">☾</span>
|
|
<span class="icon-dark" aria-hidden="true">☀</span>
|
|
</button>
|
|
<form method="post" action="/logout">
|
|
<input type="hidden" name="csrf" value="{{.CSRFToken}}">
|
|
<button class="btn btn-utility" type="submit">Log out</button>
|
|
</form>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="page">
|
|
<h1 class="greeting">{{.Greeting}}, Sam</h1>
|
|
|
|
<div class="shell">
|
|
<aside class="panel" aria-label="Categories and folders">
|
|
<div class="nav-groups">
|
|
<div class="nav-group">
|
|
<div class="nav-group-title">Categories</div>
|
|
<div class="nav-group-items">
|
|
<a class="nav-item nav-item-active" href="#">
|
|
<span class="dot" style="background: var(--primary)"></span>
|
|
<span>All mail</span>
|
|
<span class="count">{{.Total}}</span>
|
|
</a>
|
|
{{range .Categories}}
|
|
<a class="nav-item" href="#">
|
|
<span class="dot" style="background: {{.Color}}"></span>
|
|
<span>{{.Name}}</span>
|
|
<span class="count">{{.Count}}</span>
|
|
</a>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="nav-group">
|
|
<div class="nav-group-title">Folders</div>
|
|
<div class="nav-group-items">
|
|
{{range .Folders}}
|
|
<a class="nav-item" href="#">
|
|
<span class="dot" style="background: {{.Color}}"></span>
|
|
<span>{{.Name}}</span>
|
|
<span class="count">0</span>
|
|
</a>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
|
|
<section class="panel" aria-label="Message list">
|
|
<div class="panel-head">
|
|
<h2>Inbox</h2>
|
|
<div class="panel-actions">
|
|
<button class="btn btn-primary" type="button"
|
|
hx-post="/actions/fetch" hx-target="#inbox-list" hx-swap="innerHTML"
|
|
hx-headers='{"X-CSRF-Token": "{{.CSRFToken}}"}'>
|
|
Check mail
|
|
</button>
|
|
<button class="btn btn-utility" type="button"
|
|
hx-get="/partials/inbox" hx-target="#inbox-list" hx-swap="innerHTML">
|
|
Refresh
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div id="inbox-list" class="msg-list"
|
|
hx-get="/partials/inbox" hx-trigger="load" hx-swap="innerHTML"></div>
|
|
</section>
|
|
|
|
<aside class="panel detail-pane" aria-label="Message detail">
|
|
<div class="panel-head"><h2>Message</h2></div>
|
|
<div class="detail-body">
|
|
<p class="muted">Select a message to read it here.</p>
|
|
<p class="faint" style="margin-top: var(--space-xs);">Recommended action, reply draft, and history will appear in this pane.</p>
|
|
</div>
|
|
</aside>
|
|
</div>
|
|
</main>
|
|
|
|
<script src="/static/htmx.min.js" defer></script>
|
|
</body>
|
|
</html>
|