diff --git a/daemon/src/main.rs b/daemon/src/main.rs index 0dcfb88..9e03633 100644 --- a/daemon/src/main.rs +++ b/daemon/src/main.rs @@ -25,7 +25,7 @@ use crate::server::{ ServerState, debug_set_display_state, get_config, get_qmdl, get_time, get_zip, serve_static, set_config, set_time_offset, test_notification, }; -use crate::stats::{get_qmdl_manifest, get_route_status, get_system_stats}; +use crate::stats::{get_qmdl_manifest, get_system_stats}; use analysis::{ AnalysisCtrlMessage, AnalysisStatus, get_analysis_status, run_analysis_thread, start_analysis, @@ -58,7 +58,6 @@ fn get_router() -> AppRouter { .route("/api/qmdl/{name}", get(get_qmdl)) .route("/api/zip/{name}", get(get_zip)) .route("/api/system-stats", get(get_system_stats)) - .route("/api/route-status", get(get_route_status)) .route("/api/qmdl-manifest", get(get_qmdl_manifest)) .route("/api/log", get(get_log)) .route("/api/start-recording", post(start_recording)) diff --git a/daemon/src/stats.rs b/daemon/src/stats.rs index be390a0..5f5842c 100644 --- a/daemon/src/stats.rs +++ b/daemon/src/stats.rs @@ -174,33 +174,3 @@ pub async fn get_log() -> Result { .await .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string())) } - -#[derive(Debug, Serialize)] -pub struct RouteStatus { - pub has_default_route: bool, -} - -pub async fn get_route_status() -> Json { - let has_default_route = match check_default_route().await { - Ok(result) => result, - Err(err) => { - log::warn!("Failed to check default route: {err}"); - // More likely than not, this is a portability issue. The logic hasn't been fully - // tested on all devices. We shouldn't scare users unnecessarily. - true - } - }; - - Json(RouteStatus { has_default_route }) -} - -// Checks for an IPv4 default route by reading /proc/net/route -// instead of shelling out to `ip route`, which may not be available on all devices. -async fn check_default_route() -> std::io::Result { - let contents = tokio::fs::read_to_string("/proc/net/route").await?; - Ok(contents.lines().skip(1).any(|line| { - line.split_whitespace() - .nth(1) - .is_some_and(|dest| dest == "00000000") - })) -} diff --git a/daemon/web/src/lib/components/ActionErrors.svelte b/daemon/web/src/lib/components/ActionErrors.svelte index 47a5d6f..1c0994d 100644 --- a/daemon/web/src/lib/components/ActionErrors.svelte +++ b/daemon/web/src/lib/components/ActionErrors.svelte @@ -1,6 +1,5 @@ - -{#if show_alert} -
- - - No Default Route Detected - -

- This device didn't get an IP address from the network operator. Presumably the SIM card - is not inserted or very old. Try a different SIM card. -

-
- -
-
-{/if} diff --git a/daemon/web/src/lib/components/WarningIcon.svelte b/daemon/web/src/lib/components/WarningIcon.svelte deleted file mode 100644 index 29d60f0..0000000 --- a/daemon/web/src/lib/components/WarningIcon.svelte +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/daemon/web/src/lib/utils.svelte.ts b/daemon/web/src/lib/utils.svelte.ts index 84e6793..915c7c0 100644 --- a/daemon/web/src/lib/utils.svelte.ts +++ b/daemon/web/src/lib/utils.svelte.ts @@ -101,14 +101,6 @@ export async function test_notification(): Promise { } } -export interface RouteStatus { - has_default_route: boolean; -} - -export async function get_route_status(): Promise { - return JSON.parse(await req('GET', '/api/route-status')); -} - export interface TimeResponse { system_time: string; adjusted_time: string; diff --git a/daemon/web/src/routes/+page.svelte b/daemon/web/src/routes/+page.svelte index 960dce0..5abb235 100644 --- a/daemon/web/src/routes/+page.svelte +++ b/daemon/web/src/routes/+page.svelte @@ -10,10 +10,8 @@ import RecordingControls from '$lib/components/RecordingControls.svelte'; import ConfigForm from '$lib/components/ConfigForm.svelte'; import ActionErrors from '$lib/components/ActionErrors.svelte'; - import IPRouteAlert from '$lib/components/IPRouteAlert.svelte'; import ClockDriftAlert from '$lib/components/ClockDriftAlert.svelte'; import LogView from '$lib/components/LogView.svelte'; - import WarningIcon from '$lib/components/WarningIcon.svelte'; let manager: AnalysisManager = new AnalysisManager(); let loaded = $state(false); @@ -180,7 +178,21 @@ class="bg-red-100 border-red-100 drop-shadow p-4 flex flex-col gap-2 border rounded-md flex-1 justify-between" > - + Connection Error {/if} - {#if loaded}
@@ -214,7 +225,21 @@ - + WARNING: Not Running diff --git a/daemon/web/vite.config.ts b/daemon/web/vite.config.ts index c10a3cf..9720c43 100644 --- a/daemon/web/vite.config.ts +++ b/daemon/web/vite.config.ts @@ -5,7 +5,7 @@ export default defineConfig({ server: { proxy: { '/api': { - target: process.env.API_TARGET || 'http://localhost:8080', + target: 'http://localhost:8080', changeOrigin: true, secure: false, configure: (proxy, _options) => {