11const TIMEOUT_MS = 5000 ;
22
33const WEBSITES = [
4- { name : 'TP Vue' , path : '/B3dev-TP_VUE/' } ,
5- { name : 'SaintBarth Volley' , path : '/saintbarthvolley/' } ,
6- { name : 'Lucky7' , path : '/lucky7/' } ,
4+ { name : 'TP Vue' , path : '/B3dev-TP_VUE/' } ,
5+ { name : 'SaintBarth Volley' , path : '/saintbarthvolley/' } ,
6+ { name : 'Lucky7' , path : '/lucky7/' } ,
77 { name : 'College La Boussole' , path : '/collegelaboussole/' } ,
8- { name : 'Cinemap' , path : '/cinemap/' } ,
8+ { name : 'Cinemap' , path : '/cinemap/' } ,
99] ;
1010
1111async function checkWebsite ( baseUrl , site ) {
@@ -14,12 +14,12 @@ async function checkWebsite(baseUrl, site) {
1414 const timer = setTimeout ( ( ) => controller . abort ( ) , TIMEOUT_MS ) ;
1515
1616 try {
17- const res = await fetch ( url , { signal : controller . signal } ) ;
17+ const res = await fetch ( url , { signal : controller . signal , redirect : 'manual' } ) ;
1818 return {
1919 name : site . name ,
2020 url : site . path ,
2121 httpCode : res . status ,
22- status : res . status === 200 ? 'OK' : 'DOWN' ,
22+ status : res . status < 500 ? 'OK' : 'DOWN' ,
2323 } ;
2424 } catch {
2525 return {
@@ -33,8 +33,6 @@ async function checkWebsite(baseUrl, site) {
3333 }
3434}
3535
36- async function checkWebsites ( baseUrl ) {
36+ export async function checkWebsites ( baseUrl ) {
3737 return Promise . all ( WEBSITES . map ( ( site ) => checkWebsite ( baseUrl , site ) ) ) ;
3838}
39-
40- module . exports = { checkWebsites } ;
0 commit comments