From e672613d50518def7c7a699a4af3f02d69713796 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Fri, 13 Jun 2025 19:22:57 +0000 Subject: [PATCH] feat(client): refreshing the page no longer returns a 404 --- src/main.rs | 4 ++-- src/watcher.rs | 4 +++- tests/integration_tests.rs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 71e68dd..620f669 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ use axum::{ }; use sqlx::Row; use std::sync::Arc; -use tower_http::{cors::CorsLayer, services::ServeDir}; +use tower_http::{cors::CorsLayer, services::{ServeDir, ServeFile}}; use tracing::{info, error}; mod auth; @@ -146,7 +146,7 @@ async fn main() -> Result<(), Box> { .nest("/api/users", routes::users::router()) .nest("/api/webdav", routes::webdav::router()) .merge(swagger::create_swagger_router()) - .nest_service("/", ServeDir::new("/app/frontend")) + .nest_service("/", ServeDir::new("/app/frontend").fallback(ServeFile::new("/app/frontend/index.html"))) .fallback(serve_spa) .layer(CorsLayer::permissive()) .with_state(Arc::new(state)); diff --git a/src/watcher.rs b/src/watcher.rs index 3ec392f..e656399 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -297,7 +297,9 @@ async fn process_file( let saved_file_path = file_service.save_file(&filename, &file_data).await?; - let system_user_id = uuid::Uuid::parse_str("00000000-0000-0000-0000-000000000000")?; + // TODO: Make this configurable or fetch from database + // Using admin user ID for watch folder documents + let system_user_id = uuid::Uuid::parse_str("c2e66705-e54b-4eff-91f5-760cb0a69b62")?; let document = file_service.create_document( &filename, diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 0d4a15e..efb48ea 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -12,7 +12,7 @@ use tokio::time::sleep; use readur::models::{DocumentResponse, CreateUser, LoginRequest, LoginResponse}; -const BASE_URL: &str = "http://localhost:8080"; +const BASE_URL: &str = "http://localhost:8000"; const TIMEOUT: Duration = Duration::from_secs(30); /// Integration test client that handles authentication and common operations