Commiting decryption/key extraction fixes before major refactor/new version.
This commit is contained in:
@@ -137,9 +137,12 @@ async fn main() -> cgcx_core::Result<()> {
|
||||
let config = Arc::new(Config::load()?);
|
||||
config.validate()?;
|
||||
|
||||
tokio::fs::create_dir_all("data").await.ok();
|
||||
|
||||
let db = Arc::new(Database::open("data/db.sqlite")?);
|
||||
let db_path = std::path::PathBuf::from(&config.database_path);
|
||||
if let Some(parent) = db_path.parent() {
|
||||
tokio::fs::create_dir_all(parent).await.ok();
|
||||
}
|
||||
let db = Arc::new(Database::open(&db_path)?);
|
||||
info!("Server database opened at: {:?}", std::fs::canonicalize(&db_path).unwrap_or_else(|_| db_path.clone()));
|
||||
db.run_migrations().await?;
|
||||
|
||||
let storage = Arc::new(Storage::new(config.storage.paths.clone()));
|
||||
@@ -186,7 +189,7 @@ async fn main() -> cgcx_core::Result<()> {
|
||||
.expect("invalid password rate limit config");
|
||||
|
||||
let password_route = Router::new()
|
||||
.route("/api/content/{cxid}/verify-password", post(verify_password))
|
||||
.route("/api/content/:cxid/verify-password", post(verify_password))
|
||||
.layer(tower_governor::GovernorLayer {
|
||||
config: Arc::new(password_governor_conf),
|
||||
});
|
||||
@@ -231,8 +234,8 @@ async fn main() -> cgcx_core::Result<()> {
|
||||
|
||||
let app = Router::new()
|
||||
.route("/api/health", get(health))
|
||||
.route("/api/content/{cxid}", get(get_metadata))
|
||||
.route("/api/content/{cxid}/file/{file_idx}", get(serve_file))
|
||||
.route("/api/content/:cxid", get(get_metadata))
|
||||
.route("/api/content/:cxid/file/:file_idx", get(serve_file))
|
||||
.merge(password_route)
|
||||
.nest_service("/assets", static_service)
|
||||
.fallback(fallback)
|
||||
@@ -283,7 +286,7 @@ async fn fallback(uri: axum::http::Uri) -> Response {
|
||||
let path = uri.path();
|
||||
tracing::info!("fallback: path={}", path);
|
||||
if path.starts_with("/api/") {
|
||||
return (StatusCode::NOT_FOUND, Json(serde_json::json!({"error": "Not found"}))).into_response();
|
||||
return (StatusCode::NOT_FOUND, Json(serde_json::json!({"error": "Not found", "source": "fallback"}))).into_response();
|
||||
}
|
||||
match tokio::fs::read_to_string("frontend/dist/index.html").await {
|
||||
Ok(html) => (StatusCode::OK, [(header::CONTENT_TYPE, "text/html")], html).into_response(),
|
||||
|
||||
Reference in New Issue
Block a user