From 877555809fb6160c59710444cebb2ccdab9088bc Mon Sep 17 00:00:00 2001 From: CodeMaster4711 Date: Tue, 6 Jan 2026 20:14:43 +0100 Subject: [PATCH 1/4] fix: updater error --- backend/Cargo.lock | 2 +- backend/src/routes/updates.rs | 32 ++++++++++++++++++++++++++++---- frontend/package-lock.json | 4 ++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 7260c093..14fa5da6 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -434,7 +434,7 @@ dependencies = [ [[package]] name = "backend" -version = "0.2.0" +version = "0.2.2" dependencies = [ "anyhow", "async-trait", diff --git a/backend/src/routes/updates.rs b/backend/src/routes/updates.rs index 3a150d36..6488d299 100644 --- a/backend/src/routes/updates.rs +++ b/backend/src/routes/updates.rs @@ -122,10 +122,21 @@ pub async fn install_update( State(_state): State, Json(payload): Json, ) -> Result, AppError> { + tracing::info!( + "Update installation requested for version: {}", + payload.version + ); + let current_version = env!("CARGO_PKG_VERSION").to_string(); + tracing::info!("Current version: {}", current_version); // Safety check: don't downgrade if !version_compare(¤t_version, &payload.version) { + tracing::warn!( + "Update rejected: Cannot install version {} (current: {})", + payload.version, + current_version + ); return Ok(Json(UpdateResponse { success: false, message: "Cannot install an older or same version".to_string(), @@ -141,11 +152,18 @@ pub async fn install_update( possible_paths.push(dir.join("scripts/update.sh")); } + tracing::debug!("Searching for update script in: {:?}", possible_paths); + let script_path = possible_paths .iter() .find(|&p: &&std::path::PathBuf| p.exists()) .ok_or_else(|| { - AppError::InternalError("Update script not found in any expected location".to_string()) + let error_msg = format!( + "Update script not found in any expected location. Searched paths: {:?}", + possible_paths + ); + tracing::error!("{}", error_msg); + AppError::InternalError(error_msg) })? .clone(); @@ -268,9 +286,15 @@ pub enum AppError { impl IntoResponse for AppError { fn into_response(self) -> Response { - let (status, message) = match self { - AppError::InternalError(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg), - AppError::NotFound(msg) => (StatusCode::NOT_FOUND, msg), + let (status, message) = match &self { + AppError::InternalError(msg) => { + tracing::error!("Internal error: {}", msg); + (StatusCode::INTERNAL_SERVER_ERROR, msg.clone()) + } + AppError::NotFound(msg) => { + tracing::warn!("Not found: {}", msg); + (StatusCode::NOT_FOUND, msg.clone()) + } }; (status, Json(serde_json::json!({ "error": message }))).into_response() diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 34653b6c..c2f272b6 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "frontend", - "version": "0.0.8", + "version": "0.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "frontend", - "version": "0.0.8", + "version": "0.2.2", "dependencies": { "@icons-pack/svelte-simple-icons": "^6.5.0", "@tailwindcss/typography": "0.5.19", From 2d3bd924a0e4517dd05ff05c0c4d2fb2412f6932 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 6 Jan 2026 19:15:55 +0000 Subject: [PATCH 2/4] chore(release): 0.2.3 [skip ci] ## [0.2.3](https://github.com/CS-Foundry/CSF-Core/compare/v0.2.2...v0.2.3) (2026-01-06) ### Bug Fixes * updater error ([8775558](https://github.com/CS-Foundry/CSF-Core/commit/877555809fb6160c59710444cebb2ccdab9088bc)) --- CHANGELOG.md | 7 +++++++ backend/Cargo.toml | 2 +- frontend/package.json | 2 +- package.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfa632f8..0af7f5c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to CSF-Core will be documented in this file. +## [0.2.3](https://github.com/CS-Foundry/CSF-Core/compare/v0.2.2...v0.2.3) (2026-01-06) + + +### Bug Fixes + +* updater error ([8775558](https://github.com/CS-Foundry/CSF-Core/commit/877555809fb6160c59710444cebb2ccdab9088bc)) + ## [0.2.2](https://github.com/CS-Foundry/CSF-Core/compare/v0.2.1...v0.2.2) (2026-01-05) diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 1de9bc74..4d4770a3 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "backend" -version = "0.2.2" +version = "0.2.3" edition = "2021" [dependencies] diff --git a/frontend/package.json b/frontend/package.json index 01d94354..11e0c498 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "frontend", "private": true, - "version": "0.2.2", + "version": "0.2.3", "type": "module", "scripts": { "dev": "vite dev", diff --git a/package.json b/package.json index a79951d4..293db1f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "csf-core", - "version": "0.2.2", + "version": "0.2.3", "private": true, "description": "A secure financial management application with end-to-end encryption", "repository": { From 385c30ebafafae24f5b6f572ac16a211938cb2b2 Mon Sep 17 00:00:00 2001 From: CodeMaster4711 Date: Tue, 6 Jan 2026 20:29:02 +0100 Subject: [PATCH 3/4] fix: update script added to installation --- backend/src/routes/updates.rs | 28 ++++++++++++++++++---------- scripts/install.sh | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/backend/src/routes/updates.rs b/backend/src/routes/updates.rs index 6488d299..b287db7d 100644 --- a/backend/src/routes/updates.rs +++ b/backend/src/routes/updates.rs @@ -144,28 +144,36 @@ pub async fn install_update( } // Find the update script - try multiple locations - let mut possible_paths: Vec = - vec![std::path::PathBuf::from("/opt/csf-core/scripts/update.sh")]; + let mut possible_paths: Vec = vec![ + // Production path (daemon service) + std::path::PathBuf::from("/opt/csf-core/scripts/update.sh"), + ]; + // Development paths if let Ok(dir) = std::env::current_dir() { + // When running from /opt/csf-core/backend possible_paths.push(dir.join("../scripts/update.sh")); + // When running from project root possible_paths.push(dir.join("scripts/update.sh")); + // When running from backend directory + possible_paths.push(dir.join("../../scripts/update.sh")); } tracing::debug!("Searching for update script in: {:?}", possible_paths); - let script_path = possible_paths - .iter() - .find(|&p: &&std::path::PathBuf| p.exists()) - .ok_or_else(|| { + let script_path = match possible_paths.iter().find(|&p| p.exists()) { + Some(path) => path.clone(), + None => { let error_msg = format!( - "Update script not found in any expected location. Searched paths: {:?}", + "Update script not found in any expected location. Searched paths: {:?}. Note: Updates can only be performed in production installations, not during local development.", possible_paths ); tracing::error!("{}", error_msg); - AppError::InternalError(error_msg) - })? - .clone(); + return Err(AppError::InternalError( + "Update functionality is only available in production installations. The update script was not found on this system.".to_string() + )); + } + }; tracing::info!("Found update script at: {:?}", script_path); diff --git a/scripts/install.sh b/scripts/install.sh index bad4de17..466fc59a 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -424,6 +424,18 @@ download_release() { return fi + # Download update script + local update_script_url="https://raw.githubusercontent.com/${GITHUB_REPO}/main/scripts/update.sh" + print_step "Download Update Script..." + + mkdir -p "$INSTALL_DIR/scripts" + if curl -L -f "$update_script_url" -o "$INSTALL_DIR/scripts/update.sh" 2>/dev/null; then + chmod +x "$INSTALL_DIR/scripts/update.sh" + print_success "Update Script heruntergeladen" + else + print_warning "Update Script konnte nicht heruntergeladen werden" + fi + cd - > /dev/null rm -rf "$temp_dir" @@ -635,6 +647,18 @@ EOF return fi + # Copy update script + cd "$temp_dir/csf-core" + print_step "Kopiere Update Script..." + mkdir -p "$INSTALL_DIR/scripts" + if [ -f "scripts/update.sh" ]; then + cp scripts/update.sh "$INSTALL_DIR/scripts/" + chmod +x "$INSTALL_DIR/scripts/update.sh" + print_success "Update Script kopiert" + else + print_warning "Update Script nicht gefunden" + fi + cd - > /dev/null rm -rf "$temp_dir" From 735c111448311b686d3a49ce163a0da86725f34f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 6 Jan 2026 19:30:16 +0000 Subject: [PATCH 4/4] chore(release): 0.2.4 [skip ci] ## [0.2.4](https://github.com/CS-Foundry/CSF-Core/compare/v0.2.3...v0.2.4) (2026-01-06) ### Bug Fixes * update script added to installation ([385c30e](https://github.com/CS-Foundry/CSF-Core/commit/385c30ebafafae24f5b6f572ac16a211938cb2b2)) --- CHANGELOG.md | 7 +++++++ backend/Cargo.toml | 2 +- frontend/package.json | 2 +- package.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0af7f5c5..340690bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to CSF-Core will be documented in this file. +## [0.2.4](https://github.com/CS-Foundry/CSF-Core/compare/v0.2.3...v0.2.4) (2026-01-06) + + +### Bug Fixes + +* update script added to installation ([385c30e](https://github.com/CS-Foundry/CSF-Core/commit/385c30ebafafae24f5b6f572ac16a211938cb2b2)) + ## [0.2.3](https://github.com/CS-Foundry/CSF-Core/compare/v0.2.2...v0.2.3) (2026-01-06) diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 4d4770a3..254feda6 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "backend" -version = "0.2.3" +version = "0.2.4" edition = "2021" [dependencies] diff --git a/frontend/package.json b/frontend/package.json index 11e0c498..e66c5c8c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "frontend", "private": true, - "version": "0.2.3", + "version": "0.2.4", "type": "module", "scripts": { "dev": "vite dev", diff --git a/package.json b/package.json index 293db1f5..ef7977d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "csf-core", - "version": "0.2.3", + "version": "0.2.4", "private": true, "description": "A secure financial management application with end-to-end encryption", "repository": {