diff --git a/app/src/DashboardPage.js b/app/src/DashboardPage.js index 33c327f9..b3a6ed07 100644 --- a/app/src/DashboardPage.js +++ b/app/src/DashboardPage.js @@ -1,4 +1,4 @@ -import {LoadStatistic, PageContainer, SearchResultsInput, useTitle} from "./components/Common"; +import {ErrorMessage, LoadStatistic, PageContainer, SearchResultsInput, useTitle} from "./components/Common"; import React, {useContext, useState} from "react"; import {Media, SettingsContext, StatusContext} from "./contexts/contexts"; import {DownloadMenu} from "./components/Download"; @@ -40,8 +40,9 @@ function FlagsMessages() { let refreshing; let refreshRequired; - let dbDown; let kiwixRestart; + let dbDown; + let internetDown; // Do not tell the maintainer to refresh the files if they are already refreshing. if (flags['refreshing']) { @@ -69,13 +70,17 @@ function FlagsMessages() { } if (!flags['db_up']) { - dbDown = - - - Database is down - API is unable to connect to the database. Check the server logs. - - + dbDown = + Database is down + API is unable to connect to the database. Check the server logs. + + } + + if (!flags.have_internet) { + internetDown = + No Internet + WROLPi has no Internet. Downloads will not start. + ; } return <> @@ -84,6 +89,7 @@ function FlagsMessages() { {settings && settings['ignore_outdated_zims'] === false && flags['outdated_zims'] ? : null} {kiwixRestart} + {status.wrol_mode || internetDown} } diff --git a/app/src/components/Common.js b/app/src/components/Common.js index c5a7572a..c2db1130 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -1644,19 +1644,19 @@ export function HandPointMessage({children, size = null}) { } -export function WarningMessage({children, size = null}) { +export function WarningMessage({children, size = null, icon='exclamation'}) { // Use color='yellow' because "warning" does not work. return - + {children} } -export function ErrorMessage({children, size = null}) { +export function ErrorMessage({children, size = null, icon='exclamation'}) { return - + {children} } diff --git a/app/src/components/Zim.js b/app/src/components/Zim.js index c89f5252..f2a4734a 100644 --- a/app/src/components/Zim.js +++ b/app/src/components/Zim.js @@ -155,16 +155,13 @@ export const OutdatedZimsMessage = ({onClick}) => { } export const KiwixRestartMessage = () => { - return - - - Kiwix must be restarted -

New Zim files have been downloaded; you must restart your containers.

+ return + Kiwix must be restarted +

New Zim files have been downloaded; you must restart your containers.

-

Run the following to restart your containers:

-
  docker-compose restart
-
-
+

Run the following to restart your containers:

+
  docker-compose restart
+ } const ZimSearchEntry = ({zimId, onTag, onUntag, entry}) => { diff --git a/main.py b/main.py index 6778adf2..0067d15a 100755 --- a/main.py +++ b/main.py @@ -327,8 +327,6 @@ async def perpetual_have_internet_worker(): await asyncio.sleep(10) except Exception as e: logger.error('Failed to check if internet is up', exc_info=e) - - await asyncio.sleep(10) except asyncio.CancelledError: logger.info('perpetual_check_have_internet_worker was cancelled...') diff --git a/wrolpi/common.py b/wrolpi/common.py index d5b1948b..ed55c6f1 100644 --- a/wrolpi/common.py +++ b/wrolpi/common.py @@ -1914,8 +1914,8 @@ def can_connect_to_server(hostname: str, port: int = 80) -> bool: conn = socket.create_connection((hostname, port)) conn.close() return True - except Exception: - pass # We ignore any errors, returning False + except Exception as e: + logger_.debug('can_connect_to_server encountered error', exc_info=e) return False diff --git a/wrolpi/vars.py b/wrolpi/vars.py index 291fcd1c..ea126dd5 100644 --- a/wrolpi/vars.py +++ b/wrolpi/vars.py @@ -50,7 +50,7 @@ DOCKERIZED = truthy_arg(os.environ.get('DOCKER', '')) PYTEST = 'pytest' in sys.modules # Used to test if the Internet is up. -INTERNET_SERVER = "one.one.one.one" +INTERNET_SERVER = os.environ.get('INTERNET_SERVER', 'one.one.one.one') # running on circlci CIRCLECI = truthy_arg(os.environ.get('CIRCLECI', ''))