Merge pull request #66 from kristianwind/indbakken-har-en-adresse-apps-kan-skubbe-til
CI / OpenAPI is valid (push) Successful in 11s
CI / End-to-end (push) Successful in 11m3s
CI / Docker image builds (push) Successful in 2m17s
Release / Build and publish image (push) Failing after 9s
CI / Go (push) Failing after 15m6s

feat(indbakke): en adresse, andre programmer kan skubbe en opgave til
This commit is contained in:
Kristian Wind
2026-09-08 14:12:17 +02:00
committed by GitHub
10 changed files with 633 additions and 0 deletions
@@ -289,6 +289,9 @@
let feedURL = $state('');
let mailAddress = $state('');
// Krogen ind i indbakken: den URL, en genvej på telefonen eller et script kan
// skubbe en linje tekst til.
let hookURL = $state('');
/** Null until loaded, so the warning does not flash before the answer is in. */
let mailConfigured = $state(null);
@@ -301,6 +304,10 @@
mailConfigured = r.configured;
})
.catch(() => {});
api
.getHookURL()
.then((r) => (hookURL = r.url))
.catch(() => {});
});
async function rotateFeed() {
@@ -323,6 +330,15 @@
}
}
async function rotateHook() {
if (!confirm(t('int.newHookQuestion'))) return;
try {
hookURL = (await api.rotateHookURL()).url;
} catch (e) {
app.toast(humanMessage(e));
}
}
async function copy(text) {
try {
await navigator.clipboard.writeText(text);
@@ -674,6 +690,38 @@
</div>
</section>
<section class="panel">
<header>
<h2>{t('int.hookToTask')}</h2>
<p class="hint">
{t('int.hookHint')}
</p>
</header>
<div class="field">
<label for="hook">{t('int.yourHook')}</label>
<input id="hook" class="mono" value={hookURL} readonly />
<p class="hint">
{t('int.hookHow')}
</p>
</div>
<!-- Vist som den kommando, den er. Den, der skal sætte det op, skal kunne
prøve det af ét sted, før de bygger genvejen på telefonen — og se, at
kroppen bare er den linje, opgaven skal hedde. -->
<div class="field">
<label for="hookcurl">{t('int.hookExample')}</label>
<textarea id="hookcurl" class="mono" rows="3" readonly
>{`curl -X POST ${hookURL} \\\n -H "Content-Type: text/plain" \\\n -d "Ring til Anders i morgen p1 #Firma"`}</textarea
>
</div>
<div class="row">
<button class="secondary" onclick={() => copy(hookURL)}>{t('int.copy')}</button>
<button class="danger" onclick={rotateHook}>{t('int.newHook')}</button>
</div>
</section>
<section class="panel">
<header>
<h2>{t('int.caldav')}</h2>