Fix Scripture Index doubled/unparseable refs, Titus passage fetch 400, Ko-fi QR 404, auto-load study comments; stop probe URLs inflating Real Hits, real 404 status for unknown URLs; v2.43.1

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-15 11:30:05 -04:00
1 parent 09177f47ed
commit 6a5d525d6e
10 files changed
+59 -10

No files matched your search

+2
View File
@@ -20,6 +20,7 @@ import {
buildLastNDaysStats,
shouldCountHit,
recordHit,
isKnownSitePath,
getStudyCatalog,
} from '../study-helpers.js'
@@ -260,6 +261,7 @@ export function register(app) {
const ip = getClientIp(req)
if (!pageviewAllowed(ip)) { res.json({ ok: false, reason: 'rate-limited' }); return }
const rawPath = typeof req.body?.path === 'string' ? req.body.path : '/'
if (!isKnownSitePath(rawPath)) { res.json({ ok: false, reason: 'unknown-path' }); return }
const rawReferrer = typeof req.body?.referrer === 'string' ? req.body.referrer : ''
recordHit(rawPath, false)
queueHitStatsWrite()
+6 -1
View File
@@ -29,7 +29,12 @@ BIBLE_BOOKS.forEach((b, index) => {
})
function parseReference(reference) {
const stripped = reference.replace(/^[a-z]+/i, '')
// Accept a leading book name ("Titus 1:1-2", "1 John 2:3"), en/em dashes and verse-part letters ("1:13a")
const stripped = reference
.replace(/[–—]/g, '-')
.replace(/(\d)[a-z]\b/gi, '$1')
.replace(/^\s*(?:[1-3]\s*)?[a-z][a-z .]*?\s*(?=\d+:)/i, '')
.trim()
const match = stripped.match(/^(\d+):(\d+)(?:-(\d+))?$/)
if (!match) return null
return {
+5 -2
View File
@@ -16,7 +16,7 @@ import {
} from '../config.js'
import { state } from '../state.js'
import { loadSiteContentFile } from '../data.js'
import { sanitizeRedirectRules } from '../study-helpers.js'
import { sanitizeRedirectRules, isKnownSitePath } from '../study-helpers.js'
import { fetchAllEpisodes } from './episodes.js'
import { fetchNuggetsEpisodes } from './nuggets.js'
import { BIBLE_BOOKS } from '../../shared/bible-books.js'
@@ -217,7 +217,8 @@ export function register(app) {
if (!sec.id || !sec.reference || !sec.releasedAt) continue
if (new Date(sec.releasedAt) > cutoff) continue
entries.push({
reference: `${bookName} ${sec.reference}`,
// Section references often already include the book ("Titus 1:1-2"); only prepend when they don't
reference: /^\s*(?:[1-3]\s*)?[A-Za-z]/.test(sec.reference) ? sec.reference.trim() : `${bookName} ${sec.reference}`,
sourceType: 'study',
sourceTitle: s.title || s.slug,
sectionTitle: sec.title || '',
@@ -274,6 +275,8 @@ export function register(app) {
app.use(async (_req, res) => {
try {
const html = await readFile(INDEX_FILE, 'utf8')
// Unknown URLs still render the app's "Page not found" screen, but with a real 404 status
if (!isKnownSitePath(_req.path)) res.status(404)
res.type('html').send(injectSeoIntoHtml(html, state.cachedSiteContent))
} catch {
res.status(503).send('Frontend build not found. Run "npm run build" first.')