HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/self/root/tmp/bm_distribution_freshness_patch.cjs
const fs = require('fs');
function replaceExact(file, from, to) {
  let s = fs.readFileSync(file, 'utf8');
  if (!s.includes(from)) throw new Error(`Missing expected text in ${file}: ${from.slice(0,180)}`);
  s = s.replace(from, to);
  fs.writeFileSync(file, s, 'utf8');
}
replaceExact('scripts/growth-distribution-report.mjs',
"import fs from 'node:fs/promises';\n\nconst socialReportPath = process.env.SOCIAL_PREVIEW_REPORT || 'storage/reports/social-preview-latest.json';",
"import fs from 'node:fs/promises';\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nconst execFileAsync = promisify(execFile);\nconst socialReportPath = process.env.SOCIAL_PREVIEW_REPORT || 'storage/reports/social-preview-latest.json';");
replaceExact('scripts/growth-distribution-report.mjs',
"const readJson = async (path) => JSON.parse(await fs.readFile(path, 'utf8'));\nconst safe = (value) => String(value || '').replace(/\\s+/g, ' ').trim();",
"const readJson = async (path) => JSON.parse(await fs.readFile(path, 'utf8'));\nconst refreshSocialPreview = async () => {\n  if (process.env.GROWTH_DISTRIBUTION_SKIP_SOCIAL_REFRESH === '1') return false;\n  await execFileAsync(process.execPath, ['./scripts/social-preview-audit.mjs'], { timeout: 90000, maxBuffer: 1024 * 1024 * 8 });\n  return true;\n};\nconst safe = (value) => String(value || '').replace(/\\s+/g, ' ').trim();");
replaceExact('scripts/growth-distribution-report.mjs',
"const social = await readJson(socialReportPath);\nconst queue = [...(social.distributionQueue || [])]",
"const socialPreviewRefreshed = await refreshSocialPreview();\nconst social = await readJson(socialReportPath);\nconst queue = [...(social.distributionQueue || [])]");
replaceExact('scripts/growth-distribution-report.mjs',
"  source: {\n    socialReportPath,\n    generatedAt: social.generatedAt,\n    routes: social.routes,\n    failedRoutes: social.failedRoutes\n  },",
"  source: {\n    socialReportPath,\n    refreshedBeforeBuild: socialPreviewRefreshed,\n    generatedAt: social.generatedAt,\n    routes: social.routes,\n    failedRoutes: social.failedRoutes\n  },");
let smoke = fs.readFileSync('scripts/growth-smoke-check.mjs', 'utf8');
if (!smoke.includes('growth-distribution stale social-preview source')) {
  smoke = smoke.replace("  if (!distributionReport.ok) failures.push('growth-distribution report not ok');", "  if (!distributionReport.ok) failures.push('growth-distribution report not ok');\n  if (!distributionReport.source?.refreshedBeforeBuild) failures.push('growth-distribution did not refresh social-preview before build');\n  if (distributionReport.source?.generatedAt && distributionReport.generatedAt && Math.abs(Date.parse(distributionReport.generatedAt) - Date.parse(distributionReport.source.generatedAt)) > 5 * 60 * 1000) failures.push('growth-distribution stale social-preview source');");
}
fs.writeFileSync('scripts/growth-smoke-check.mjs', smoke, 'utf8');