File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ Object {
2222 " lighthouse_pwaGrade" : " D" ,
2323 " lighthouse_seo" : 0.9 ,
2424 " lighthouse_seoGrade" : " A" ,
25+ " testsslExpireDate" : " 2021-11-30T19:40:00.000Z" ,
26+ " testsslExpireSoon" : false ,
2527 " testsslGrade" : " A+" ,
2628 " trackersCount" : 0 ,
2729 " trackersGrade" : " A" ,
Original file line number Diff line number Diff line change @@ -6,8 +6,35 @@ const summary = (report) => {
66 report . find &&
77 report . find ( ( entry ) => entry . id === "overall_grade" ) ;
88 const value = overallGrade && overallGrade . finding ;
9+
10+ const notAfterNode = report . find ( ( r ) => r . id === "cert_notAfter" ) ;
11+ const notAfterIntermediateNode = report . find (
12+ ( r ) => r . id === "intermediate_cert_notAfter <#1>"
13+ ) ;
14+
15+ // warn a month before
16+ const warningDelay = 30 * 24 * 60 * 60 * 1000 ;
17+ let expirationDate = null ;
18+ if ( notAfterNode ) {
19+ if ( notAfterIntermediateNode ) {
20+ const closest = Math . min (
21+ new Date ( notAfterNode . finding ) . getTime ( ) ,
22+ new Date ( notAfterIntermediateNode . finding ) . getTime ( )
23+ ) ;
24+ expirationDate = closest ;
25+ } else {
26+ expirationDate = new Date ( notAfterNode . finding ) . getTime ( ) ;
27+ }
28+ }
29+
30+ const expiresSoon =
31+ expirationDate && new Date ( ) . getTime ( ) + warningDelay > expirationDate ;
32+
933 if ( value ) {
1034 return {
35+ testsslExpireSoon : expiresSoon ,
36+ testsslExpireDate :
37+ expirationDate && new Date ( expirationDate ) . toISOString ( ) ,
1138 testsslGrade : value ,
1239 } ;
1340 }
Original file line number Diff line number Diff line change @@ -662,8 +662,7 @@ Array [
662662 className = " fr-col"
663663 >
664664 <h3 >
665- Scan Summary :
666-
665+ Scan Summary :
667666 <button
668667 className = " "
669668 onClick = { [Function ]}
@@ -672,6 +671,10 @@ Array [
672671 A+
673672 </button >
674673 </h3 >
674+ <h4 >
675+ Expiration :
676+ 30/11/2021
677+ </h4 >
675678 </div >
676679 </div >
677680 </div >
@@ -2502,8 +2505,7 @@ Array [
25022505 className = " fr-col"
25032506 >
25042507 <h3 >
2505- Scan Summary :
2506-
2508+ Scan Summary :
25072509 <button
25082510 className = " "
25092511 onClick = { [Function ]}
@@ -2512,6 +2514,10 @@ Array [
25122514 A+
25132515 </button >
25142516 </h3 >
2517+ <h4 >
2518+ Expiration :
2519+ 30/11/2021
2520+ </h4 >
25152521 </div >
25162522 </div >
25172523 </div >
You can’t perform that action at this time.
0 commit comments