Implement lazy-cleanup for expired invoices with deadline-based deletion

This commit is contained in:
Alexander Schmidt
2026-03-26 11:01:32 +01:00
parent c4e3f3cd15
commit ee0d0d4124
5 changed files with 50 additions and 8 deletions

7
app.js
View File

@@ -282,10 +282,15 @@
async function shortenUrl(hash) {
try {
// Calculate expiry timestamp if deadline is set
let expiryTs = null;
if (selectedDays && selectedDays > 0) {
expiryTs = Math.floor((Date.now() + selectedDays * 86400000) / 1000);
}
const res = await fetch('/api/shorten.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ hash: hash })
body: JSON.stringify({ hash: hash, expiry_ts: expiryTs })
});
if (!res.ok) throw new Error('HTTP ' + res.status);
const data = await res.json();