File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ import { NextRequest } from 'next/server'
22import { tryCatch } from '@/lib/try-catch'
33import { Platforms } from '@/lib/utils'
44
5+ interface Versions {
6+ [ key : string ] : {
7+ download_url : string
8+ }
9+ }
10+
511const ENDPOINT = 'https://raw.githubusercontent.com/Bugazelle/chromium-all-old-stable-versions/master/chromium.stable.json'
612
713export async function GET ( request : NextRequest ) {
@@ -25,8 +31,13 @@ export async function GET(request: NextRequest) {
2531 return new Response ( 'An error occured.' , { status : 500 } )
2632 }
2733
28- const versions = data [ os ]
34+ const versions = data [ os ] as Versions
2935 if ( ! versions ) return new Response ( 'Unsupported Operating System.' , { status : 400 } )
36+
37+ const validVersions = Object . fromEntries (
38+ Object . entries ( versions )
39+ . filter ( ( [ , { download_url } ] ) => ! download_url . toLowerCase ( ) . includes ( 'error:' ) )
40+ )
3041
31- return Response . json ( versions , { status : 200 } )
42+ return Response . json ( validVersions , { status : 200 } )
3243}
You can’t perform that action at this time.
0 commit comments