mirror of
https://github.com/caty21/forex-dashboard.git
synced 2026-08-23 17:38:05 +00:00
fix: Sem. préc. HEAD→GET, prevMeetings cache, remove footer
- investinglive: tryUrl HEAD→GET + res.body?.cancel() (WordPress bloque HEAD) fenêtre recherche article préc. élargie 21→28 jours - rateprobability: CBRatePath + prevMeetings/prevWeekDate, loadPrevWeekCachedBody() fetchAllCBPaths enrichit prevMeetings depuis snapshot GitHub Actions - fetch-rate-data.mjs: rotation current→previousWeek (5–9 jours) pour Rate Curve - CurrencyCard: rateCurveData préfère prevMeetings (exact/meeting) > ilDelta (approx) légende hasPrevCurve pilote affichage ligne bleue et label date - page.tsx: suppression footer Sources/LLM, remplacement par pb-12 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
1a7468d718
commit
a978f19088
@@ -52,12 +52,15 @@ async function tryUrl(daysAgo: number): Promise<ArticleRef | null> {
|
||||
const dateStr = `${yyyymmdd.slice(0,4)}-${yyyymmdd.slice(4,6)}-${yyyymmdd.slice(6,8)}`;
|
||||
const url = `https://investinglive.com/news/how-have-interest-rate-expectations-changed-after-this-weeks-event-${yyyymmdd}/`;
|
||||
try {
|
||||
// GET au lieu de HEAD — certains serveurs WordPress refusent HEAD (405/404 même si la page existe)
|
||||
const res = await fetch(url, {
|
||||
method: "HEAD",
|
||||
method: "GET",
|
||||
headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124.0.0.0 Safari/537.36" },
|
||||
cache: "no-store",
|
||||
});
|
||||
return res.ok ? { url, dateStr, daysAgo } : null;
|
||||
if (!res.ok) return null;
|
||||
await res.body?.cancel(); // libère la connexion sans télécharger le body
|
||||
return { url, dateStr, daysAgo };
|
||||
} catch { return null; }
|
||||
}
|
||||
|
||||
@@ -73,8 +76,8 @@ async function findArticleRefs(): Promise<{ current: ArticleRef | null; previous
|
||||
if (!current) return { current: null, previous: null };
|
||||
|
||||
let previous: ArticleRef | null = null;
|
||||
// Start the day after the current article and look up to 21 days further back
|
||||
for (let d = current.daysAgo + 1; d <= current.daysAgo + 21; d++) {
|
||||
// Start the day after the current article and look up to 28 days further back
|
||||
for (let d = current.daysAgo + 1; d <= current.daysAgo + 28; d++) {
|
||||
const found = await tryUrl(d);
|
||||
if (found) { previous = found; break; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user