@@ -10,12 +10,30 @@ clientsClaim();
1010
1111precacheAndRoute ( self . __WB_MANIFEST ) ;
1212
13+ const SPA_ROUTE_ALLOWLIST = [
14+ / ^ \/ $ / , // Home
15+ / ^ \/ s e t t i n g s $ / , // Settings
16+ / ^ \/ h i s t o r y $ / , // History list
17+ / ^ \/ p e n d i n g $ / , // Pending
18+ / ^ \/ a d d $ / , // Add credentials
19+ / ^ \/ s e n d $ / , // Send credentials
20+ / ^ \/ v e r i f i c a t i o n \/ r e s u l t $ / , // Verification result
21+ / ^ \/ l o g i n $ / , // Login
22+ / ^ \/ l o g i n - s t a t e $ / , // Login state
23+ / ^ \/ c b ( \/ .* ) ? $ / , // Callback routes
24+ / ^ \/ c r e d e n t i a l \/ [ ^ / ] + $ / , // Credential
25+ / ^ \/ c r e d e n t i a l \/ [ ^ / ] + \/ h i s t o r y $ / , // Credential history
26+ / ^ \/ c r e d e n t i a l \/ [ ^ / ] + \/ d e t a i l s $ / , // Credential details
27+ / ^ \/ h i s t o r y \/ [ ^ / ] + $ / , // History detail
28+ ] ;
29+
1330registerRoute (
1431 ( { request, url } ) => {
1532 if ( request . mode !== "navigate" ) return false ;
1633 if ( url . pathname . startsWith ( "/_" ) ) return false ;
17- if ( / \. [ a - z A - Z ] + $ / . test ( url . pathname ) ) return false ;
18- return true ;
34+ if ( / \. [ a - z A - Z 0 - 9 ] + $ / . test ( url . pathname ) ) return false ;
35+
36+ return SPA_ROUTE_ALLOWLIST . some ( ( re ) => re . test ( url . pathname ) ) ;
1937 } ,
2038 createHandlerBoundToURL ( '/index.html' )
2139) ;
0 commit comments