qbit_manage/desktop/tauri/src-tauri/build.rs
bobokun 1e12a1610f
4.5.4 (#910)
# Improvements
- Support cross-platform binary builds (Linux/Windows/MacOS)
- Adds desktop app installers (Linux/Windows/MacOS)
- Container images for latest now pointed to newest version
automatically (Fixes #897)
- Enable automatic open of webUI in local installs
- Add persistence toggling for webUI scheduler

# Bug Fixes
- Fix schedule.yml not loaded upon restarting Docker container (Fixes
#906)
- Fix bug where torrents were not being paused after share limits
reached (Fixes #901)
- Fix(api): prevent path traversal vulnerability in backup restore
endpoint (Fixes CWE-22 Security Vulnerability)
- Fix scheduler to run interval jobs immediately on startup

**Full Changelog**:
https://github.com/StuffAnThings/qbit_manage/compare/v4.5.3...v4.5.4

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-08-16 22:28:26 -04:00

63 lines
2.6 KiB
Rust

// Build script required for tauri::generate_context! macro (generates code into OUT_DIR)
use std::fs;
use std::path::Path;
fn main() {
// Check which binaries exist for debugging
let bin_dir = std::path::Path::new("bin");
if bin_dir.exists() {
println!("cargo:rerun-if-changed=bin");
}
// Read version from VERSION file and update both Cargo.toml and tauri.conf.json
let version_file_path = Path::new("../../../VERSION");
let cargo_toml_path = Path::new("Cargo.toml");
let config_path = Path::new("tauri.conf.json");
if let Ok(version_content) = fs::read_to_string(version_file_path) {
let version = version_content.trim();
// Update Cargo.toml with the version
if let Ok(cargo_content) = fs::read_to_string(cargo_toml_path) {
if let Ok(mut cargo_toml) = cargo_content.parse::<toml::Value>() {
// Update the version field in [package] section
if let Some(package) = cargo_toml.get_mut("package") {
if let Some(package_table) = package.as_table_mut() {
package_table.insert("version".to_string(), toml::Value::String(version.to_string()));
// Write back the updated Cargo.toml
if let Ok(updated_cargo) = toml::to_string(&cargo_toml) {
let _ = fs::write(cargo_toml_path, updated_cargo);
}
}
}
}
}
// Update tauri.conf.json with the version
if let Ok(config_content) = fs::read_to_string(config_path) {
// Parse as JSON value
if let Ok(mut config_json) = serde_json::from_str::<serde_json::Value>(&config_content) {
// Update the version field
config_json["version"] = serde_json::Value::String(version.to_string());
// Write back the updated configuration
if let Ok(updated_config) = serde_json::to_string_pretty(&config_json) {
let _ = fs::write(config_path, updated_config);
}
}
}
println!("cargo:rustc-env=TAURI_APP_VERSION={}", version);
} else {
// Fallback to default version if VERSION file not found
println!("cargo:rustc-env=TAURI_APP_VERSION=0.1.0");
}
// Tell cargo to rerun this script if VERSION file changes
println!("cargo:rerun-if-changed=../../../VERSION");
// Also rerun if Cargo.toml changes to prevent infinite loops
println!("cargo:rerun-if-changed=Cargo.toml");
tauri_build::build();
}