diff --git a/ostp-server/src/api.rs b/ostp-server/src/api.rs index 5d38ffd..4e060b0 100644 --- a/ostp-server/src/api.rs +++ b/ostp-server/src/api.rs @@ -172,42 +172,8 @@ fn api_unauthorized() -> (StatusCode, Json>) { (StatusCode::UNAUTHORIZED, Json(ApiResponse { ok: false, data: None, error: Some("unauthorized".to_string()) })) } -#[derive(RustEmbed)] -#[folder = "../ostp-control/dist/"] -struct Assets; - -async fn static_handler(State(state): State, uri: Uri) -> impl IntoResponse { - let mut path = uri.path(); - - let webpath = state.webpath.trim_matches('/'); - let prefix = if webpath.is_empty() { - "/panel".to_string() - } else { - format!("/{}", webpath) - }; - - if path.starts_with(&prefix) { - path = &path[prefix.len()..]; - } - path = path.trim_start_matches('/'); - - if path.is_empty() || path == "index.html" { - path = "index.html"; - } - - match Assets::get(path) { - Some(content) => { - let mime = mime_guess::from_path(path).first_or_octet_stream(); - ([(header::CONTENT_TYPE, mime.as_ref())], content.data).into_response() - } - None => { - if let Some(index) = Assets::get("index.html") { - ([(header::CONTENT_TYPE, "text/html")], index.data).into_response() - } else { - (StatusCode::NOT_FOUND, "404 Not Found").into_response() - } - } - } +async fn static_handler(State(_state): State, _uri: Uri) -> impl IntoResponse { + (StatusCode::NOT_FOUND, "Control panel not bundled").into_response() } // ── API router ─────────────────────────────────────────────────────────────── diff --git a/scripts/build.ps1 b/scripts/build.ps1 index dcd5d49..d30be44 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -58,15 +58,6 @@ if (Test-Path $CargoToml) { Write-Output " [ok] Updated tauri.conf.json" } - # Bump React Control Panel - $PackageJson = Join-Path $ProjectRoot "ostp-control\package.json" - if (Test-Path $PackageJson) { - $PkgContent = [System.IO.File]::ReadAllText($PackageJson) - $PkgRegex = [regex] '"version":\s*"[^"]+"' - $PkgContent = $PkgRegex.Replace($PkgContent, ('"version": "' + $Version + '"'), 1) - [System.IO.File]::WriteAllText($PackageJson, $PkgContent) - Write-Output " [ok] Updated package.json" - } # Bump Flutter App $Pubspec = Join-Path $ProjectRoot "ostp-flutter\pubspec.yaml" @@ -83,13 +74,6 @@ if (Test-Path $CargoToml) { } } -# --- Pre-flight: frontend build --- -Write-Output "" -Write-Output "Building frontend control panel..." -Push-Location (Join-Path $ProjectRoot "ostp-control") -& npm install | Out-Null -& npm run build | Out-Null -Pop-Location # --- Pre-flight: cargo check --- Write-Output ""