@@ -3,49 +3,8 @@ import { h } from 'vue'
33import DefaultTheme from 'vitepress/theme'
44import type { Theme } from 'vitepress'
55import './style.css'
6- import { theme , useOpenapi } from 'vitepress-openapi/client'
7- import 'vitepress-openapi/dist/style.css'
86import ActionHighlight from './components/ActionHighlight.vue'
97
10- // Global server fetching utility
11- export const fetchWaxEndpoints = async ( ) => {
12- // Check cache first
13- const cacheKey = 'wax-endpoints-cache'
14- const cacheExpiry = 1000 * 60 * 60 * 24 // 24 hours in milliseconds
15-
16- try {
17- const cached = localStorage . getItem ( cacheKey )
18- if ( cached ) {
19- const { endpoints : cachedEndpoints , timestamp } = JSON . parse ( cached )
20- const now = Date . now ( )
21-
22- // Use cached endpoints if they're still valid
23- if ( now - timestamp < cacheExpiry ) {
24- console . log ( 'Using cached endpoint list' )
25- return cachedEndpoints
26- }
27- }
28-
29- // Fetch fresh data if cache is expired or doesn't exist
30- console . log ( 'Fetching fresh endpoint list' )
31- const response = await fetch ( 'https://validate.eosnation.io/wax/reports/endpoints.json' )
32- const data = await response . json ( )
33- const endpoints = data . report
34-
35- // Cache the new data
36- const cacheData = {
37- endpoints,
38- timestamp : Date . now ( )
39- }
40- localStorage . setItem ( cacheKey , JSON . stringify ( cacheData ) )
41-
42- return endpoints
43- } catch ( err ) {
44- console . error ( 'Failed to fetch endpoints, using defaults:' , err )
45- return null
46- }
47- }
48-
498/** @type {import('vitepress').Theme } */
509export default {
5110 extends : DefaultTheme ,
@@ -55,17 +14,6 @@ export default {
5514 } )
5615 } ,
5716 async enhanceApp ( { app, router, siteData } ) {
58- app . component ( 'ActionHighlight' , ActionHighlight ) ,
59- useOpenapi ( {
60- config : {
61- spec : {
62- groupByTags : false ,
63- } ,
64- server : {
65- allowCustomServer : true ,
66- } ,
67- } ,
68- } ) ,
69- theme . enhanceApp ( { app, router, siteData } )
17+ app . component ( 'ActionHighlight' , ActionHighlight )
7018 }
7119} satisfies Theme
0 commit comments