diff --git a/apps/tempo-snapshots-viewer/README.md b/apps/tempo-snapshots-viewer/README.md index a9234f8cc..37faa3f6a 100644 --- a/apps/tempo-snapshots-viewer/README.md +++ b/apps/tempo-snapshots-viewer/README.md @@ -1,6 +1,6 @@ -# Tempo Snapshots Viewer +# Tempo Snapshots -Cloudflare Worker that displays Tempo snapshots stored in R2, including legacy single-archive snapshots and Reth-style v2 modular manifests across multiple Tempo networks. +Cloudflare Worker for browsing and downloading Tempo node snapshots stored in R2. The UI lets operators choose a Tempo network, select a published snapshot, and generate the matching `tempo download` command for minimal, full, archive, or custom component profiles. ## Prerequisites @@ -45,7 +45,7 @@ apps/tempo-snapshots-viewer/ 1. The worker scans the bucket for both legacy root-level metadata files and v2 snapshot directories containing `manifest.json`. 2. It normalizes every snapshot into one API shape, groups them by Tempo network, and caches the result at the edge. -3. The UI uses the same modular snapshot experience as the Reth viewer, but adds Tempo network selection for mainnet, testnet, and moderato. -4. If a network has not published a v2 manifest yet, the UI falls back to the latest legacy archive download command for that network. +3. The UI presents Tempo network selection for mainnet, Moderato, and devnet, then derives download profiles from the selected manifest. +4. If a network has not published a modular manifest yet, the UI falls back to the latest archive download command for that network. API endpoint: `/api/snapshots` returns the normalized snapshot list without raw manifest payloads. diff --git a/apps/tempo-snapshots-viewer/src/index.ts b/apps/tempo-snapshots-viewer/src/index.ts index 9f11a3e6e..89019e5ee 100644 --- a/apps/tempo-snapshots-viewer/src/index.ts +++ b/apps/tempo-snapshots-viewer/src/index.ts @@ -93,6 +93,7 @@ interface NetworkInfo { const NETWORKS: Record = { '4217': { chainId: '4217', key: 'mainnet', name: 'Mainnet' }, '42431': { chainId: '42431', key: 'moderato', name: 'Moderato' }, + '31318': { chainId: '31318', key: 'devnet', name: 'Devnet' }, } const DEFAULT_CHAIN_ID = '4217' @@ -245,7 +246,7 @@ function getNetworkInfo(chainId: string): NetworkInfo { } function compareChainIds(a: string, b: string): number { - const order = [DEFAULT_CHAIN_ID, '42431'] + const order = [DEFAULT_CHAIN_ID, '42431', '31318'] const aIndex = order.indexOf(a) const bIndex = order.indexOf(b) @@ -656,9 +657,10 @@ async function getSnapshots(env: Env): Promise { return snapshots } -const CACHE_KEY_FULL = 'https://snapshots.tempoxyz.dev/cache/v2/full' -const CACHE_KEY_API = 'https://snapshots.tempoxyz.dev/cache/v2/api' -const CACHE_KEY_UI_HTML = 'https://snapshots.tempoxyz.dev/cache/v2/ui-html' +const CACHE_VERSION = 'v16' +const CACHE_KEY_FULL = `https://snapshots.tempoxyz.dev/cache/${CACHE_VERSION}/full` +const CACHE_KEY_API = `https://snapshots.tempoxyz.dev/cache/${CACHE_VERSION}/api` +const CACHE_KEY_UI_HTML = `https://snapshots.tempoxyz.dev/cache/${CACHE_VERSION}/ui-html` const CACHE_TTL = 3600 // 1 hour — snapshots change at most once per day let snapshotRefreshPromise: Promise | undefined @@ -878,15 +880,15 @@ async function handleUI(_req: Request, env: Env) { - Tempo Snapshots - - - + Snapshots - Tempo + + + - - + + @@ -895,98 +897,99 @@ async function handleUI(_req: Request, env: Env) {