File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,11 +27,12 @@ export default {
2727 const url = new URL ( request . url ) ;
2828
2929 // Detection endpoint: run the full agent-readiness battery for a domain.
30- // GET /api/detect?domain=<domain> -> structured DetectionResult (cached 1h).
31- if ( url . pathname === "/api/detect" ) {
32- const domain = cleanDomain ( url . searchParams . get ( "domain" ) ) ;
33- if ( ! domain ) return json ( { error : "pass ?domain=<a valid domain>" } , 400 ) ;
34- const cacheKey = new Request ( `https://integrations.sh/api/detect?domain=${ domain } ` ) ;
30+ // GET /api/<domain>/detect -> structured DetectionResult (cached 1h).
31+ const detectMatch = url . pathname . match ( / ^ \/ a p i \/ ( [ ^ / ] + ) \/ d e t e c t \/ ? $ / ) ;
32+ if ( detectMatch ) {
33+ const domain = cleanDomain ( decodeURIComponent ( detectMatch [ 1 ] ) ) ;
34+ if ( ! domain ) return json ( { error : "invalid domain — GET /api/<domain>/detect" } , 400 ) ;
35+ const cacheKey = new Request ( `https://integrations.sh/api/${ domain } /detect` ) ;
3536 const cache = ( caches as unknown as { default : Cache } ) . default ;
3637 const cached = await cache . match ( cacheKey ) ;
3738 if ( cached ) return cached ;
You can’t perform that action at this time.
0 commit comments