Initial commit: Visigine (Vite client + Express/SQLite backend)
Container-ready via docker/ compose (frontend nginx + backend Node). Compose adjusted for Coolify on the prod server: frontend uses expose:80 (no host binding — host 8080 is taken by the Coolify proxy; Traefik routes visigine.de), backend ALLOWED_ORIGINS=https://visigine.de. Secrets stay in server/.env (git-ignored); see server/.env.example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
16
server/lib/parser.js
Normal file
16
server/lib/parser.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// Extracts the parts of the HTML response that downstream checks need.
|
||||
export function parseHtml(html) {
|
||||
const safe = html || ''
|
||||
const headMatch = safe.match(/<head[\s\S]*?<\/head>/i)
|
||||
const headHtml = headMatch ? headMatch[0] : safe.slice(0, 4000)
|
||||
|
||||
const jsonLdBlocks = [
|
||||
...safe.matchAll(/<script[^>]*type=["']application\/ld\+json["'][^>]*>([\s\S]*?)<\/script>/gi),
|
||||
]
|
||||
.map((m) => m[1].trim())
|
||||
.filter(Boolean)
|
||||
|
||||
const jsonLdJoined = jsonLdBlocks.join('\n---\n')
|
||||
|
||||
return { headHtml, jsonLdBlocks, jsonLdJoined }
|
||||
}
|
||||
Reference in New Issue
Block a user