Merge branch 'feat/popups-detail-pages'
This commit is contained in:
@@ -5,6 +5,24 @@ versions follow [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.17.0] - 2026-11-23
|
||||
|
||||
Frontend only: no migration, no API changes. With 2.16.0, no add or edit is left open on a page.
|
||||
|
||||
### Changed
|
||||
|
||||
- **A server's page**: Configuration shows its values, and Edit opens them in a popup. **Update
|
||||
agent** is a popup from the Actions card.
|
||||
- **frp config** shows the file read-only, with Where the file is and Read now on the card; Edit
|
||||
opens the file in a popup with Restart afterwards, the two-factor code and Save on the server.
|
||||
- **Ports & defaults**: the install defaults, port range and central server IP show as values with
|
||||
an Edit popup; **Mark as taken** is a button on the port list that opens a popup.
|
||||
- **An install's page (Installs)**: Clear public key is a popup with the two-factor code, and the
|
||||
notes show as text with an Edit popup. Its message is under the header.
|
||||
- **An invoice** always shows its lines and totals; Edit (drafts and approved invoices) opens them
|
||||
in a popup, so Approve no longer asks you to save first. **Void** asks for its reason and
|
||||
**Refund** for its note in a popup instead of the browser's prompt.
|
||||
|
||||
## [2.16.0] - 2026-11-23
|
||||
|
||||
Frontend only: no migration, no API changes.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "events-hub-backend",
|
||||
"version": "2.16.0",
|
||||
"version": "2.17.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "events-hub-backend",
|
||||
"version": "2.16.0",
|
||||
"version": "2.17.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sdk": "^1.3.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "events-hub-backend",
|
||||
"version": "2.16.0",
|
||||
"version": "2.17.0",
|
||||
"private": true,
|
||||
"description": "Cross Events Hub — API for managing Cross Events installs, licences and heartbeats",
|
||||
"main": "src/index.js",
|
||||
|
||||
+5
-4
@@ -1,6 +1,6 @@
|
||||
# Popups everywhere plan
|
||||
|
||||
Status: Step 0 and Hub 2.16.0 done; 2.17.0 next · 2026-11-23
|
||||
Status: done in Hub 2.16.0 and 2.17.0 (Step 0 before them) · 2026-11-23
|
||||
|
||||
Hub 2.14.0 added `Modal` and made every add or edit on the customer page a popup; 2.15.0 did the same
|
||||
for the install page. The rest of the Hub still opens forms inline: a form card above a list, a card
|
||||
@@ -38,6 +38,7 @@ Paths are under `frontend/src/`.
|
||||
| 15 | `app/(hub)/servers/settings/page.tsx` | **Mark as taken** (a port): inline form |
|
||||
| 16 | `app/(hub)/installs/[id]/page.tsx` | **Clear public key**: two-factor form inside the card |
|
||||
| 17 | `app/(hub)/billing/invoices/[id]/page.tsx` | A draft or approved invoice is always editable on the page, with a "Save your changes first" guard before Approve |
|
||||
| 18 | `app/(hub)/installs/[id]/page.tsx` | **Notes**: textarea and Save notes, always open (found while building 2.17.0) |
|
||||
|
||||
Optional: **Void** and **Refund** on the invoice page ask for a reason or note with `prompt()`. They are
|
||||
small forms, but 2.15.0 left confirmations as they are.
|
||||
@@ -75,7 +76,7 @@ fades) instead of `Message`.
|
||||
- **One-off invoice**: Billing opens `OneOffInvoice`; with no `customerId` it shows a church picker.
|
||||
`/billing/invoices/new` redirects to `/billing?oneoff=1`, which opens the popup, and `NewInvoice` goes.
|
||||
|
||||
## Hub 2.17.0: server, settings and invoice pages (11-17)
|
||||
## Hub 2.17.0: server, settings and invoice pages (11-18)
|
||||
|
||||
- **Server configuration**: a read view (secrets as dots) with an Edit popup, as `EnvPanel` in 2.15.0.
|
||||
- **frp config**: the path, Use this path and Read now stay on the card, the file shows read-only, and
|
||||
@@ -83,10 +84,10 @@ fades) instead of `Message`.
|
||||
- **Update agent**: a small popup from the Actions card. Remove server is unchanged.
|
||||
- **Install defaults**: a read view with an Edit popup. **Mark as taken**: a button and a small popup.
|
||||
- **Clear public key**: a danger button opening a popup with the explanation and the two-factor code
|
||||
(`ModalButtons danger`).
|
||||
(`ModalButtons danger`). The install's **Notes** show as text with an Edit popup.
|
||||
- **Invoice**: always the read view (lines and totals), with **Edit** on drafts and approved invoices
|
||||
opening a wide popup (dates, recipient, `LinesEditor`, notes). The dirty guard on Approve goes.
|
||||
- Optional: **Void** and **Refund** as popups with a text field instead of `prompt()`.
|
||||
- **Void** and **Refund** as popups with a text field instead of `prompt()` (done in 2.17.0).
|
||||
|
||||
## Checks for every popup
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.16.0",
|
||||
"version": "2.17.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.16.0",
|
||||
"version": "2.17.0",
|
||||
"dependencies": {
|
||||
"lucide-react": "^0.536.0",
|
||||
"next": "^15.5.24",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.16.0",
|
||||
"version": "2.17.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3200",
|
||||
|
||||
@@ -1,35 +1,101 @@
|
||||
"use client";
|
||||
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { AlertTriangle, ArrowLeft, Check, FileText, RefreshCw, Send, Star, Undo2, XCircle } from "lucide-react";
|
||||
import { AlertTriangle, ArrowLeft, Check, FileText, Pencil, RefreshCw, Send, Star, Undo2, XCircle } from "lucide-react";
|
||||
import { api, errorText, openPdf } from "@/lib/api";
|
||||
import { fmtDate } from "@/lib/format";
|
||||
import { Loading, Message, PageTitle } from "@/components/ui";
|
||||
import { FormError, Loading, Message, Modal, ModalButtons, PageMessage, PageTitle, useSubmit } from "@/components/ui";
|
||||
import { EMAIL_KIND, METHOD, StateBadge, day, money, todayYmd, type BillingEmail, type Invoice, type LicenceChange } from "@/lib/billing";
|
||||
import { LinesEditor, fromEdit, toEdit, type EditLine } from "@/components/billing/LinesEditor";
|
||||
import { LinesEditor, fromEdit, toEdit } from "@/components/billing/LinesEditor";
|
||||
import { RecordPayment } from "@/components/billing/RecordPayment";
|
||||
import { PRODUCT_NAMES } from "@/lib/products";
|
||||
|
||||
type Msg = { type: "ok" | "err"; text: string } | null;
|
||||
type Detail = Invoice & { licenceChanges: LicenceChange[]; emails: BillingEmail[] };
|
||||
|
||||
type Payment = Invoice["payments"][number];
|
||||
|
||||
/** Hub 2.17.0: a draft or approved invoice edited in a popup (it was always open on the page). */
|
||||
function EditInvoiceModal({ inv, onClose, onSaved }: { inv: Detail; onClose: () => void; onSaved: (text: string) => void }) {
|
||||
const initial = useMemo(() => ({ form: { issueDate: inv.issueDate, dueDate: inv.dueDate, recipientEmail: inv.recipientEmail || "", notes: inv.notes || "" }, lines: toEdit(inv.lines) }), [inv]);
|
||||
const [form, setForm] = useState(initial.form);
|
||||
const [lines, setLines] = useState(initial.lines);
|
||||
const { busy, error, run } = useSubmit();
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
run(async () => {
|
||||
await api(`/api/admin/billing/invoices/${inv.id}`, { method: "PUT", body: { ...form, lines: fromEdit(lines) } });
|
||||
onSaved(inv.status === "approved" ? "Saved. It's still approved and goes out on its date." : "Saved.");
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Modal title={`Edit ${inv.number}`} onClose={onClose} dirty={JSON.stringify({ form, lines }) !== JSON.stringify(initial)} wide>
|
||||
<form onSubmit={save} className="space-y-4">
|
||||
<div className="grid gap-3 sm:grid-cols-3">
|
||||
<div><label className="label" htmlFor="inv-date">Date (goes out)</label><input id="inv-date" type="date" className="input" value={form.issueDate} onChange={e => setForm({ ...form, issueDate: e.target.value })} /></div>
|
||||
<div><label className="label" htmlFor="inv-due">Due</label><input id="inv-due" type="date" className="input" value={form.dueDate} onChange={e => setForm({ ...form, dueDate: e.target.value })} /></div>
|
||||
<div><label className="label" htmlFor="inv-to">Send to</label><input id="inv-to" type="email" className="input" value={form.recipientEmail} onChange={e => setForm({ ...form, recipientEmail: e.target.value })} /></div>
|
||||
</div>
|
||||
<LinesEditor lines={lines} onChange={setLines} />
|
||||
<div><label className="label" htmlFor="inv-notes">Notes (printed on the invoice)</label><textarea id="inv-notes" className="input" rows={2} value={form.notes} onChange={e => setForm({ ...form, notes: e.target.value })} /></div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} label="Save changes" />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/** Hub 2.17.0: Void with its reason in a popup (it was a prompt). */
|
||||
function VoidModal({ inv, onClose, onDone }: { inv: Detail; onClose: () => void; onDone: (text: string) => void }) {
|
||||
const [reason, setReason] = useState("");
|
||||
const { busy, error, run } = useSubmit();
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
run(async () => { await api(`/api/admin/billing/invoices/${inv.id}/void`, { method: "POST", body: { reason } }); onDone(`${inv.number} is void.`); });
|
||||
};
|
||||
return (
|
||||
<Modal title={`Void ${inv.number}`} onClose={onClose} dirty={reason !== ""}>
|
||||
<form onSubmit={save} className="space-y-3">
|
||||
<p className="text-sm text-slate-600">It stays on record, marked void.</p>
|
||||
<div><label className="label" htmlFor="void-reason">Why (printed on it)</label><textarea id="void-reason" className="input" rows={2} value={reason} onChange={e => setReason(e.target.value)} /></div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} label="Void invoice" busyLabel="Voiding…" danger />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/** Hub 2.17.0: mark a payment as refunded, with an optional note, in a popup (it was a prompt). */
|
||||
function RefundModal({ p, onClose, onDone }: { p: Payment; onClose: () => void; onDone: (text: string) => void }) {
|
||||
const [note, setNote] = useState("");
|
||||
const { busy, error, run } = useSubmit();
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
run(async () => { const r = await api<{ message: string }>(`/api/admin/billing/payments/${p.id}/refund`, { method: "POST", body: { note } }); onDone(r.message); });
|
||||
};
|
||||
return (
|
||||
<Modal title={`Refund ${p.receiptNumber}`} onClose={onClose} dirty={note !== ""}>
|
||||
<form onSubmit={save} className="space-y-3">
|
||||
<p className="text-sm text-slate-600">Mark {p.receiptNumber} ({money(p.amountCents)}) as refunded to the church? It stays on record, no longer counts as paid, and the statement shows the refund.</p>
|
||||
<div><label className="label" htmlFor="refund-note">Note (optional, e.g. the EFT reference)</label><input id="refund-note" className="input" value={note} onChange={e => setNote(e.target.value)} /></div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} label="Mark as refunded" busyLabel="Saving…" />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
function InvoiceDetail({ id }: { id: string }) {
|
||||
const [inv, setInv] = useState<Detail | null>(null);
|
||||
const [form, setForm] = useState({ issueDate: "", dueDate: "", recipientEmail: "", notes: "" });
|
||||
const [lines, setLines] = useState<EditLine[]>([]);
|
||||
const [dirty, setDirty] = useState(false);
|
||||
const [msg, setMsg] = useState<Msg>(null);
|
||||
const [busy, setBusy] = useState<string | null>(null);
|
||||
const [paying, setPaying] = useState(false);
|
||||
// Hub 2.17.0: the popup that's open (a refund holds its payment).
|
||||
const [popup, setPopup] = useState<"edit" | "void" | Payment | null>(null);
|
||||
|
||||
const load = useCallback(() => api<Detail>(`/api/admin/billing/invoices/${id}`).then(x => {
|
||||
setInv(x);
|
||||
setForm({ issueDate: x.issueDate, dueDate: x.dueDate, recipientEmail: x.recipientEmail || "", notes: x.notes || "" });
|
||||
setLines(toEdit(x.lines));
|
||||
setDirty(false);
|
||||
}).catch(e => setMsg({ type: "err", text: errorText(e) })), [id]);
|
||||
const load = useCallback(() => api<Detail>(`/api/admin/billing/invoices/${id}`).then(setInv).catch(e => setMsg({ type: "err", text: errorText(e) })), [id]);
|
||||
useEffect(() => { load(); }, [load]);
|
||||
|
||||
if (!inv) return msg ? <Message msg={msg} /> : <Loading />;
|
||||
@@ -45,27 +111,12 @@ function InvoiceDetail({ id }: { id: string }) {
|
||||
} catch (e) { setMsg({ type: "err", text: errorText(e) }); } finally { setBusy(null); }
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
setBusy("save");
|
||||
try {
|
||||
await api(`/api/admin/billing/invoices/${id}`, { method: "PUT", body: { ...form, lines: fromEdit(lines) } });
|
||||
setMsg({ type: "ok", text: inv.status === "approved" ? "Saved. It's still approved and goes out on its date." : "Saved." });
|
||||
await load();
|
||||
} catch (e) { setMsg({ type: "err", text: errorText(e) }); } finally { setBusy(null); }
|
||||
};
|
||||
|
||||
const approve = () => {
|
||||
if (dirty) { setMsg({ type: "err", text: "Save your changes first." }); return; }
|
||||
const when = inv.issueDate <= todayYmd() ? "within the next 15 minutes (its date has come)" : `on ${day(inv.issueDate)}`;
|
||||
const changes = inv.planChanges.map(pc => `${PRODUCT_NAMES[pc.product || "events"]}: ${pc.from} → ${pc.to}`).join(", ");
|
||||
if (!confirm(`Approve ${inv.number}? It goes to ${inv.recipientEmail} ${when}.${changes ? `\n\nThe church is also sent a notice of licence change for each tier change (${changes}) now.` : ""}`)) return;
|
||||
act("approve", "approve", {}, r => `Approved. It goes out ${when}.${r.notice ? (r.notice.email?.ok ? ` The notice of licence change ${r.notice.change.number}${inv.planChanges.length > 1 ? " (and the others)" : ""} was emailed.` : ` The notice ${r.notice.change.number} couldn't be emailed: ${r.notice.email?.error}`) : ""}`);
|
||||
};
|
||||
const voidIt = () => {
|
||||
const reason = prompt(`Void ${inv.number}? It stays on record, marked void. Why (printed on it)?`, "");
|
||||
if (reason === null) return;
|
||||
act("void", "void", { reason }, () => `${inv.number} is void.`);
|
||||
};
|
||||
const dropChange = async () => {
|
||||
const many = inv.planChanges.length > 1;
|
||||
if (!confirm(`Remove the tier change${many ? "s" : ""} from this invoice? The tier${many ? "s stay" : " stays"} as ${many ? "they are" : "it is"}${inv.licenceId ? "; then press Recalculate to price it at that tier" : ", and the draft is priced at them again"}.`)) return;
|
||||
@@ -77,15 +128,7 @@ function InvoiceDetail({ id }: { id: string }) {
|
||||
} catch (e) { setMsg({ type: "err", text: errorText(e) }); } finally { setBusy(null); }
|
||||
};
|
||||
const pdf = (path: string) => openPdf(path).catch(e => setMsg({ type: "err", text: errorText(e) }));
|
||||
const refund = async (p: Invoice["payments"][number]) => {
|
||||
const note = prompt(`Mark ${p.receiptNumber} (${money(p.amountCents)}) as refunded to the church? It stays on record, no longer counts as paid, and the statement shows the refund. Note (optional, e.g. the EFT reference):`, "");
|
||||
if (note === null) return;
|
||||
try {
|
||||
const r = await api<{ message: string }>(`/api/admin/billing/payments/${p.id}/refund`, { method: "POST", body: { note } });
|
||||
setMsg({ type: "ok", text: r.message });
|
||||
load();
|
||||
} catch (e) { setMsg({ type: "err", text: errorText(e) }); }
|
||||
};
|
||||
const done = (text: string) => { setPopup(null); setMsg({ type: "ok", text }); load(); };
|
||||
const paymentAction = async (pid: string, what: "resend" | "delete") => {
|
||||
if (what === "delete" && !confirm("Remove this payment? Its receipt number won't be used again.")) return;
|
||||
try {
|
||||
@@ -103,7 +146,7 @@ function InvoiceDetail({ id }: { id: string }) {
|
||||
subtitle={<><Link className="text-indigo-600 hover:underline" href={`/customers/${inv.customerId}?tab=invoices`}>{inv.customer?.name}</Link>{inv.customer?.founding && <span className="ml-2 inline-flex items-center gap-1 text-amber-700"><Star className="h-3.5 w-3.5 fill-amber-400 text-amber-400" /> founding church</span>}</>}
|
||||
actions={<StateBadge state={inv.state} />}
|
||||
/>
|
||||
<div className="mb-4"><Message msg={msg} /></div>
|
||||
<PageMessage msg={msg} onClose={() => setMsg(null)} />
|
||||
|
||||
<div className="mb-4 flex flex-wrap gap-2">
|
||||
{inv.status === "draft" && <button className="btn-primary" onClick={approve} disabled={!!busy}><Check className="h-4 w-4" /> {busy === "approve" ? "Approving…" : "Approve"}</button>}
|
||||
@@ -113,7 +156,7 @@ function InvoiceDetail({ id }: { id: string }) {
|
||||
{inv.status === "sent" && inv.balanceCents > 0 && <button className="btn-primary" onClick={() => setPaying(true)}>Record payment</button>}
|
||||
{inv.status === "sent" && <button className="btn-secondary" onClick={() => act("resend", "resend")} disabled={!!busy}><Send className="h-4 w-4" /> Send again</button>}
|
||||
<button className="btn-secondary" onClick={() => pdf(`/api/admin/billing/invoices/${id}/pdf`)}><FileText className="h-4 w-4" /> {editable ? "Preview PDF" : "PDF"}</button>
|
||||
{inv.status !== "void" && inv.payments.every(p => p.refundedAt) && <button className="btn-danger" onClick={voidIt} disabled={!!busy}><XCircle className="h-4 w-4" /> Void</button>}
|
||||
{inv.status !== "void" && inv.payments.every(p => p.refundedAt) && <button className="btn-danger" onClick={() => setPopup("void")} disabled={!!busy}><XCircle className="h-4 w-4" /> Void</button>}
|
||||
</div>
|
||||
|
||||
{inv.sendError && <div className="mb-4 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-800">The last attempt to send it failed: {inv.sendError}. It's tried again every 15 minutes.</div>}
|
||||
@@ -138,36 +181,28 @@ function InvoiceDetail({ id }: { id: string }) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{popup === "edit" && <EditInvoiceModal inv={inv} onClose={() => setPopup(null)} onSaved={done} />}
|
||||
{popup === "void" && <VoidModal inv={inv} onClose={() => setPopup(null)} onDone={done} />}
|
||||
{popup && typeof popup === "object" && <RefundModal p={popup} onClose={() => setPopup(null)} onDone={done} />}
|
||||
{paying && <RecordPayment invoice={inv} onClose={() => setPaying(false)} onSaved={m => { setMsg(m); setPaying(false); load(); }} />}
|
||||
|
||||
<div className="grid gap-6 lg:grid-cols-[2fr_1fr]">
|
||||
<div className="card space-y-4">
|
||||
{editable ? (
|
||||
<>
|
||||
<div className="grid gap-3 sm:grid-cols-3">
|
||||
<div><label className="label" htmlFor="inv-date">Date (goes out)</label><input id="inv-date" type="date" className="input" value={form.issueDate} onChange={e => { setForm({ ...form, issueDate: e.target.value }); setDirty(true); }} /></div>
|
||||
<div><label className="label" htmlFor="inv-due">Due</label><input id="inv-due" type="date" className="input" value={form.dueDate} onChange={e => { setForm({ ...form, dueDate: e.target.value }); setDirty(true); }} /></div>
|
||||
<div><label className="label" htmlFor="inv-to">Send to</label><input id="inv-to" type="email" className="input" value={form.recipientEmail} onChange={e => { setForm({ ...form, recipientEmail: e.target.value }); setDirty(true); }} /></div>
|
||||
</div>
|
||||
<LinesEditor lines={lines} onChange={l => { setLines(l); setDirty(true); }} />
|
||||
<div><label className="label" htmlFor="inv-notes">Notes (printed on the invoice)</label><textarea id="inv-notes" className="input" rows={2} value={form.notes} onChange={e => { setForm({ ...form, notes: e.target.value }); setDirty(true); }} /></div>
|
||||
<button className="btn-primary" onClick={save} disabled={!dirty || !!busy}>{busy === "save" ? "Saving…" : "Save changes"}</button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<table className="w-full text-sm">
|
||||
<thead className="text-left text-xs text-slate-500"><tr><th className="pb-2">Description</th><th className="pb-2 text-right">Qty</th><th className="pb-2 text-right">Unit</th><th className="pb-2 text-right">Amount</th></tr></thead>
|
||||
<tbody>{inv.lines.map((l, i) => <tr key={i} className="border-t border-slate-100"><td className="py-2">{l.description}</td><td className="py-2 text-right">{l.quantity}</td><td className="py-2 text-right tabular-nums">{money(l.unitCents)}</td><td className="py-2 text-right tabular-nums">{money(l.amountCents)}</td></tr>)}</tbody>
|
||||
</table>
|
||||
<div className="ml-auto max-w-xs space-y-1 text-sm">
|
||||
{inv.vatCents > 0 && <div className="flex justify-between text-slate-500"><span>Includes VAT</span><span className="tabular-nums">{money(inv.vatCents)}</span></div>}
|
||||
<div className="flex justify-between font-semibold"><span>Total</span><span className="tabular-nums">{money(inv.totalCents)}</span></div>
|
||||
{inv.status === "sent" && <><div className="flex justify-between text-green-700"><span>Paid</span><span className="tabular-nums">{money(inv.paidCents)}</span></div><div className="flex justify-between font-semibold"><span>Balance</span><span className="tabular-nums">{money(inv.balanceCents)}</span></div></>}
|
||||
</div>
|
||||
{inv.notes && <p className="text-sm text-slate-600">Notes: {inv.notes}</p>}
|
||||
{inv.voidReason && <p className="text-sm text-slate-600">Void: {inv.voidReason}</p>}
|
||||
</>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<h2 className="font-semibold">Lines</h2>
|
||||
{editable && <button type="button" className="btn-secondary px-2.5 py-1.5" onClick={() => setPopup("edit")} disabled={!!busy}><Pencil className="h-3.5 w-3.5" /> Edit</button>}
|
||||
</div>
|
||||
<table className="w-full text-sm">
|
||||
<thead className="text-left text-xs text-slate-500"><tr><th className="pb-2">Description</th><th className="pb-2 text-right">Qty</th><th className="pb-2 text-right">Unit</th><th className="pb-2 text-right">Amount</th></tr></thead>
|
||||
<tbody>{inv.lines.map((l, i) => <tr key={i} className="border-t border-slate-100"><td className="py-2">{l.description}</td><td className="py-2 text-right">{l.quantity}</td><td className="py-2 text-right tabular-nums">{money(l.unitCents)}</td><td className="py-2 text-right tabular-nums">{money(l.amountCents)}</td></tr>)}</tbody>
|
||||
</table>
|
||||
<div className="ml-auto max-w-xs space-y-1 text-sm">
|
||||
{inv.vatCents > 0 && <div className="flex justify-between text-slate-500"><span>Includes VAT</span><span className="tabular-nums">{money(inv.vatCents)}</span></div>}
|
||||
<div className="flex justify-between font-semibold"><span>Total</span><span className="tabular-nums">{money(inv.totalCents)}</span></div>
|
||||
{inv.status === "sent" && <><div className="flex justify-between text-green-700"><span>Paid</span><span className="tabular-nums">{money(inv.paidCents)}</span></div><div className="flex justify-between font-semibold"><span>Balance</span><span className="tabular-nums">{money(inv.balanceCents)}</span></div></>}
|
||||
</div>
|
||||
{inv.notes && <p className="text-sm text-slate-600">Notes: {inv.notes}</p>}
|
||||
{inv.voidReason && <p className="text-sm text-slate-600">Void: {inv.voidReason}</p>}
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
@@ -196,7 +231,7 @@ function InvoiceDetail({ id }: { id: string }) {
|
||||
<div className="mt-1 flex gap-3 text-xs">
|
||||
<button className="text-indigo-700 hover:underline" onClick={() => pdf(`/api/admin/billing/payments/${p.id}/pdf`)}>Receipt</button>
|
||||
<button className="text-indigo-700 hover:underline" onClick={() => paymentAction(p.id, "resend")}>Email receipt</button>
|
||||
{!p.refundedAt && <button className="text-amber-800 hover:underline" onClick={() => refund(p)}>Refund</button>}
|
||||
{!p.refundedAt && <button className="text-amber-800 hover:underline" onClick={() => setPopup(p)}>Refund</button>}
|
||||
<button className="text-red-700 hover:underline" onClick={() => paymentAction(p.id, "delete")}>Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useParams } from "next/navigation";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
import { ArrowLeft, Pencil } from "lucide-react";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { ago, bytes, fmtDate, rand, randFine } from "@/lib/format";
|
||||
import { usePaged } from "@/lib/paging";
|
||||
import { tierForBand, tierPrice } from "@/lib/tiers";
|
||||
import { PRODUCT_NAMES, type Product } from "@/lib/products";
|
||||
import type { AiHelperUse, AiMonth, AiStatus, Health, InstallEvent, InstallSummary, Licence, Stats, UnmetRequirement } from "@/lib/types";
|
||||
import { Badge, Loading, Message, PageTitle, Pager } from "@/components/ui";
|
||||
import { Badge, FormError, Loading, Message, Modal, ModalButtons, PageMessage, PageTitle, Pager, useSubmit } from "@/components/ui";
|
||||
|
||||
type Detail = {
|
||||
id: string; name: string; url: string; version: string | null; protocolVersion: number; timezone: string | null; notes: string | null;
|
||||
@@ -35,15 +35,55 @@ const Row =({ k, v }: { k: string; v: React.ReactNode }) => (
|
||||
<div className="flex justify-between gap-4 border-b border-slate-100 py-1.5 text-sm last:border-0"><span className="text-slate-500">{k}</span><span className="text-right">{v}</span></div>
|
||||
);
|
||||
|
||||
/** Hub 2.17.0: forget the site's public key, in a popup with a two-factor code. */
|
||||
function ClearKeyModal({ id, onClose, onDone }: { id: string; onClose: () => void; onDone: () => void }) {
|
||||
const [totp, setTotp] = useState("");
|
||||
const { busy, error, run } = useSubmit();
|
||||
const clear = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!window.confirm("Forget this site's public key? The church's other products stop listing it until its next heartbeat, and their links to it must be connected again.")) return;
|
||||
run(async () => { await api(`/api/admin/installs/${id}/public-key/clear`, { method: "POST", body: { totp } }); onDone(); });
|
||||
};
|
||||
return (
|
||||
<Modal title="Clear the public key" onClose={onClose} dirty={totp !== ""}>
|
||||
<form onSubmit={clear} className="space-y-3">
|
||||
<p className="text-sm text-slate-600">Only when the site's server was restored or rebuilt and the history says it sent a different key: clearing lets its next heartbeat save the new one.</p>
|
||||
<div><label className="label" htmlFor="k-t">Two-factor code</label><input id="k-t" className="input w-40" inputMode="numeric" autoComplete="one-time-code" required value={totp} onChange={e => setTotp(e.target.value)} /></div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} label="Clear public key" busyLabel="Clearing…" danger />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/** Hub 2.17.0: the Hub's notes about an install, edited in a popup. */
|
||||
function NotesModal({ id, notes, onClose, onSaved }: { id: string; notes: string; onClose: () => void; onSaved: () => void }) {
|
||||
const [text, setText] = useState(notes);
|
||||
const { busy, error, run } = useSubmit();
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
run(async () => { await api(`/api/admin/installs/${id}`, { method: "PUT", body: { notes: text } }); onSaved(); });
|
||||
};
|
||||
return (
|
||||
<Modal title="Notes" onClose={onClose} dirty={text !== notes}>
|
||||
<form onSubmit={save} className="space-y-3">
|
||||
<textarea id="notes" className="input" rows={6} value={text} onChange={e => setText(e.target.value)} aria-label="Notes" />
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} label="Save notes" />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/** One install: health, usage, licence, history. */
|
||||
export default function InstallPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const [d, setD] = useState<Detail | null>(null);
|
||||
const [notes, setNotes] = useState("");
|
||||
const [keyTotp, setKeyTotp] = useState("");
|
||||
// Hub 2.17.0: the popup that's open.
|
||||
const [popup, setPopup] = useState<"key" | "notes" | null>(null);
|
||||
const [msg, setMsg] = useState<{ type: "ok" | "err"; text: string } | null>(null);
|
||||
|
||||
const load = useCallback(() => api<Detail>(`/api/admin/installs/${id}`).then(x => { setD(x); setNotes(x.notes || ""); }).catch(e => setMsg({ type: "err", text: errorText(e) })), [id]);
|
||||
const load = useCallback(() => api<Detail>(`/api/admin/installs/${id}`).then(setD).catch(e => setMsg({ type: "err", text: errorText(e) })), [id]);
|
||||
useEffect(() => { load(); }, [load]);
|
||||
const history = usePaged(d?.events || NO_EVENTS, id, 20);
|
||||
|
||||
@@ -58,23 +98,6 @@ export default function InstallPage() {
|
||||
const points = [...daily.entries()];
|
||||
const max = Math.max(1, ...points.map(([, v]) => v));
|
||||
|
||||
const saveNotes = async () => {
|
||||
try {
|
||||
await api(`/api/admin/installs/${id}`, { method: "PUT", body: { notes } });
|
||||
setMsg({ type: "ok", text: "Notes saved." });
|
||||
} catch (e) { setMsg({ type: "err", text: errorText(e) }); }
|
||||
};
|
||||
|
||||
const clearKey = async () => {
|
||||
if (!window.confirm("Forget this site's public key? The church's other products stop listing it until its next heartbeat, and their links to it must be connected again.")) return;
|
||||
try {
|
||||
await api(`/api/admin/installs/${id}/public-key/clear`, { method: "POST", body: { totp: keyTotp } });
|
||||
setKeyTotp("");
|
||||
setMsg({ type: "ok", text: "Public key cleared. The next heartbeat saves the site's current key." });
|
||||
load();
|
||||
} catch (e) { setMsg({ type: "err", text: errorText(e) }); }
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Link href="/" className="mb-2 inline-flex items-center gap-1 text-sm text-slate-500 hover:underline"><ArrowLeft className="h-4 w-4" /> Installs</Link>
|
||||
@@ -83,6 +106,9 @@ export default function InstallPage() {
|
||||
subtitle={<a href={d.url} target="_blank" rel="noopener noreferrer" className="text-indigo-600 hover:underline">{d.url}</a>}
|
||||
actions={<Badge value={d.summary.status} />}
|
||||
/>
|
||||
<PageMessage msg={msg} onClose={() => setMsg(null)} />
|
||||
{popup === "key" && <ClearKeyModal id={id} onClose={() => setPopup(null)} onDone={() => { setPopup(null); setMsg({ type: "ok", text: "Public key cleared. The next heartbeat saves the site's current key." }); load(); }} />}
|
||||
{popup === "notes" && <NotesModal id={id} notes={d.notes || ""} onClose={() => setPopup(null)} onSaved={() => { setPopup(null); setMsg({ type: "ok", text: "Notes saved." }); load(); }} />}
|
||||
{d.releasedAt && <div className="mb-4"><Message msg={{ type: "err", text: `Licence released ${fmtDate(d.releasedAt)} — this install's heartbeats are refused.` }} /></div>}
|
||||
{d.summary.problems.length > 0 && (
|
||||
<div className="card mb-6 space-y-1">
|
||||
@@ -143,11 +169,7 @@ export default function InstallPage() {
|
||||
<div className="mt-3 border-t border-slate-100 pt-3">
|
||||
<Row k="This site's public key" v={d.publicKey ? "saved" : d.protocolVersion >= 2 ? "none yet (saved with its next heartbeat)" : "none (protocol 1)"} />
|
||||
{d.publicKey && (
|
||||
<form className="mt-2 flex flex-wrap items-end gap-2" onSubmit={e => { e.preventDefault(); clearKey(); }}>
|
||||
<p className="w-full text-xs text-slate-500">Only when the site's server was restored or rebuilt and the history below says it sent a different key: clearing lets its next heartbeat save the new one.</p>
|
||||
<div><label className="label" htmlFor="k-t">Two-factor code</label><input id="k-t" className="input" inputMode="numeric" autoComplete="one-time-code" required value={keyTotp} onChange={e => setKeyTotp(e.target.value)} /></div>
|
||||
<button className="btn-danger">Clear public key</button>
|
||||
</form>
|
||||
<button type="button" className="btn-danger mt-2 px-2.5 py-1.5 text-xs" onClick={() => setPopup("key")}>Clear public key…</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -217,13 +239,14 @@ export default function InstallPage() {
|
||||
<Row k="Time zone" v={d.timezone || "—"} />
|
||||
<Row k="Registered" v={fmtDate(d.registeredAt)} />
|
||||
<Row k="Protocol" v={d.protocolVersion} />
|
||||
<label className="label mt-3" htmlFor="notes">Notes</label>
|
||||
<textarea id="notes" className="input" rows={3} value={notes} onChange={e => setNotes(e.target.value)} />
|
||||
<button className="btn-secondary mt-2" onClick={saveNotes}>Save notes</button>
|
||||
<div className="mt-3 flex items-center justify-between gap-2">
|
||||
<span className="label mb-0">Notes</span>
|
||||
<button type="button" className="btn-secondary px-2.5 py-1.5" onClick={() => setPopup("notes")}><Pencil className="h-3.5 w-3.5" /> Edit</button>
|
||||
</div>
|
||||
{d.notes ? <p className="whitespace-pre-line text-sm text-slate-700">{d.notes}</p> : <p className="text-sm text-slate-400">—</p>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{msg && <div className="mt-4"><Message msg={msg} /></div>}
|
||||
|
||||
<div className="card mt-6">
|
||||
<h2 className="mb-2 font-semibold">AI</h2>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { Plus, Trash2 } from "lucide-react";
|
||||
import { Plus, Trash2, Upload } from "lucide-react";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { ago, bytes, fmtDate } from "@/lib/format";
|
||||
import { useServerPaged } from "@/lib/paging";
|
||||
import { Loading, Message, PageTitle, Pager } from "@/components/ui";
|
||||
import { Field, Fields, FormError, Loading, Message, Modal, ModalButtons, PageMessage, PageTitle, Pager, ReadCard, useSubmit } from "@/components/ui";
|
||||
import { PercentChart, ServersNav, StatusPill, pct, type Deployment, type Job, type ServerSummary } from "@/components/servers";
|
||||
import { FrpConfig, type FrpState } from "@/components/FrpConfig";
|
||||
|
||||
@@ -32,36 +32,56 @@ const SUGGESTED: { key: string; hint: string }[] = [
|
||||
{ key: "DB_ADMIN_URL", hint: "postgresql://admin:…@host/postgres: may create databases and roles. Blank: the local PostgreSQL via sudo -u postgres" },
|
||||
];
|
||||
|
||||
function ConfigEditor({ id, config, onSaved }: { id: string; config: Record<string, string>; onSaved: (m: Msg) => void }) {
|
||||
const [rows, setRows] = useState<[string, string][]>(() => {
|
||||
const keys = [...new Set([...SUGGESTED.map(s => s.key), ...Object.keys(config)])];
|
||||
return keys.map(k => [k, config[k] ?? (k === "TRUST_PROXY" ? "loopback" : "")]);
|
||||
});
|
||||
/** The keys a church server's configuration shows: the suggested ones, then any others it has. */
|
||||
const configKeys = (config: Record<string, string>) => [...new Set([...SUGGESTED.map(x => x.key), ...Object.keys(config)])];
|
||||
|
||||
/** Hub 2.17.0: the server's configuration, edited in a popup. */
|
||||
function ConfigModal({ id, config, onClose, onSaved }: { id: string; config: Record<string, string>; onClose: () => void; onSaved: (text: string) => void }) {
|
||||
const initial = useMemo<[string, string][]>(() => configKeys(config).map(k => [k, config[k] ?? (k === "TRUST_PROXY" ? "loopback" : "")]), [config]);
|
||||
const [rows, setRows] = useState(initial);
|
||||
const { busy, error, run } = useSubmit();
|
||||
const set = (i: number, j: 0 | 1, v: string) => setRows(rows.map((r, n) => (n === i ? (j === 0 ? [v.toUpperCase(), r[1]] : [r[0], v]) : r)));
|
||||
const save = async () => {
|
||||
try {
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
run(async () => {
|
||||
await api(`/api/admin/servers/${id}/config`, { method: "PUT", body: { values: Object.fromEntries(rows.filter(r => r[0].trim())) } });
|
||||
onSaved({ type: "ok", text: "Configuration saved. Jobs from now on carry it, sealed to this server's key." });
|
||||
} catch (e) { onSaved({ type: "err", text: errorText(e) }); }
|
||||
onSaved("Configuration saved. Jobs from now on carry it, sealed to this server's key.");
|
||||
});
|
||||
};
|
||||
return (
|
||||
<div className="card">
|
||||
<h2 className="font-medium">Configuration</h2>
|
||||
<p className="mt-1 text-sm text-slate-500">The server layer of every install's .env here. Stored encrypted; sent only inside jobs, sealed to this server. Values ending in _URL, KEY, SECRET or PASSWORD show as dots: leave them to keep them.</p>
|
||||
<div className="mt-3 space-y-2">
|
||||
{rows.map(([k, v], i) => (
|
||||
<div key={i} className="grid gap-2 md:grid-cols-[14rem_1fr_auto]">
|
||||
<input className="input font-mono" value={k} onChange={e => set(i, 0, e.target.value)} placeholder="NAME" aria-label="Name" />
|
||||
<input className="input font-mono" value={v} onChange={e => set(i, 1, e.target.value)} placeholder={SUGGESTED.find(s => s.key === k)?.hint || "value"} aria-label={`${k} value`} />
|
||||
<button type="button" className="btn-secondary" onClick={() => setRows(rows.filter((_, n) => n !== i))} aria-label={`Remove ${k}`}><Trash2 className="h-4 w-4" /></button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="mt-3 flex gap-2">
|
||||
<Modal title="Configuration" onClose={onClose} dirty={JSON.stringify(rows) !== JSON.stringify(initial)} wide>
|
||||
<form onSubmit={save} className="space-y-3">
|
||||
<p className="text-sm text-slate-500">Values ending in _URL, KEY, SECRET or PASSWORD show as dots: leave them to keep them.</p>
|
||||
<div className="space-y-2">
|
||||
{rows.map(([k, v], i) => (
|
||||
<div key={i} className="grid gap-2 sm:grid-cols-[12rem_1fr_auto]">
|
||||
<input className="input font-mono" value={k} onChange={e => set(i, 0, e.target.value)} placeholder="NAME" aria-label="Name" />
|
||||
<input className="input font-mono" value={v} onChange={e => set(i, 1, e.target.value)} placeholder={SUGGESTED.find(x => x.key === k)?.hint || "value"} aria-label={`${k} value`} />
|
||||
<button type="button" className="btn-secondary" onClick={() => setRows(rows.filter((_, n) => n !== i))} aria-label={`Remove ${k}`}><Trash2 className="h-4 w-4" /></button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<button type="button" className="btn-secondary" onClick={() => setRows([...rows, ["", ""]])}><Plus className="h-4 w-4" /> Add a setting</button>
|
||||
<button type="button" className="btn-primary" onClick={save}>Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/** Hub 2.17.0: Update agent in a popup; queuing it opens the job. */
|
||||
function UpdateAgentModal({ current, onClose, queue }: { current: string | null; onClose: () => void; queue: (version: string) => Promise<void> }) {
|
||||
const [version, setVersion] = useState("");
|
||||
const { busy, error, run } = useSubmit();
|
||||
return (
|
||||
<Modal title="Update agent" onClose={onClose} dirty={version.trim() !== ""}>
|
||||
<form onSubmit={e => { e.preventDefault(); run(() => queue(version.trim())); }} className="space-y-3">
|
||||
<p className="text-sm text-slate-600">The agent here is {current || "an unknown version"}. The new version is queued as a job on this server.</p>
|
||||
<div><label className="label" htmlFor="agent-version">Version</label><input id="agent-version" className="input font-mono" placeholder="agent@1.0.1" value={version} onChange={e => setVersion(e.target.value)} required /></div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} label="Update agent" busyLabel="Queuing…" />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,19 +93,19 @@ export default function ServerPage() {
|
||||
const jobsPaged = useServerPaged<Job>("/api/admin/jobs", { serverId: String(id) }, r => r.jobs as Job[], 20);
|
||||
const [range, setRange] = useState<"24h" | "7d" | "90d">("24h");
|
||||
const [msg, setMsg] = useState<Msg>(null);
|
||||
const [agentVersion, setAgentVersion] = useState("");
|
||||
// Hub 2.17.0: the popup that's open.
|
||||
const [popup, setPopup] = useState<"config" | "agent" | null>(null);
|
||||
|
||||
const load = useCallback(() => api<Detail>(`/api/admin/servers/${id}?range=${range}`).then(setD).catch(e => setMsg({ type: "err", text: errorText(e) })), [id, range]);
|
||||
useEffect(() => { load(); }, [load]);
|
||||
|
||||
const job = async (type: string, args: Record<string, unknown> = {}) => {
|
||||
setMsg(null);
|
||||
try {
|
||||
const r = await api<{ job: Job }>(`/api/admin/servers/${id}/jobs`, { method: "POST", body: { type, args } });
|
||||
setMsg({ type: "ok", text: `Queued: the agent picks it up within 30 seconds.` });
|
||||
router.push(`/jobs/${r.job.id}`);
|
||||
} catch (e) { setMsg({ type: "err", text: errorText(e) }); }
|
||||
/** Queues a job and opens it; throws when the Hub refuses, for a popup to show. */
|
||||
const queue = async (type: string, args: Record<string, unknown> = {}) => {
|
||||
const r = await api<{ job: Job }>(`/api/admin/servers/${id}/jobs`, { method: "POST", body: { type, args } });
|
||||
setMsg({ type: "ok", text: `Queued: the agent picks it up within 30 seconds.` });
|
||||
router.push(`/jobs/${r.job.id}`);
|
||||
};
|
||||
const job = (type: string) => { setMsg(null); queue(type).catch(e => setMsg({ type: "err", text: errorText(e) })); };
|
||||
const remove = async () => {
|
||||
if (!d || !window.confirm(`Remove ${d.server.name} from the Hub? Its agent stops getting jobs. (Uninstall the agent on the server too.)`)) return;
|
||||
try { await api(`/api/admin/servers/${id}`, { method: "DELETE" }); router.push("/servers"); } catch (e) { setMsg({ type: "err", text: errorText(e) }); }
|
||||
@@ -98,7 +118,7 @@ export default function ServerPage() {
|
||||
<div>
|
||||
<PageTitle title={s.name} subtitle={<>{s.mode === "central" ? "Central server" : "Church server"} · {s.hostname} · agent {s.agentVersion} · last heard {ago(s.lastSeenAt)} <StatusPill status={s.busy ? "busy" : s.online ? "online" : "offline"} /></>} />
|
||||
<ServersNav active="/servers" />
|
||||
<Message msg={msg} />
|
||||
<PageMessage msg={msg} onClose={() => setMsg(null)} />
|
||||
</div>
|
||||
|
||||
{!!d.alerts.filter(a => !a.resolvedAt).length && (
|
||||
@@ -134,12 +154,19 @@ export default function ServerPage() {
|
||||
<h2 className="font-medium">Actions</h2>
|
||||
<button className="btn-secondary w-full" onClick={() => job("status")}>Check status and find installs</button>
|
||||
<p className="text-xs text-slate-500">Asks the agent what's on the server. A site added there without the Hub (crosscode add, or by hand) is added to Installs and tied to its registration. It also runs by itself once a day when a registered site has no install record here.</p>
|
||||
<div className="flex gap-2"><input className="input" placeholder="agent@1.0.1" value={agentVersion} onChange={e => setAgentVersion(e.target.value)} aria-label="Agent version" /><button className="btn-secondary" disabled={!agentVersion} onClick={() => job("update-agent", { version: agentVersion })}>Update agent</button></div>
|
||||
<button className="btn-secondary w-full" onClick={() => setPopup("agent")}><Upload className="h-4 w-4" /> Update agent…</button>
|
||||
<button className="btn-danger w-full" onClick={remove}><Trash2 className="h-4 w-4" /> Remove server</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{s.mode === "church" && <ConfigEditor key={JSON.stringify(d.config)} id={s.id} config={d.config} onSaved={m => { setMsg(m); load(); }} />}
|
||||
{s.mode === "church" && (
|
||||
<ReadCard title="Configuration" onEdit={() => setPopup("config")}>
|
||||
<p className="text-sm text-slate-500">The server layer of every install's .env here. Stored encrypted; sent only inside jobs, sealed to this server.</p>
|
||||
<Fields>{configKeys(d.config).map(k => <Field key={k} label={k}>{d.config[k] ? <span className="break-all font-mono">{d.config[k]}</span> : null}</Field>)}</Fields>
|
||||
</ReadCard>
|
||||
)}
|
||||
{popup === "config" && <ConfigModal id={s.id} config={d.config} onClose={() => setPopup(null)} onSaved={text => { setPopup(null); setMsg({ type: "ok", text }); load(); }} />}
|
||||
{popup === "agent" && <UpdateAgentModal current={s.agentVersion} onClose={() => setPopup(null)} queue={version => queue("update-agent", { version })} />}
|
||||
|
||||
{d.frp && <FrpConfig serverId={s.id} agentVersion={s.agentVersion} frp={d.frp} onChange={m => { setMsg(m); load(); }} />}
|
||||
|
||||
|
||||
@@ -5,21 +5,84 @@ import { Plus, Trash2 } from "lucide-react";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { fmtDate } from "@/lib/format";
|
||||
import { usePaged } from "@/lib/paging";
|
||||
import { Loading, Message, PageTitle, Pager } from "@/components/ui";
|
||||
import { Field, Fields, FormError, Loading, Modal, ModalButtons, PageMessage, PageTitle, Pager, ReadCard, useSubmit } from "@/components/ui";
|
||||
import { ServersNav } from "@/components/servers";
|
||||
|
||||
type Msg = { type: "ok" | "err"; text: string } | null;
|
||||
type Port = { port: number; role: string; note: string | null; releasedAt: string | null; deploymentId: string | null; server: { id: string; name: string } | null };
|
||||
|
||||
type Defaults = { defaults: [string, string][]; range: { from: string; to: string }; ip: string };
|
||||
|
||||
/** Hub 2.17.0: the install defaults, the port range and the central server's IP, in a popup. */
|
||||
function DefaultsModal({ initial, onClose, onSaved }: { initial: Defaults; onClose: () => void; onSaved: () => void }) {
|
||||
const [defaults, setDefaults] = useState(initial.defaults);
|
||||
const [range, setRange] = useState(initial.range);
|
||||
const [ip, setIp] = useState(initial.ip);
|
||||
const { busy, error, run } = useSubmit();
|
||||
const dirty = JSON.stringify({ defaults, range, ip }) !== JSON.stringify(initial);
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
run(async () => {
|
||||
await api("/api/admin/install-defaults", { method: "PUT", body: { defaults: Object.fromEntries(defaults.filter(d => d[0].trim())), portRange: { from: range.from, to: range.to }, centralServerIp: ip } });
|
||||
onSaved();
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Modal title="Install defaults" onClose={onClose} dirty={dirty} wide>
|
||||
<form onSubmit={save} className="space-y-3">
|
||||
{defaults.map(([k, v], i) => (
|
||||
<div key={i} className="grid gap-2 sm:grid-cols-[12rem_1fr_auto]">
|
||||
<input className="input font-mono" value={k} aria-label="Name" onChange={e => setDefaults(defaults.map((d, n) => (n === i ? [e.target.value.toUpperCase(), d[1]] : d)))} />
|
||||
<input className="input font-mono" value={v} aria-label={`${k} value`} onChange={e => setDefaults(defaults.map((d, n) => (n === i ? [d[0], e.target.value] : d)))} />
|
||||
<button type="button" className="btn-secondary" aria-label={`Remove ${k}`} onClick={() => setDefaults(defaults.filter((_, n) => n !== i))}><Trash2 className="h-4 w-4" /></button>
|
||||
</div>
|
||||
))}
|
||||
<button type="button" className="btn-secondary" onClick={() => setDefaults([...defaults, ["", ""]])}><Plus className="h-4 w-4" /> Add a default</button>
|
||||
<div className="grid gap-3 border-t pt-3 sm:grid-cols-3">
|
||||
<div><label className="label" htmlFor="pr-from">Port range from</label><input id="pr-from" className="input" inputMode="numeric" value={range.from} onChange={e => setRange({ ...range, from: e.target.value })} /></div>
|
||||
<div><label className="label" htmlFor="pr-to">to</label><input id="pr-to" className="input" inputMode="numeric" value={range.to} onChange={e => setRange({ ...range, to: e.target.value })} /><p className="mt-1 text-xs text-slate-500">Match allow_ports in frps.ini.</p></div>
|
||||
<div><label className="label" htmlFor="c-ip">Central server IP</label><input id="c-ip" className="input" placeholder="203.0.113.10" value={ip} onChange={e => setIp(e.target.value)} /><p className="mt-1 text-xs text-slate-500">To check a new install's DNS.</p></div>
|
||||
</div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/** Hub 2.17.0: mark a port as taken by something else, in a popup. */
|
||||
function TakePortModal({ onClose, onSaved }: { onClose: () => void; onSaved: (port: string) => void }) {
|
||||
const [form, setForm] = useState({ port: "", note: "" });
|
||||
const { busy, error, run } = useSubmit();
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
run(async () => { await api("/api/admin/ports", { method: "POST", body: form }); onSaved(form.port); });
|
||||
};
|
||||
return (
|
||||
<Modal title="Mark a port as taken" onClose={onClose} dirty={!!(form.port || form.note)}>
|
||||
<form onSubmit={save} className="space-y-3">
|
||||
<p className="text-sm text-slate-500">For a port used by anything else (today's tunnels written by hand). Every port frps opens on the central server must be unique across servers.</p>
|
||||
<div className="grid gap-3 sm:grid-cols-[8rem_1fr]">
|
||||
<div><label className="label" htmlFor="tp-port">Port</label><input id="tp-port" className="input" inputMode="numeric" required value={form.port} onChange={e => setForm({ ...form, port: e.target.value })} /></div>
|
||||
<div><label className="label" htmlFor="tp-note">What uses it</label><input id="tp-note" className="input" value={form.note} onChange={e => setForm({ ...form, note: e.target.value })} /></div>
|
||||
</div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} label="Mark as taken" />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/** The port list (§6) and the install defaults (§5): the same for every install. */
|
||||
export default function ServerSettingsPage() {
|
||||
const [ports, setPorts] = useState<Port[] | null>(null);
|
||||
const portsPaged = usePaged(ports || [], null, 30);
|
||||
const [range, setRange] = useState({ from: "20000", to: "29999" });
|
||||
const [defaults, setDefaults] = useState<[string, string][]>([]);
|
||||
const [defaults, setDefaults] = useState<[string, string][] | null>(null);
|
||||
const [ip, setIp] = useState("");
|
||||
const [newPort, setNewPort] = useState({ port: "", note: "" });
|
||||
const [msg, setMsg] = useState<Msg>(null);
|
||||
// Hub 2.17.0: the popup that's open.
|
||||
const [popup, setPopup] = useState<"defaults" | "port" | null>(null);
|
||||
|
||||
const load = useCallback(() => {
|
||||
api<{ ports: Port[]; range: { from: number; to: number } }>("/api/admin/ports").then(r => { setPorts(r.ports); setRange({ from: String(r.range.from), to: String(r.range.to) }); }).catch(e => setMsg({ type: "err", text: errorText(e) }));
|
||||
@@ -27,16 +90,6 @@ export default function ServerSettingsPage() {
|
||||
}, []);
|
||||
useEffect(() => { load(); }, [load]);
|
||||
|
||||
const saveDefaults = async () => {
|
||||
try {
|
||||
await api("/api/admin/install-defaults", { method: "PUT", body: { defaults: Object.fromEntries(defaults.filter(d => d[0].trim())), portRange: { from: range.from, to: range.to }, centralServerIp: ip } });
|
||||
setMsg({ type: "ok", text: "Saved." });
|
||||
} catch (e) { setMsg({ type: "err", text: errorText(e) }); }
|
||||
};
|
||||
const take = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
try { await api("/api/admin/ports", { method: "POST", body: { port: newPort.port, note: newPort.note } }); setNewPort({ port: "", note: "" }); load(); } catch (err) { setMsg({ type: "err", text: errorText(err) }); }
|
||||
};
|
||||
const free = async (port: number) => {
|
||||
try { await api(`/api/admin/ports/${port}`, { method: "DELETE" }); load(); } catch (err) { setMsg({ type: "err", text: errorText(err) }); }
|
||||
};
|
||||
@@ -46,36 +99,32 @@ export default function ServerSettingsPage() {
|
||||
<div>
|
||||
<PageTitle title="Ports & defaults" />
|
||||
<ServersNav active="/servers/settings" />
|
||||
<Message msg={msg} />
|
||||
<PageMessage msg={msg} onClose={() => setMsg(null)} />
|
||||
</div>
|
||||
|
||||
<div className="card space-y-3">
|
||||
<h2 className="font-medium">Install defaults</h2>
|
||||
<ReadCard title="Install defaults" onEdit={defaults ? () => setPopup("defaults") : undefined}>
|
||||
<p className="text-sm text-slate-500">The defaults layer of every install's .env (HUB_URL, APP_TIMEZONE, job switches, SENTRY_DSN…). A server's own configuration is on its page.</p>
|
||||
{defaults.map(([k, v], i) => (
|
||||
<div key={i} className="grid gap-2 md:grid-cols-[14rem_1fr_auto]">
|
||||
<input className="input font-mono" value={k} aria-label="Name" onChange={e => setDefaults(defaults.map((d, n) => (n === i ? [e.target.value.toUpperCase(), d[1]] : d)))} />
|
||||
<input className="input font-mono" value={v} aria-label={`${k} value`} onChange={e => setDefaults(defaults.map((d, n) => (n === i ? [d[0], e.target.value] : d)))} />
|
||||
<button type="button" className="btn-secondary" aria-label={`Remove ${k}`} onClick={() => setDefaults(defaults.filter((_, n) => n !== i))}><Trash2 className="h-4 w-4" /></button>
|
||||
</div>
|
||||
))}
|
||||
<button type="button" className="btn-secondary" onClick={() => setDefaults([...defaults, ["", ""]])}><Plus className="h-4 w-4" /> Add a default</button>
|
||||
<div className="grid gap-3 border-t pt-3 md:grid-cols-3">
|
||||
<div><label className="label" htmlFor="pr-from">Port range from</label><input id="pr-from" className="input" inputMode="numeric" value={range.from} onChange={e => setRange({ ...range, from: e.target.value })} /></div>
|
||||
<div><label className="label" htmlFor="pr-to">to</label><input id="pr-to" className="input" inputMode="numeric" value={range.to} onChange={e => setRange({ ...range, to: e.target.value })} /><p className="mt-1 text-xs text-slate-500">Match allow_ports in frps.ini.</p></div>
|
||||
<div><label className="label" htmlFor="c-ip">Central server IP</label><input id="c-ip" className="input" placeholder="203.0.113.10" value={ip} onChange={e => setIp(e.target.value)} /><p className="mt-1 text-xs text-slate-500">To check a new install's DNS.</p></div>
|
||||
</div>
|
||||
<button className="btn-primary" onClick={saveDefaults}>Save</button>
|
||||
</div>
|
||||
{!defaults ? <Loading /> : (
|
||||
<>
|
||||
{defaults.length ? <Fields>{defaults.map(([k, v]) => <Field key={k} label={k}>{v ? <span className="break-all font-mono">{v}</span> : null}</Field>)}</Fields> : <p className="text-sm text-slate-500">No defaults.</p>}
|
||||
<div className="border-t pt-3">
|
||||
<Fields>
|
||||
<Field label="Port range">{range.from}–{range.to}</Field>
|
||||
<Field label="Central server IP">{ip}</Field>
|
||||
</Fields>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</ReadCard>
|
||||
{popup === "defaults" && defaults && <DefaultsModal initial={{ defaults, range, ip }} onClose={() => setPopup(null)} onSaved={() => { setPopup(null); setMsg({ type: "ok", text: "Install defaults saved." }); load(); }} />}
|
||||
{popup === "port" && <TakePortModal onClose={() => setPopup(null)} onSaved={port => { setPopup(null); setMsg({ type: "ok", text: `Port ${port} is marked as taken.` }); load(); }} />}
|
||||
|
||||
<div className="card overflow-x-auto">
|
||||
<h2 className="font-medium">Port list</h2>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<h2 className="font-medium">Port list</h2>
|
||||
<button type="button" className="btn-secondary px-2.5 py-1.5" onClick={() => setPopup("port")}><Plus className="h-3.5 w-3.5" /> Mark as taken</button>
|
||||
</div>
|
||||
<p className="mt-1 text-sm text-slate-500">Every port frps opens on the central server must be unique across servers. Mark ports used by anything else (today's tunnels written by hand) as taken.</p>
|
||||
<form onSubmit={take} className="mt-3 flex flex-wrap gap-2">
|
||||
<input className="input w-32" placeholder="Port" inputMode="numeric" required value={newPort.port} onChange={e => setNewPort({ ...newPort, port: e.target.value })} aria-label="Port" />
|
||||
<input className="input w-72" placeholder="What uses it" value={newPort.note} onChange={e => setNewPort({ ...newPort, note: e.target.value })} aria-label="Note" />
|
||||
<button className="btn-secondary">Mark as taken</button>
|
||||
</form>
|
||||
{!ports ? <Loading /> : (
|
||||
<table className="mt-3 w-full text-sm tabular-nums">
|
||||
<thead><tr className="text-left text-xs text-slate-500"><th className="py-1">Port</th><th>Use</th><th>Server</th><th>Note</th><th /></tr></thead>
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { RefreshCw, Save } from "lucide-react";
|
||||
import { Pencil, RefreshCw } from "lucide-react";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { fmtDate } from "@/lib/format";
|
||||
import { StatusPill } from "@/components/servers";
|
||||
import { FormError, Modal, ModalButtons, useSubmit } from "@/components/ui";
|
||||
|
||||
/**
|
||||
* frps's config (central server) or frpc's (church server) from the Hub (2.11.0, agent 1.4.0):
|
||||
@@ -42,18 +43,49 @@ function atLeast(have: string | null, need: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hub 2.17.0: the config file edited in a popup. Saving asks first (every tunnel drops while frp
|
||||
* restarts) and needs a two-factor code.
|
||||
*/
|
||||
function FrpEditModal({ serverId, frp, read, onClose, onSent }: { serverId: string; frp: FrpState; read: FrpRead; onClose: () => void; onSent: (text: string) => void }) {
|
||||
const [content, setContent] = useState(read.content ?? "");
|
||||
const [restart, setRestart] = useState(true);
|
||||
const [totp, setTotp] = useState("");
|
||||
const { busy, error, run } = useSubmit();
|
||||
const edited = content !== (read.content ?? "");
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!read.path || !window.confirm(`Replace ${read.path} on the server${restart ? ` and restart ${frp.service}` : ""}? Every church site's tunnel drops for a few seconds while ${frp.service} restarts.`)) return;
|
||||
run(async () => {
|
||||
await api(`/api/admin/servers/${serverId}/frp/write`, { method: "POST", body: { content, restart, totp } });
|
||||
onSent(`Sent: the agent checks it with ${frp.service} verify, keeps a backup${restart ? `, restarts ${frp.service}` : ""}, and puts the old file back if ${frp.service} doesn't start.`);
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Modal title={<>Edit <span className="font-mono">{read.path}</span></>} onClose={onClose} dirty={edited} wide>
|
||||
<form className="space-y-3" onSubmit={save}>
|
||||
<textarea className="input h-80 w-full font-mono text-xs" spellCheck={false} value={content} onChange={e => setContent(e.target.value)} aria-label={`${frp.service} config`} />
|
||||
<p className="text-xs text-slate-500">
|
||||
Secret values ({read.hidden.length ? read.hidden.join(", ") : "none here"}) never leave the server: they show as <code>{frp.hidden}</code> and the server's own value is put back when you save. Secrets are changed on the server, not here.
|
||||
</p>
|
||||
<div className="flex flex-wrap items-end gap-3">
|
||||
<label className="flex items-center gap-2 text-sm"><input type="checkbox" checked={restart} onChange={e => setRestart(e.target.checked)} /> Restart {frp.service} afterwards</label>
|
||||
<div><label className="label" htmlFor="frp-totp">Two-factor code</label><input id="frp-totp" className="input w-36" inputMode="numeric" autoComplete="one-time-code" required value={totp} onChange={e => setTotp(e.target.value)} /></div>
|
||||
</div>
|
||||
<FormError error={error} />
|
||||
<ModalButtons busy={busy} onCancel={onClose} label="Save on the server" busyLabel="Sending…" disabled={!edited} />
|
||||
</form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export function FrpConfig({ serverId, agentVersion, frp, onChange }: { serverId: string; agentVersion: string | null; frp: FrpState; onChange: (m: Msg) => void }) {
|
||||
const read = frp.read;
|
||||
const [path, setPath] = useState(frp.path || read?.path || "");
|
||||
const [content, setContent] = useState(read?.content ?? "");
|
||||
const [restart, setRestart] = useState(true);
|
||||
const [totp, setTotp] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [editing, setEditing] = useState(false);
|
||||
const supported = atLeast(agentVersion, frp.minAgent);
|
||||
const edited = !!read?.found && content !== (read.content ?? "");
|
||||
|
||||
// A new read replaces what's in the editor.
|
||||
useEffect(() => { setContent(read?.content ?? ""); }, [read?.readAt, read?.content]);
|
||||
useEffect(() => { setPath(frp.path || read?.path || ""); }, [frp.path, read?.path]);
|
||||
|
||||
const go = async (url: string, body: Record<string, unknown>, ok: string) => {
|
||||
@@ -61,22 +93,21 @@ export function FrpConfig({ serverId, agentVersion, frp, onChange }: { serverId:
|
||||
try {
|
||||
await api(url, { method: "POST", body });
|
||||
onChange({ type: "ok", text: ok });
|
||||
setTotp("");
|
||||
} catch (e) { onChange({ type: "err", text: errorText(e) }); }
|
||||
setBusy(false);
|
||||
};
|
||||
const readNow = (withPath: boolean) => go(`/api/admin/servers/${serverId}/frp/read`, withPath ? { path: path.trim() } : {}, "Asked the agent to read the config: it shows here within a minute (reload the page).");
|
||||
const save = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!read?.path || !window.confirm(`Replace ${read.path} on the server${restart ? ` and restart ${frp.service}` : ""}? Every church site's tunnel drops for a few seconds while ${frp.service} restarts.`)) return;
|
||||
go(`/api/admin/servers/${serverId}/frp/write`, { content, restart, totp }, `Sent: the agent checks it with ${frp.service} verify, keeps a backup${restart ? `, restarts ${frp.service}` : ""}, and puts the old file back if ${frp.service} doesn't start.`);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="card space-y-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<h2 className="font-medium">frp config ({frp.service})</h2>
|
||||
{frp.pending && <span className="text-xs text-slate-500">{frp.pending.type === "frp-write" ? "A change" : "A read"} is on its way: <Link className="text-indigo-700 hover:underline" href={`/jobs/${frp.pending.id}`}>{frp.pending.status}</Link></span>}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{frp.pending && <span className="text-xs text-slate-500">{frp.pending.type === "frp-write" ? "A change" : "A read"} is on its way: <Link className="text-indigo-700 hover:underline" href={`/jobs/${frp.pending.id}`}>{frp.pending.status}</Link></span>}
|
||||
{read?.found && supported && (
|
||||
<button type="button" className="btn-secondary px-2.5 py-1.5" disabled={!!frp.pending} title={frp.pending ? "Wait for the job on its way" : undefined} onClick={() => setEditing(true)}><Pencil className="h-3.5 w-3.5" /> Edit</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{!supported && <p className="text-sm text-amber-700">The agent here is {agentVersion || "an unknown version"}; reading and changing frp's config needs agent {frp.minAgent} or later. Update the agent first.</p>}
|
||||
|
||||
@@ -114,18 +145,10 @@ export function FrpConfig({ serverId, agentVersion, frp, onChange }: { serverId:
|
||||
)}
|
||||
|
||||
{read?.found && (
|
||||
<form className="space-y-2" onSubmit={save}>
|
||||
<textarea className="input h-80 w-full font-mono text-xs" spellCheck={false} value={content} onChange={e => setContent(e.target.value)} aria-label={`${frp.service} config`} />
|
||||
<p className="text-xs text-slate-500">
|
||||
Secret values ({read.hidden.length ? read.hidden.join(", ") : "none here"}) never leave the server: they show as <code>{frp.hidden}</code> and the server's own value is put back when you save. Secrets are changed on the server, not here.
|
||||
</p>
|
||||
<div className="flex flex-wrap items-end gap-3">
|
||||
<label className="flex items-center gap-2 text-sm"><input type="checkbox" checked={restart} onChange={e => setRestart(e.target.checked)} /> Restart {frp.service} afterwards</label>
|
||||
<div><label className="label" htmlFor="frp-totp">Two-factor code</label><input id="frp-totp" className="input w-36" inputMode="numeric" autoComplete="one-time-code" required value={totp} onChange={e => setTotp(e.target.value)} /></div>
|
||||
<button className="btn-primary" disabled={!edited || busy || !!frp.pending}><Save className="h-4 w-4" /> Save on the server</button>
|
||||
{edited && <button type="button" className="btn-secondary" onClick={() => setContent(read.content ?? "")}>Undo my changes</button>}
|
||||
</div>
|
||||
</form>
|
||||
<pre className="max-h-80 overflow-auto rounded-lg border border-slate-200 bg-slate-50 p-3 font-mono text-xs text-slate-800">{read.content}</pre>
|
||||
)}
|
||||
{editing && read?.found && (
|
||||
<FrpEditModal serverId={serverId} frp={frp} read={read} onClose={() => setEditing(false)} onSent={text => { setEditing(false); onChange({ type: "ok", text }); }} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user