Fixed updater
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 999 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 903 B After Width: | Height: | Size: 915 B |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 4.7 KiB |
|
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>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
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>
|
||||
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 541 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 962 B |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -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();
|
||||
|
||||
|
||||
@@ -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,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"
|
||||
|
||||