mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-20 13:52:28 +03:00
* feat(radar): sync referral links from standalone /v1/referrals/latest feed Referral links previously came from the catalog feed cache, which on the community tier can be up to 30 days stale -- a newly-added referral would not reach a free/community user for up to a month. Adds a new sync module (syncRadarReferrals), Ed25519-verified feed schema, and a dedicated radar_referrals_cache table (migration 142) so referrals sync on their own, much shorter cadence instead of inheriting the catalog's delay. getRadarReferrals()/getDefaultReferralFor() now read the new cache instead of the catalog feed's embedded referrals field (kept on RadarFeedSchema for backward-compat with already-cached catalog feeds, but no longer read). * feat(radar): wire sync-on-read + scheduler side-sync for referrals GET /api/radar/referrals now triggers syncRadarReferrals() inline whenever the cache is missing or older than 1h (shouldSyncReferralsOnRead), so fixed links show up promptly on the next dashboard load instead of waiting on a background timer. The route itself still never talks to the upstream feed server directly -- syncRadarReferrals() remains the only network touchpoint. radarSchedulerTick() also evaluates referrals staleness on the same hourly tick used for the catalog, independent of the catalog's own due-ness, as a best-effort side effect that never changes RadarTickResult's shape and is swallowed on error. * docs(radar): document the standalone referrals feed sync Explains the /v1/referrals/latest feed, its no-tier-field-in-body design (x-omniroute-feed-tier header is the only tier source), the sync-on-read + scheduler side-sync triggers, and the self-hosting note for forks that only serve the catalog feed. --------- Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
21 lines
815 B
SQL
21 lines
815 B
SQL
-- 142_radar_referrals_cache.sql
|
|
-- Radar referrals client local cache table.
|
|
--
|
|
-- radar_referrals_cache: single-row table holding the last verified
|
|
-- referrals feed JSON, fetched from GET /v1/referrals/latest — a separate,
|
|
-- always-current artifact from the catalog feed cached in
|
|
-- radar_feed_cache (migration 136). Introduced so referral links no
|
|
-- longer inherit the catalog's up-to-30-day community-tier snapshot
|
|
-- delay. The payload is the exact byte-identical feed returned by the
|
|
-- Radar server after Ed25519 signature verification (same pinned key as
|
|
-- the catalog feed).
|
|
|
|
CREATE TABLE IF NOT EXISTS radar_referrals_cache (
|
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
generated_at TEXT,
|
|
tier TEXT,
|
|
payload TEXT,
|
|
signature TEXT,
|
|
fetched_at TEXT
|
|
);
|