From 8fb2e4d18d35d48a400eef50c5d8d9b2ca5f8331 Mon Sep 17 00:00:00 2001 From: base47 Date: Thu, 12 Feb 2026 02:17:13 +0100 Subject: [PATCH] battery.js: Fix online connectivity check --- app/modules/battery.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/modules/battery.js b/app/modules/battery.js index e18863e..9b3ab07 100644 --- a/app/modules/battery.js +++ b/app/modules/battery.js @@ -165,11 +165,12 @@ const initialize_battery = async () => { if( development ) log( `Dev mode on, skip updates: ${ skipupdate }` ) // Check for network - const online = await Promise.race( [ - exec_async( `${ path_fix } curl -I https://icanhazip.com &> /dev/null` ).then( () => true ).catch( () => false ), - exec_async( `${ path_fix } curl -I https://github.com &> /dev/null` ).then( () => true ).catch( () => false ) - ] ) - log( `Internet online: ${ online }` ) + const online_check_timeout_millisec = 3000 + const online = await Promise.any( [ + exec_async( `${ path_fix } curl -I https://icanhazip.com > /dev/null 2>&1`, online_check_timeout_millisec ), + exec_async( `${ path_fix } curl -I https://github.com > /dev/null 2>&1`, online_check_timeout_millisec ) + ] ).then( () => true ).catch( () => false ) + log( `Internet online: `, online) // Check if battery background executables are installed and owned by root. const [