feat: print warning if gui and daemon versions mismatch

This commit is contained in:
Ilya Zlobintsev
2023-10-22 13:02:50 +03:00
parent d8fd7fe5ec
commit a511119b86
3 changed files with 10 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ mod apply_revealer;
mod header;
mod root_stack;
use crate::APP_ID;
use crate::{APP_ID, GUI_VERSION};
use anyhow::{anyhow, Context};
use apply_revealer::ApplyRevealer;
use glib::clone;
@@ -51,6 +51,12 @@ impl App {
.get_system_info()
.expect("Could not fetch system info");
let system_info = system_info_buf.inner().expect("Invalid system info buffer");
if system_info.version != GUI_VERSION {
let err = anyhow!("Version mismatch between GUI and daemon ({GUI_VERSION} vs {})! Make sure you have restarted the service if you have updated LACT.", system_info.version);
show_error(&window, err);
}
let root_stack = RootStack::new(system_info, daemon_client.embedded);
header.set_switcher_stack(&root_stack.container);

View File

@@ -1,3 +1,4 @@
use crate::GUI_VERSION;
use gtk::prelude::*;
use gtk::*;
use lact_client::schema::SystemInfo;
@@ -52,13 +53,12 @@ pub fn software_page(system_info: SystemInfo, embedded: bool) -> Grid {
1,
);
let gui_version = env!("CARGO_PKG_VERSION");
let gui_profile = if cfg!(debug_assertions) {
"debug"
} else {
"release"
};
let gui_version = format!("{gui_version}-{gui_profile}");
let gui_version = format!("{GUI_VERSION}-{gui_profile}");
let gui_version_label = Label::builder()
.use_markup(true)

View File

@@ -7,6 +7,7 @@ use std::os::unix::net::UnixStream;
use tracing::{error, info, metadata::LevelFilter};
use tracing_subscriber::EnvFilter;
const GUI_VERSION: &str = env!("CARGO_PKG_VERSION");
const APP_ID: &str = "io.github.lact-linux";
pub fn run(args: GuiArgs) -> anyhow::Result<()> {