Central support desk for the Oumta project. Tickets arrive through a
self-hostable support-relay (public form, SMTP out), hyprcrd pulls
them in as cards, replies go back out through the relay, and KB
fragments are plain hyprcrd cards so the board + search + tags
machinery handles them for free.
support-relay/ (standalone PHP/SQLite service)
- Public form + submit endpoint with IP rate-limit, honeypot, and an
email-matched reply path so users can follow up by typing their
OUMTA-n issue id — mismatched email falls back to a fresh ticket
so a hostile submitter can't hijack someone else's thread.
- One-shot setup wizard configures branding, issue-id prefix, public
URL, mail footer template, SMTP creds (stored AES-256-GCM at rest),
and generates the X-Support-Key API token shown exactly once.
- Hyprcrd-facing API: GET /api/hyprcrd/tickets?since=<iso>, POST
…/reply (sends via SMTP, flips status to answered), PATCH
…/status, DELETE, GET /ping, plus GET/POST /api/hyprcrd/settings
exposing brand/public_url/mail_footer for post-setup edits.
- Minimal dependency-free SMTP client covering STARTTLS/TLS/none,
AUTH LOGIN, RFC 2047 subject encoding, dot-stuffing. Extended to
emit multipart/alternative (plain+HTML) + multipart/related so
outbound mails carry the branded logo via Content-ID embedding;
plain-text fallback stays intact for older clients.
- Mail footer template supports {brand}, {issue_id}, {public_url}
placeholders. Lines with an empty placeholder are dropped, so the
"Reply via …" line vanishes cleanly when no public URL is set.
- Favicon on all public pages. Logo (SVG by default, PNG preferred
when both exist) picked up from logo2026col.* at send time.
- Docker: Dockerfile + docker-compose.yml for a stand-alone test
container, plus a support-relay service in the main compose
(profile "support") so hyprcrd can reach it at http://support-relay
without host-networking shenanigans.
public/plugins/support (hyprcrd client)
- Full-screen Support overlay: ticket list (status-filterable),
active ticket thread, reply composer with KB-fragment search +
click-to-insert, "Save as fragment" button, "Close ticket" shortcut.
- KB fragments are regular cards in a configurable bucket. The
composer just adds a fast search-and-insert path on top.
- Sync-tick hook auto-polls the relay alongside the existing CalDAV
+ relay-mail cycle.
- Settings tab in the main overlay: relay URL, API key, inbox / KB
bucket pickers, connection test, and a "Relay config" subsection
that round-trips to /api/hyprcrd/settings so the mail footer and
branding can be edited without touching the relay's DB.
- Local cache tables support_tickets + support_replies mirror the
relay's authoritative data keyed by relay_id.
Tooling
- dev.sh now opts into both relay + support profiles.
- dev-down.sh wipes support-relay volumes and bind-mount data for a
clean re-setup. Hyprcrd + relay data is preserved.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
87 lines
3.4 KiB
PHP
87 lines
3.4 KiB
PHP
<?php if (!defined('SUPPORT_RELAY_BOOTSTRAPPED')) { http_response_code(404); exit; }
|
|
$brand = supportRelayGet($db, 'brand', 'Support');
|
|
$prefix = supportRelayGet($db, 'issue_prefix', 'OUMTA');
|
|
?><!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title><?= htmlspecialchars($brand) ?></title>
|
|
<link rel="icon" type="image/svg+xml" href="favicon.svg">
|
|
<link rel="stylesheet" href="ui/style.css">
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1><?= htmlspecialchars($brand) ?></h1>
|
|
<p class="lede">Describe your issue and we'll reply by email. If you already opened a ticket, enter the <span class="issue-id"><?= htmlspecialchars($prefix) ?>-…</span> id so we can keep the thread together.</p>
|
|
|
|
<div id="banner"></div>
|
|
|
|
<form id="support-form" novalidate>
|
|
<div class="field">
|
|
<label for="email">Your email</label>
|
|
<input id="email" name="email" type="email" required autocomplete="email">
|
|
</div>
|
|
<div class="field">
|
|
<label for="subject">Subject</label>
|
|
<input id="subject" name="subject" type="text" maxlength="200">
|
|
</div>
|
|
<div class="field">
|
|
<label for="body">Message</label>
|
|
<textarea id="body" name="body" required minlength="10" maxlength="10000"></textarea>
|
|
<span class="hint">Markdown is supported. The more specific the better.</span>
|
|
</div>
|
|
<div class="field">
|
|
<label for="issue_id">Reply to existing ticket (optional)</label>
|
|
<input id="issue_id" name="issue_id" type="text" placeholder="<?= htmlspecialchars($prefix) ?>-42" autocomplete="off">
|
|
<span class="hint">Leave empty for a new request.</span>
|
|
</div>
|
|
<div class="honey" aria-hidden="true">
|
|
<label for="website">Website</label>
|
|
<input id="website" name="website" type="text" tabindex="-1" autocomplete="off">
|
|
</div>
|
|
<button type="submit">Send</button>
|
|
</form>
|
|
</main>
|
|
<script>
|
|
const $ = (id) => document.getElementById(id);
|
|
const banner = $('banner');
|
|
function setBanner(text, kind = '') {
|
|
banner.className = 'banner ' + kind;
|
|
banner.textContent = text;
|
|
}
|
|
|
|
$('support-form').addEventListener('submit', async e => {
|
|
e.preventDefault();
|
|
const btn = e.target.querySelector('button[type="submit"]');
|
|
btn.disabled = true; btn.textContent = 'Sending…';
|
|
const payload = {
|
|
email: $('email').value.trim(),
|
|
subject: $('subject').value.trim(),
|
|
body: $('body').value,
|
|
issue_id: $('issue_id').value.trim(),
|
|
website: $('website').value,
|
|
};
|
|
try {
|
|
const res = await fetch('api/submit', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify(payload),
|
|
});
|
|
const data = await res.json();
|
|
if (!res.ok) throw new Error(data.error || 'Submission failed.');
|
|
const msg = data.appended
|
|
? `Added to your existing ticket ${data.issue_id}. We'll get back to you by email.`
|
|
: `Received. Your issue id is ${data.issue_id} — check your inbox for the confirmation.`;
|
|
setBanner(msg, 'ok');
|
|
e.target.reset();
|
|
} catch (err) {
|
|
setBanner(err.message || 'Something went wrong.', 'err');
|
|
} finally {
|
|
btn.disabled = false; btn.textContent = 'Send';
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|