Ryan 6b06e08c08 BidaAngMamayan: public supporter tribute news desk for Senator BAM Aquino
Forked from Forthena (PERSONAL/forthena) and retargeted:
- NO login, NO LLM: the edition is public and the ranking is deterministic
  (stories that name Sen. BAM lead; freshest first) — Daniel: no
  like/dislike or store profile for visitors.
- Crawler scoped to BAM: Bing news keyword queries + Inquirer/Rappler
  fallback wires, with a two-tier relevance gate (named-BAM always;
  Aquino+legislative-context only from fallback) so op-eds and non-Bam
  senators are dropped.
- Desks: BAM (lead), Gaming, Education, Politics, Energy, PH, Business.
- Community board /board: 'Thank you Senator BAM' — nickname-only posts,
  HTML-stripped, URL-only rejected, IP rate-limited (3/10min, 20/day).
- Yellow-gamer theme (Orbitron/Rajdhani/JetBrains Mono, dark + gold,
  HUD corners), supporter disclaimer in header and footer.
- Tests: category/date/relevance/text suites + Mongo board suite +
  full HTTP e2e (all passing).

Infra: 66.181.46.132 (bidaangmamamayan.com), local Mongo 7.0,
nginx + certbot TLS, PM2 bama (:3000) + 15-min crawl cron.
2026-09-15 08:37:03 +00:00

22 lines
824 B
JavaScript

import { NextResponse } from "next/server";
// The crawl tick, fired by the PM2 cron (scripts/cron-digest.cjs) every 15 min.
// Protected by the CRON_SECRET header so a random visitor cannot trigger a
// crawl on demand (it costs feed fetches + og:image rescues + article
// prefetches).
export const maxDuration = 290;
export async function POST(req) {
const secret = req.headers.get("x-bama-cron");
if (secret !== (process.env.CRON_SECRET || "bama-cron")) {
return NextResponse.json({ error: "unauthorized" }, { status: 401 });
}
try {
const { crawlOnce } = await import("../../../lib/crawl");
const crawl = await crawlOnce();
return NextResponse.json({ ok: true, crawl });
} catch (e) {
return NextResponse.json({ ok: false, error: String((e && e.message) || e) }, { status: 500 });
}
}