File: //proc/thread-self/root/tmp/dateweb_patch_active_local_integration.cjs
const fs = require('fs');
let deploy = fs.readFileSync('scripts/deploy-webroot.sh', 'utf8');
if (!deploy.includes('patch-active-local-city-bridges.mjs')) {
deploy = deploy.replace('# dateweb growth route: Feed and RSS\nif [ -f scripts/generate-static-feed.mjs ]; then\n node scripts/generate-static-feed.mjs\nfi', '# dateweb growth route: Feed and RSS\nif [ -f scripts/generate-static-feed.mjs ]; then\n node scripts/generate-static-feed.mjs\nfi\n\n# dateweb growth links: active local city bridges\nif [ -f scripts/patch-active-local-city-bridges.mjs ]; then\n node scripts/patch-active-local-city-bridges.mjs\nfi');
}
fs.writeFileSync('scripts/deploy-webroot.sh', deploy, 'utf8');
let audit = fs.readFileSync('scripts/visitor-audit.sh', 'utf8');
if (!audit.includes('active_local_city_bridge')) {
const check = `\nlog "Checking active local city bridges"\nfor page in "$PUBLIC_HTML/index.html" "$PUBLIC_HTML/tools/index.html" "$PUBLIC_HTML/feed/index.html" "$PUBLIC_HTML/dating/index.html" "$PUBLIC_HTML/dating/muenchen/index.html" "$PUBLIC_HTML/dating/koeln/index.html" "$PUBLIC_HTML/dating/frankfurt/index.html"; do\n if ! grep -q "active_local_city_bridge" "$page"; then\n log "ERROR: active local city bridge missing in $page"\n exit 1\n fi\n for marker in "/dating/frankfurt/?from=active_city_bridge" "/dating/muenchen/?from=active_city_bridge" "/dating/koeln/?from=active_city_bridge"; do\n if ! grep -q "$marker" "$page"; then\n log "ERROR: active local city bridge target missing in $page: $marker"\n exit 1\n fi\n done\ndone\n`;
audit = audit.replace('require_path "$PUBLIC_HTML/.htaccess"', `${check}\nrequire_path "$PUBLIC_HTML/.htaccess"`);
}
fs.writeFileSync('scripts/visitor-audit.sh', audit, 'utf8');
let backlog = fs.readFileSync('scripts/growth-backlog.mjs', 'utf8');
if (!backlog.includes('patch-active-local-city-bridges.mjs')) {
const anchor = " 'scripts/generate-static-local-pages.mjs',\n";
if (backlog.includes(anchor)) backlog = backlog.replace(anchor, `${anchor} 'scripts/patch-active-local-city-bridges.mjs',\n`);
}
for (const [route, slug] of [['/dating/muenchen/', 'muenchen'], ['/dating/koeln/', 'koeln'], ['/dating/frankfurt/', 'frankfurt']]) {
const re = new RegExp(`\\['${route.replaceAll('/', '\\/')}', \\[.*?\\]\\]`);
if (backlog.includes(`['${route}', [`)) backlog = backlog.replace(re, `['${route}', ['active_local_city_bridge', '${slug}', 'local_hero_register']]`);
}
fs.writeFileSync('scripts/growth-backlog.mjs', backlog, 'utf8');