File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ interface PlaygroundProvider {
1919 id : string // Provider identifier
2020 name : string
2121 domains : string [ ] // Associated domains
22- paths ?: string [ ]
22+ paths ?: string [ ] // pathname must start with one of these
23+ pathContains ?: string [ ] // pathname must contain one of these
2324 icon ?: string // Provider icon name
2425}
2526
@@ -44,6 +45,8 @@ const PLAYGROUND_PROVIDERS: PlaygroundProvider[] = [
4445 name : 'CodePen' ,
4546 domains : [ 'codepen.io' ] ,
4647 icon : 'codepen' ,
48+ // Only match actual pen URLs like /username/pen/id (not profile/collection pages)
49+ pathContains : [ '/pen/' , '/full/' , '/details/' ] ,
4750 } ,
4851 {
4952 id : 'jsfiddle' ,
@@ -128,7 +131,8 @@ function matchPlaygroundProvider(url: string): PlaygroundProvider | null {
128131 for ( const domain of provider . domains ) {
129132 if (
130133 ( hostname === domain || hostname . endsWith ( `.${ domain } ` ) ) &&
131- ( ! provider . paths || provider . paths . some ( path => parsed . pathname . startsWith ( path ) ) )
134+ ( ! provider . paths || provider . paths . some ( path => parsed . pathname . startsWith ( path ) ) ) &&
135+ ( ! provider . pathContains || provider . pathContains . some ( seg => parsed . pathname . includes ( seg ) ) )
132136 ) {
133137 return provider
134138 }
You can’t perform that action at this time.
0 commit comments