File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -26,17 +26,26 @@ try {
26
26
}
27
27
28
28
if ( pageviews < 1 ) return ;
29
+
29
30
try {
30
- if ( ! ( new URL ( url ) . host . includes ( 'kotlinlang.org' ) ) ) return ;
31
+ let uri = new URL ( url ) ;
32
+
33
+ if ( uri . host . match ( / ^ ( w w w \. ) ? j e t b r a i n s \. c o m $ / ) && uri . pathname . startsWith ( '/help/kotlin-multiplatform-dev/' ) ) {
34
+ uri . hostname = 'kotlinlang.org' ;
35
+ uri . pathname = uri . pathname . replace ( '/help/kotlin-multiplatform-dev/' , '/docs/multiplatform/' ) ;
36
+ }
37
+
38
+ if ( uri . host !== 'kotlinlang.org' ) return ;
39
+
40
+ const path = uri . toString ( ) ;
41
+
42
+ await Promise . all ( [
43
+ listViews . appendFile ( JSON . stringify ( { path, pageviews } ) + ',' ) ,
44
+ mapViews . appendFile ( `${ JSON . stringify ( path ) } : ${ pageviews } ,` )
45
+ ] ) ;
31
46
} catch ( e ) {
32
47
console . error ( 'Error in' , line , 'line' ) ;
33
- return ;
34
48
}
35
-
36
- await Promise . all ( [
37
- listViews . appendFile ( JSON . stringify ( { url, pageviews } ) + ',' ) ,
38
- mapViews . appendFile ( `${ JSON . stringify ( url ) } : ${ pageviews } ,` )
39
- ] ) ;
40
49
}
41
50
42
51
const lines = [ ] ;
You can’t perform that action at this time.
0 commit comments