Files
lokiloto/lib/lokilab-feed.ts
T
Nazim KriandClaude Sonnet 5 b2915d06cd Scaffold LokiLoto: country theme engine, LokiLab feed client, Québec home page
International lottery stats layer, fed by LokiLab's army-feed API
(results, Loki's picks, lifetime win record, army size). One mascot
reskinned per country via flag-derived colors; Québec is the first
locale, same pattern every future country will follow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-29 21:23:01 -04:00

41 lines
1002 B
TypeScript

import 'server-only'
/**
* The one contract between LokiLab and LokiLoto: results, Loki's picks,
* lifetime win record, and army size. LokiLoto never talks to LokiLab's
* database or stats engine directly — only this feed.
*/
export interface ArmyFeed {
army: {
total: number
byCountry: Record<string, number>
}
lotteries: LotteryFeedEntry[]
}
export interface LotteryFeedEntry {
id: string
name: string
country: string
lifetime: {
picksTracked: number
wins: number
winRate: number
}
lastDraw: {
date: string
result: number[]
pick: number[] | null
matched: number | null
won: boolean | null
} | null
}
const LOKILAB_FEED_URL = process.env.LOKILAB_FEED_URL ?? 'https://goldd.devyouz.net/api/public/army-feed'
export async function getArmyFeed(): Promise<ArmyFeed> {
const res = await fetch(LOKILAB_FEED_URL, { next: { revalidate: 300 } })
if (!res.ok) throw new Error(`LokiLab feed returned ${res.status}`)
return res.json()
}