File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { NextRequest , NextResponse } from 'next/server'
2- import fs from 'fs'
3- import path from 'path'
2+
3+ const GITHUB_DOCS_URL = 'https://raw.githubusercontent.com/w3hc/w3pk/main/docs'
4+
5+ const DOC_FILES = [
6+ 'QUICK_START.md' ,
7+ 'API_REFERENCE.md' ,
8+ 'INTEGRATION_GUIDELINES.md' ,
9+ 'SECURITY.md' ,
10+ 'ARCHITECTURE.md' ,
11+ 'RECOVERY.md' ,
12+ 'EIP-7951.md' ,
13+ 'EIP_7702.md' ,
14+ 'ZK.md' ,
15+ 'BUILD_VERIFICATION.md' ,
16+ 'BROWSER_COMPATIBILITY.md' ,
17+ ]
418
519export async function GET ( request : NextRequest ) {
620 try {
@@ -9,15 +23,17 @@ export async function GET(request: NextRequest) {
923
1024 if ( ! file ) {
1125 // Return list of all docs
12- const docsPath = path . join ( process . cwd ( ) , '../w3pk/docs' )
13- const files = fs . readdirSync ( docsPath ) . filter ( f => f . endsWith ( '.md' ) )
26+ return NextResponse . json ( { files : DOC_FILES } )
27+ }
28+
29+ // Fetch specific file content from GitHub
30+ const response = await fetch ( `${ GITHUB_DOCS_URL } /${ file } ` )
1431
15- return NextResponse . json ( { files } )
32+ if ( ! response . ok ) {
33+ throw new Error ( `Failed to fetch ${ file } : ${ response . statusText } ` )
1634 }
1735
18- // Return specific file content
19- const docsPath = path . join ( process . cwd ( ) , '../w3pk/docs' , file )
20- const content = fs . readFileSync ( docsPath , 'utf-8' )
36+ const content = await response . text ( )
2137
2238 return NextResponse . json ( { content, filename : file } )
2339 } catch ( error ) {
Original file line number Diff line number Diff line change @@ -533,7 +533,7 @@ console.log('Is valid member?', isValid) // true
533533 </ Box >
534534
535535 { /* Call to Action */ }
536- < Box
536+ { /* <Box
537537 p={8}
538538 borderColor={brandColors.accent}
539539 border="2px solid"
@@ -568,7 +568,7 @@ console.log('Is valid member?', isValid) // true
568568 <Text fontSize="sm" color="whiteAlpha.700" mt={4}>
569569 Experience passwordless authentication + anonymous voting
570570 </Text>
571- </ Box >
571+ </Box> */ }
572572 </ VStack >
573573 </ Container >
574574 )
You can’t perform that action at this time.
0 commit comments