v1.13.1-data: links/redirects, captions, partner picks, Plausible reports, migration baseline #28

Merged
ngu-git-admin merged 16 commits from data into main 2026-10-06 10:10:57 +01:00
Showing only changes of commit 5de3cae599 - Show all commits

View file

@ -80,8 +80,16 @@ redirects.get("/go/:id", (c, next) => {
db.prepare(`UPDATE redirects SET clicks = clicks + 1, last_clicked_at = datetime('now') WHERE id = ?`).run(row.id);
const site = siteFor(db);
tellPlausible(c, site, row.id);
// site.json gives Plausible's domain and an origin to resolve paths
// against. Without it (SITE_CONFIG missing) the visitor still goes
// on; only the Plausible report is skipped.
let site = {};
try {
site = siteFor(db);
} catch (err) {
console.warn(`redirects: /go/${row.id} without site.json (${err.message}); not reported to Plausible`);
}
if (site.url) tellPlausible(c, site, row.id);
for (const [name, value] of Object.entries(NO_STORE)) c.header(name, value);
return c.redirect(destination(row, site.url || "http://localhost"), 302);
});