Every day from 07:00 Chiang Mai time the app mails the journal's last entry number and its hash to the addresses set on the Notifications page (src/anchor.rs, migration 0012: settings, journal_anchors), when anything was added since the last anchor that went out. A day without news is noted without a mail; a failed send is tried again after an hour; a transaction-level advisory lock keeps two runs from both sending. "Send the anchor now" sends at once. Each mail says whether the chain checked whole (in capitals when it did not) and links to /journal/anchor, which compares a kept entry number and hash with the journal now: the same hash, another one, or no such entry. Changing the recipients is itself a journal entry. Every anchor mail is in the notifications log. Tests: the daily rule (before seven, once a day, an hour after a failure), recipients checked and journaled, one mail per recipient with the head hash, unchanged days, by hand, the check page's three answers, and a chain broken around the app said in the mail. 126 unit, 67 integration.
26 lines
1.8 KiB
HTML
26 lines
1.8 KiB
HTML
{% extends "base.html" %}
|
|
{% import "_fields.html" as fm %}
|
|
{% block main %}
|
|
<div class="crumbs"><a href="/journal">Journal</a></div>
|
|
<div class="pagehead"><h1>Check an anchor</h1></div>
|
|
<p class="meta">An anchor is an entry's number and its hash, kept outside the server: the daily anchor mail, a printout, a note. If the journal still gives that entry the same hash, nothing up to it was changed since.</p>
|
|
{% if result %}
|
|
{% if result.same %}
|
|
<div class="notice ok" role="status" id="anchor-result"><b>Entry {{ result.seq }} still has this hash.</b> The journal up to it is as it was when the anchor was taken (written {{ result.at }}).{% if not whole %} The journal after it does not check whole: see <a href="/journal">the journal</a>.{% endif %}</div>
|
|
{% elif result.now %}
|
|
<div class="notice bad" role="alert" id="anchor-result"><b>Entry {{ result.seq }} has a different hash now.</b> The journal up to it was changed and rebuilt after the anchor was taken. Tell the team's lead at once.<div class="mono small hashline">kept: {{ result.hash }}</div><div class="mono small hashline">now: {{ result.now }}</div></div>
|
|
{% else %}
|
|
<div class="notice bad" role="alert" id="anchor-result"><b>There is no entry {{ result.seq }}.</b> The journal has {{ count }} entries now: entries were taken out after the anchor was taken. Tell the team's lead at once.</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
<form method="get" action="/journal/anchor" class="form" id="anchor-check-form">
|
|
<section class="card">
|
|
<div class="grid">
|
|
{{ fm.text("seq", "Entry number", seq, req=true, err=error) }}
|
|
{{ fm.text("hash", "Its hash", hash, req=true, cls="wide", ph="64 characters, 0 to 9 and a to f") }}
|
|
</div>
|
|
<div class="formactions"><button type="submit" class="btn pri" id="check-anchor">Check</button></div>
|
|
</section>
|
|
</form>
|
|
{% endblock %}
|