Fixed updater

This commit is contained in:
2026-09-23 09:37:44 -04:00
parent 0cd2a516bb
commit 0bd1b895b1
63 changed files with 875 additions and 126 deletions
+10
View File
@@ -54,6 +54,7 @@ dependencies = [
"csv",
"dns-lookup",
"ipnetwork",
"is_elevated",
"libc",
"open",
"ping-async",
@@ -1939,6 +1940,15 @@ dependencies = [
"once_cell",
]
[[package]]
name = "is_elevated"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5299060ff5db63e788015dcb9525ad9b84f4fd9717ed2cbdeba5018cbf42f9b5"
dependencies = [
"winapi",
]
[[package]]
name = "itoa"
version = "1.0.18"
+14
View File
@@ -34,3 +34,17 @@ open = "5.4.4"
reqwest = { version = "0.12", features = ["json"] }
libc = "0.2.189"
[target.'cfg(windows)'.dependencies]
is_elevated = "0.1"
[profile.release]
opt-level = "z"
lto = "fat"
debug = false
codegen-units = 1
panic = 'abort'
strip = true
debug-assertions = false
overflow-checks = false
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<background android:drawable="@color/ic_launcher_background"/>
</adaptive-icon>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#fff</color>
</resources>
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+3 -56
View File
@@ -1,52 +1,7 @@
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use tauri::{AppHandle, Manager};
use tauri::AppHandle;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AppConfig {
pub update_url: String,
}
impl Default for AppConfig {
fn default() -> Self {
Self {
update_url: String::new(),
}
}
}
fn config_path(app: &AppHandle) -> Result<PathBuf, String> {
let dir = app
.path()
.app_config_dir()
.map_err(|e| format!("Failed to get config dir: {}", e))?;
std::fs::create_dir_all(&dir)
.map_err(|e| format!("Failed to create config dir: {}", e))?;
Ok(dir.join("config.json"))
}
#[tauri::command]
pub async fn get_config(app: AppHandle) -> Result<AppConfig, String> {
let path = config_path(&app)?;
if !path.exists() {
return Ok(AppConfig::default());
}
let data = std::fs::read_to_string(&path)
.map_err(|e| format!("Failed to read config: {}", e))?;
serde_json::from_str(&data)
.map_err(|e| format!("Failed to parse config: {}", e))
}
#[tauri::command]
pub async fn save_config(app: AppHandle, config: AppConfig) -> Result<(), String> {
let path = config_path(&app)?;
let data = serde_json::to_string_pretty(&config)
.map_err(|e| format!("Failed to serialize config: {}", e))?;
std::fs::write(&path, data)
.map_err(|e| format!("Failed to write config: {}", e))?;
Ok(())
}
const UPDATE_URL: &str = "https://git.racooncity.org/api/v1/repos/mysticmomba/argus/releases/latest";
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UpdateInfo {
@@ -57,13 +12,7 @@ pub struct UpdateInfo {
#[tauri::command]
pub async fn check_for_update(app: AppHandle) -> Result<Option<UpdateInfo>, String> {
let config = get_config(app.clone()).await?;
if config.update_url.is_empty() {
return Ok(None);
}
let response = reqwest::get(&config.update_url)
let response = reqwest::get(UPDATE_URL)
.await
.map_err(|e| format!("Failed to check for updates: {}", e))?;
@@ -76,7 +25,6 @@ pub async fn check_for_update(app: AppHandle) -> Result<Option<UpdateInfo>, Stri
.await
.map_err(|e| format!("Invalid update response: {}", e))?;
// Parse Gitea/GitHub release format
let tag = body["tag_name"]
.as_str()
.ok_or_else(|| "No tag_name in response".to_string())?;
@@ -91,7 +39,6 @@ pub async fn check_for_update(app: AppHandle) -> Result<Option<UpdateInfo>, Stri
.map(|s| s.to_string())
.filter(|s| !s.is_empty());
// Strip leading 'v' from tag if present (v0.2.0 -> 0.2.0)
let remote_version = tag.strip_prefix('v').unwrap_or(tag);
let current = app.package_info().version.to_string();
-2
View File
@@ -29,8 +29,6 @@ pub fn run() {
commands::monitor::monitor_get_entries,
commands::monitor::monitor_start,
commands::monitor::monitor_stop,
commands::updater::get_config,
commands::updater::save_config,
commands::updater::check_for_update,
commands::actions::check_privileges,
])
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "argus",
"version": "0.2.0",
"version": "0.1.0",
"identifier": "io.argus.app",
"build": {
"frontendDist": "../src"