battery.js: Fix online connectivity check

This commit is contained in:
base47
2026-02-12 02:17:13 +01:00
parent aef458db8f
commit 8fb2e4d18d

View File

@@ -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 [