     1	//! The update window: what the new version is, and the one step this installation
     2	//! needs (see `update.rs`): update and restart, download and open the disk image, or
     3	//! download the package and copy the command that installs it.
     4	
     5	use egui::{RichText, Ui};
     6	
     7	use crate::board_search::Background;
     8	use crate::i18n::{tr, trf};
     9	use crate::update::{self, Applied, Install, Release};
    10	
    11	/// What the window asks of the application.
    12	pub enum UpdateEvent {
    13	    /// Quit (asking about unsaved games as usual) and start this executable.
    14	    Restart(std::path::PathBuf),
    15	    CopyText(String),
    16	}
    17	
    18	#[derive(Default)]
    19	pub struct UpdateDialog {
    20	    pub open: bool,
    21	    /// Dev hook (screenshots, manual checks): `CP_UPDATE_OPEN=1` opens the window once a
    22	    /// newer release is known, `=start` also starts the update.
    23	    auto: Option<bool>,
    24	    job: Option<(u64, Background<Result<Applied, String>>)>,
    25	    result: Option<Result<Applied, String>>,
    26	}
    27	
    28	fn mb(bytes: u64) -> String {
    29	    format!("{:.0}", (bytes as f64 / 1e6).max(0.1))
    30	}
    31	
    32	/// The installation as the user knows it.
    33	fn install_name(kind: &Install) -> String {
    34	    match kind {
    35	        Install::Deb => tr("the deb package").to_owned(),
    36	        Install::Rpm => tr("the rpm package").to_owned(),
    37	        Install::Arch => tr("the Arch Linux package").to_owned(),
    38	        Install::Flatpak => "Flatpak".to_owned(),
    39	        Install::Aur => "AUR (chesspenguin-bin)".to_owned(),
    40	        other => other.label().to_owned(),
    41	    }
    42	}
    43	
    44	impl UpdateDialog {
    45	    pub fn from_env() -> UpdateDialog {
    46	        let auto = std::env::var("CP_UPDATE_OPEN").ok().map(|v| v == "start");
    47	        UpdateDialog {
    48	            auto,
    49	            ..UpdateDialog::default()
    50	        }
    51	    }
    52	
    53	    fn start(&mut self, release: &Release, kind: &Install, ctx: &egui::Context) {
    54	        let size = release.asset_for(kind).map_or(0, |a| a.size);
    55	        let (r, k) = (release.clone(), kind.clone());
    56	        let now = ctx.input(|i| i.time);
    57	        self.result = None;
    58	        self.job = Background::spawn(ctx, now, move |progress, cancel| {
    59	            Some(update::update(&r, &k, progress, cancel))
    60	        })
    61	        .map(|j| (size, j));
    62	    }
    63	
    64	    pub fn show(
    65	        &mut self,
    66	        ctx: &egui::Context,
    67	        release: Option<&Release>,
    68	        kind: &Install,
    69	    ) -> Vec<UpdateEvent> {
    70	        let mut events = Vec::new();
    71	        if let Some((_, job)) = &self.job
    72	            && let Some(r) = job.poll()
    73	        {
    74	            self.result = Some(r.unwrap_or_else(|| Err("cancelled".into())));
    75	            self.job = None;
    76	        }
    77	        if self.job.is_some() {
    78	            ctx.request_repaint_after(std::time::Duration::from_millis(200));
    79	        }
    80	        let Some(release) = release else {
    81	            return events;
    82	        };
    83	        if let Some(start) = self.auto.take() {
    84	            self.open = true;
    85	            if start {
    86	                self.start(release, kind, ctx);
    87	            }
    88	        }
    89	        if !self.open {
    90	            return events;
    91	        }
    92	        let mut open = true;
    93	        egui::Window::new(trf("ChessPenguin {v}", &[("v", &release.version)]))
    94	            .open(&mut open)
    95	            .collapsible(false)
    96	            .default_width(560.0)
    97	            .max_width(620.0)
    98	            .anchor(egui::Align2::CENTER_TOP, egui::vec2(0.0, 110.0))
    99	            .show(ctx, |ui| self.body(ui, release, kind, &mut events));
   100	        if !open {
   101	            if let Some((_, job)) = &self.job {
   102	                job.cancel();
   103	            }
   104	            self.open = false;
   105	        }
   106	        events
   107	    }
   108	
   109	    fn body(
   110	        &mut self,
   111	        ui: &mut Ui,
   112	        release: &Release,
   113	        kind: &Install,
   114	        events: &mut Vec<UpdateEvent>,
   115	    ) {
   116	        ui.label(trf(
   117	            "A new version is out: {new} (you have {old}).",
   118	            &[
   119	                ("new", &release.version),
   120	                ("old", &env!("CARGO_PKG_VERSION")),
   121	            ],
   122	        ));
   123	        ui.hyperlink_to(tr("What's new"), &release.page);
   124	        ui.add_space(8.0);
   125	        let asset = release.asset_for(kind);
   126	        // Running.
   127	        if let Some((size, job)) = &self.job {
   128	            let done = job.progress() as u64;
   129	            ui.horizontal(|ui| {
   130	                ui.add(egui::Spinner::new());
   131	                ui.label(trf(
   132	                    "Downloading… {done} of {total} MB",
   133	                    &[("done", &mb(done)), ("total", &mb(*size))],
   134	                ));
   135	                if ui.button(tr("Cancel")).clicked() {
   136	                    job.cancel();
   137	                }
   138	            });
   139	            if *size > 0 {
   140	                ui.add(egui::ProgressBar::new(
   141	                    (done as f32 / *size as f32).min(1.0),
   142	                ));
   143	            }
   144	            return;
   145	        }
   146	        // Finished.
   147	        match &self.result {
   148	            Some(Ok(Applied::Restart(exe))) => {
   149	                ui.label(RichText::new(tr("The new version is installed.")).strong());
   150	                ui.label(tr(
   151	                    "It starts after a restart; unsaved games are asked about first.",
   152	                ));
   153	                ui.horizontal(|ui| {
   154	                    if ui.button(tr("Restart now")).clicked() {
   155	                        events.push(UpdateEvent::Restart(exe.clone()));
   156	                    }
   157	                    if ui.button(tr("Later")).clicked() {
   158	                        self.open = false;
   159	                    }
   160	                });
   161	                return;
   162	            }
   163	            Some(Ok(Applied::DiskImageOpened(_))) => {
   164	                ui.label(RichText::new(tr("The disk image is open.")).strong());
   165	                ui.label(tr(
   166	                    "Drag ChessPenguin onto Applications in its window and choose Replace. Then quit this window of ChessPenguin and start it again.",
   167	                ));
   168	                return;
   169	            }
   170	            Some(Ok(Applied::Command { file, command })) => {
   171	                ui.label(RichText::new(tr("The package is downloaded and checked.")).strong());
   172	                ui.add(
   173	                    egui::Label::new(trf("It is in {path}.", &[("path", &file.display())])).wrap(),
   174	                );
   175	                ui.add_space(4.0);
   176	                ui.label(tr(
   177	                    "To install it, run this command in a terminal (it may ask for your password):",
   178	                ));
   179	                command_line(ui, command, events);
   180	                if matches!(kind, Install::Flatpak) {
   181	                    ui.label(
   182	                        RichText::new(tr(
   183	                            "Run it in the terminal of your system, not inside the Flatpak.",
   184	                        ))
   185	                        .weak(),
   186	                    );
   187	                }
   188	                ui.label(RichText::new(tr("Then close ChessPenguin and start it again.")).weak());
   189	                return;
   190	            }
   191	            Some(Err(e)) => {
   192	                let text = if e == "checksum" {
   193	                    tr("The downloaded file is damaged (its checksum does not match). Try again.")
   194	                        .to_owned()
   195	                } else if e == "cancelled" {
   196	                    tr("Cancelled.").to_owned()
   197	                } else {
   198	                    trf("The update failed: {e}", &[("e", e)])
   199	                };
   200	                ui.label(RichText::new(text).color(ui.visuals().warn_fg_color));
   201	                ui.add_space(4.0);
   202	            }
   203	            None => {}
   204	        }
   205	        // What to do.
   206	        match (kind, asset) {
   207	            (Install::Aur, _) => {
   208	                ui.label(tr(
   209	                    "ChessPenguin is installed from the AUR. Update it with your AUR helper:",
   210	                ));
   211	                command_line(ui, update::AUR_COMMAND, events);
   212	            }
   213	            (k, Some(a)) if k.replaces_itself() => {
   214	                ui.label(trf(
   215	                    "ChessPenguin ({kind}) updates itself: the new version is downloaded ({mb} MB), checked and put in place of this one.",
   216	                    &[("kind", &install_name(k)), ("mb", &mb(a.size))],
   217	                ));
   218	                if ui.button(RichText::new(tr("⬆ Update")).strong()).clicked() {
   219	                    self.start(release, k, ui.ctx());
   220	                }
   221	            }
   222	            (Install::Mac, Some(a)) => {
   223	                ui.label(trf(
   224	                    "The disk image ({mb} MB) is downloaded, checked and opened; you drag the app over the old one, as when you installed it.",
   225	                    &[("mb", &mb(a.size))],
   226	                ));
   227	                if ui
   228	                    .button(RichText::new(tr("⬇ Download")).strong())
   229	                    .clicked()
   230	                {
   231	                    self.start(release, kind, ui.ctx());
   232	                }
   233	            }
   234	            (k, Some(a)) => {
   235	                ui.label(trf(
   236	                    "ChessPenguin is installed as {kind}: the system installs it. The new package ({mb} MB) is downloaded into Downloads and checked; then you run one command.",
   237	                    &[("kind", &install_name(k)), ("mb", &mb(a.size))],
   238	                ));
   239	                if ui
   240	                    .button(RichText::new(tr("⬇ Download the package")).strong())
   241	                    .clicked()
   242	                {
   243	                    self.start(release, k, ui.ctx());
   244	                }
   245	            }
   246	            _ => {
   247	                ui.label(tr("Download the new version from the website:"));
   248	                ui.hyperlink_to(update::DOWNLOAD_PAGE, update::DOWNLOAD_PAGE);
   249	            }
   250	        }
   251	    }
   252	}
   253	
   254	/// A command in a monospace box with a Copy button.
   255	fn command_line(ui: &mut Ui, command: &str, events: &mut Vec<UpdateEvent>) {
   256	    // A long path wraps inside the box; the button stays below it.
   257	    egui::Frame::new()
   258	        .fill(ui.visuals().extreme_bg_color)
   259	        .inner_margin(egui::Margin::symmetric(8, 6))
   260	        .corner_radius(4.0)
   261	        .show(ui, |ui| {
   262	            ui.add(egui::Label::new(RichText::new(command).monospace()).wrap());
   263	        });
   264	    if ui.button(tr("Copy")).clicked() {
   265	        events.push(UpdateEvent::CopyText(command.to_owned()));
   266	    }
   267	}
diff --git a/apps/desktop/src/app.rs b/apps/desktop/src/app.rs
index f2618d0..68a5479 100644
--- a/apps/desktop/src/app.rs
+++ b/apps/desktop/src/app.rs
@@ -59,6 +59,12 @@ pub struct App {
     previous_games: Vec<GameView>,
     /// The last game showed the reference tab: the next one opens with it too.
     reference_tab: bool,
+    /// Updates: the release check, how this copy is installed, the window, and the
+    /// executable to start after quitting (a restart into the new version).
+    update_check: crate::update::Check,
+    update_kind: crate::update::Install,
+    update_ui: crate::update_ui::UpdateDialog,
+    restart_to: Option<PathBuf>,
     /// The reference tab of games (kept across games: its results stay cached).
     reference: crate::reference::Reference,
     allow_quit: bool,
@@ -107,6 +113,8 @@ impl App {
         // Before the samples, which are named in this language.
         crate::i18n::set_lang(settings.language);
         crate::engine_download::clean_leftovers();
+        crate::update::clean_leftovers();
+        let settings_check_updates = settings.check_updates;
         let engines_found = crate::engines::first_run_setup(&mut settings);
         if crate::examples::first_run_setup(&mut settings) || engines_found {
             let _ = settings.save();
@@ -146,6 +154,14 @@ impl App {
             find_after_close: None,
             previous_games: Vec::new(),
             reference_tab: false,
+            update_check: if settings_check_updates {
+                crate::update::Check::start(ctx)
+            } else {
+                crate::update::Check::idle()
+            },
+            update_kind: crate::update::detect(),
+            update_ui: crate::update_ui::UpdateDialog::from_env(),
+            restart_to: None,
             reference: Default::default(),
             engine_offer: crate::engine_offer::EngineOffer::new(),
             offer_hook_done: false,
@@ -480,6 +496,10 @@ impl App {
         }
 
         if intent == CloseIntent::QuitApp {
+            // A restart into the new version: start it as this one goes.
+            if let Some(exe) = self.restart_to.take() {
+                let _ = std::process::Command::new(exe).spawn();
+            }
             self.allow_quit = true;
             ctx.send_viewport_cmd(egui::ViewportCommand::Close);
         }
@@ -777,6 +797,7 @@ impl eframe::App for App {
                             }
                         }
                     }
+                    GameAction::OpenUpdate => self.update_ui.open = true,
                     GameAction::ReturnToPrevious => {
                         if !self.previous_games.is_empty() {
                             self.request_close(&ctx, CloseIntent::ReturnToPrevious);
@@ -847,6 +868,7 @@ impl eframe::App for App {
                     }
                     LibraryAction::PastePgn => self.paste_pgn(&ctx),
                     LibraryAction::AddDatabases => self.pick_databases(&ctx),
+                    LibraryAction::OpenUpdate => self.update_ui.open = true,
                     LibraryAction::RemoveDatabase(p) => {
                         self.settings.databases.retain(|d| *d != p);
                         self.library.forget(&p);
@@ -857,12 +879,49 @@ impl eframe::App for App {
             }
         }
 
+        // Updates: the badge next to Settings, the window, the status in Settings → About.
+        self.update_check.poll();
+        let newer = self.update_check.newer().map(|r| r.version.clone());
+        self.library.update = newer.clone();
+        if let Some(g) = &mut self.game {
+            g.update = newer;
+        }
+        for e in self
+            .update_ui
+            .show(&ctx, self.update_check.newer(), &self.update_kind)
+        {
+            match e {
+                crate::update_ui::UpdateEvent::Restart(exe) => {
+                    self.restart_to = Some(exe);
+                    self.request_close(&ctx, CloseIntent::QuitApp);
+                }
+                crate::update_ui::UpdateEvent::CopyText(t) => {
+                    ctx.copy_text(t);
+                    self.toast(&ctx, tr("Copied"));
+                }
+            }
+        }
+        self.settings_ui.update_status = if self.update_check.running() {
+            Some(tr("Checking…").to_owned())
+        } else if let Some(r) = self.update_check.newer() {
+            Some(trf("Version {v} is out", &[("v", &r.version)]))
+        } else if self.update_check.release.is_some() {
+            Some(tr("This is the latest version").to_owned())
+        } else if self.update_check.error.is_some() {
+            Some(tr("Could not check (no connection?)").to_owned())
+        } else {
+            None
+        };
+
         self.settings_ui.download = self.engine_offer.stage();
         let (actions, changed) = self.settings_ui.show(&ctx, &mut self.settings);
         self.settings_dirty |= changed;
         for a in actions {
             match a {
                 SettingsAction::AddEngine => self.pick_engine(&ctx),
+                SettingsAction::CheckUpdates => {
+                    self.update_check = crate::update::Check::start(&ctx);
+                }
                 SettingsAction::DownloadEngine => self.engine_offer.start(&ctx),
                 SettingsAction::CancelDownload => self.engine_offer.cancel(),
                 SettingsAction::RemoveDownloaded => {
diff --git a/apps/desktop/src/board_search.rs b/apps/desktop/src/board_search.rs
index 4c2dfb3..27971d7 100644
--- a/apps/desktop/src/board_search.rs
+++ b/apps/desktop/src/board_search.rs
@@ -890,6 +890,11 @@ impl<T: Send + 'static> Background<T> {
     pub fn progress(&self) -> usize {
         self.progress.load(Ordering::Relaxed)
     }
+
+    /// Asks the work to stop; its result still arrives.
+    pub fn cancel(&self) {
+        self.cancel.store(true, Ordering::Relaxed);
+    }
 }
 
 impl<T> Drop for Background<T> {
diff --git a/apps/desktop/src/game_view.rs b/apps/desktop/src/game_view.rs
index db29558..0d4f574 100644
--- a/apps/desktop/src/game_view.rs
+++ b/apps/desktop/src/game_view.rs
@@ -59,6 +59,8 @@ pub struct GameView {
     side_tab: SideTab,
     /// The game this one was opened from (reference tab): the title for "← back to".
     pub previous: Option<String>,
+    /// A newer version to offer (its number), next to Settings.
+    pub update: Option<String>,
 }
 
 #[derive(Clone, Copy, PartialEq, Eq)]
@@ -96,6 +98,8 @@ pub enum GameAction {
     OpenGame(std::path::PathBuf, usize, Chess),
     /// Back to the game this one was opened from.
     ReturnToPrevious,
+    /// The window offering a newer version.
+    OpenUpdate,
 }
 
 impl GameView {
@@ -121,6 +125,7 @@ impl GameView {
                 SideTab::Notation
             },
             previous: None,
+            update: None,
         }
     }
 
@@ -457,6 +462,11 @@ impl GameView {
                 {
                     actions.push(GameAction::OpenSettings);
                 }
+                if let Some(v) = &self.update
+                    && crate::widgets::update_button(ui, v).clicked()
+                {
+                    actions.push(GameAction::OpenUpdate);
+                }
                 // Find the position in a database: the last chosen one, or another.
                 let searchable = self.search_line().is_some();
                 let why = tr("After a null move (--) this is a teaching scheme, not a position of a game: it is not searched");
diff --git a/apps/desktop/src/library.rs b/apps/desktop/src/library.rs
index 41c49b8..bd29bdc 100644
--- a/apps/desktop/src/library.rs
+++ b/apps/desktop/src/library.rs
@@ -58,6 +58,8 @@ pub enum LibraryAction {
     NewGame,
     PastePgn,
     AddDatabases,
+    /// The window offering a newer version.
+    OpenUpdate,
     RemoveDatabase(PathBuf),
     OpenSettings,
 }
@@ -197,6 +199,8 @@ pub struct Library {
     view: Vec<usize>,
     view_key: Option<(PathBuf, String, SortKey, bool)>,
     scroll_to_selected: bool,
+    /// A newer version to offer (its number), next to Settings.
+    pub update: Option<String>,
     /// File sizes of databases (`file_size`).
     sizes: HashMap<PathBuf, u64>,
 }
@@ -219,6 +223,7 @@ impl Library {
             view_key: None,
             scroll_to_selected: false,
             sizes: HashMap::new(),
+            update: None,
         }
     }
 
@@ -592,6 +597,11 @@ impl Library {
                 if ui.button(tr("⚙ Settings")).clicked() {
                     actions.push(LibraryAction::OpenSettings);
                 }
+                if let Some(v) = &self.update
+                    && crate::widgets::update_button(ui, v).clicked()
+                {
+                    actions.push(LibraryAction::OpenUpdate);
+                }
                 if ui.button(tr("📋 Paste PGN")).clicked() {
                     actions.push(LibraryAction::PastePgn);
                 }
@@ -610,6 +620,11 @@ impl Library {
                 if ui.button(tr("⚙ Settings")).clicked() {
                     actions.push(LibraryAction::OpenSettings);
                 }
+                if let Some(v) = &self.update
+                    && crate::widgets::update_button(ui, v).clicked()
+                {
+                    actions.push(LibraryAction::OpenUpdate);
+                }
                 if ui
                     .button(tr("📋 Paste PGN"))
                     .on_hover_text(tr("Open a game from the clipboard"))
diff --git a/apps/desktop/src/main.rs b/apps/desktop/src/main.rs
index e3ad22d..8c73409 100644
--- a/apps/desktop/src/main.rs
+++ b/apps/desktop/src/main.rs
@@ -21,6 +21,8 @@ mod review;
 mod settings;
 mod settings_ui;
 mod sound;
+mod update;
+mod update_ui;
 mod viewed;
 mod widgets;
 
diff --git a/apps/desktop/src/settings.rs b/apps/desktop/src/settings.rs
index 7aaaef5..cbb1667 100644
--- a/apps/desktop/src/settings.rs
+++ b/apps/desktop/src/settings.rs
@@ -84,6 +84,8 @@ pub struct Settings {
     pub engines_discovered: bool,
     /// The sample databases were put on the shelf (see `examples::first_run_setup`).
     pub examples_added: bool,
+    /// Ask GitHub for a newer release at start (Settings → About).
+    pub check_updates: bool,
     /// The database of the reference tab (`None`: the largest one on the shelf).
     pub reference_db: Option<PathBuf>,
 }
@@ -139,6 +141,7 @@ impl Default for Settings {
             review: ReviewSettings::default(),
             engines_discovered: false,
             examples_added: false,
+            check_updates: true,
             reference_db: None,
         }
     }
diff --git a/apps/desktop/src/settings_ui.rs b/apps/desktop/src/settings_ui.rs
index fc96373..fb3e6a2 100644
--- a/apps/desktop/src/settings_ui.rs
+++ b/apps/desktop/src/settings_ui.rs
@@ -27,6 +27,8 @@ pub enum SettingsAction {
     TestSound,
     /// The active engine (or its options) changed; a running analysis should restart.
     EngineChanged,
+    /// Ask now whether a newer version is out.
+    CheckUpdates,
 }
 
 pub struct SettingsWindow {
@@ -37,6 +39,8 @@ pub struct SettingsWindow {
     pub download: Option<crate::engine_download::Stage>,
     /// Engine whose removal (with its downloaded files) waits for confirmation.
     confirm_remove: Option<usize>,
+    /// What the update check found, set by the application every frame.
+    pub update_status: Option<String>,
 }
 
 impl SettingsWindow {
@@ -47,6 +51,7 @@ impl SettingsWindow {
             checking_engine: false,
             download: None,
             confirm_remove: None,
+            update_status: None,
         }
     }
 
@@ -75,7 +80,24 @@ impl SettingsWindow {
                     Tab::Engines => self.engines(ui, s, &mut actions, &mut changed),
                     Tab::Board => board_tab(ui, s, &mut changed),
                     Tab::Sound => sound_tab(ui, s, &mut actions, &mut changed),
-                    Tab::About => about_tab(ui, s.language),
+                    Tab::About => {
+                        about_tab(ui, s.language);
+                        ui.add_space(10.0);
+                        ui.horizontal_wrapped(|ui| {
+                            changed |= ui
+                                .checkbox(&mut s.check_updates, tr("Check for a new version at start"))
+                                .on_hover_text(tr(
+                                    "ChessPenguin asks GitHub which version is the latest; nothing about you is sent",
+                                ))
+                                .changed();
+                            if ui.button(tr("Check now")).clicked() {
+                                actions.push(SettingsAction::CheckUpdates);
+                            }
+                        });
+                        if let Some(status) = &self.update_status {
+                            ui.label(RichText::new(status).weak());
+                        }
+                    }
                     Tab::Interface => {
                         ui.horizontal(|ui| {
                             ui.label(tr("Language:"));
diff --git a/apps/desktop/src/widgets.rs b/apps/desktop/src/widgets.rs
index b86e92a..6c91e53 100644
--- a/apps/desktop/src/widgets.rs
+++ b/apps/desktop/src/widgets.rs
@@ -32,3 +32,12 @@ pub fn notes_button(ui: &mut egui::Ui, notes: usize) -> egui::Response {
     ui.add(egui::Button::new(egui::RichText::new(format!("ℹ {notes}")).weak().small()).frame(false))
         .on_hover_text(crate::i18n::tr("Import notes"))
 }
+
+/// "⬆ 0.8.0": a newer version is out (opens the update window).
+pub fn update_button(ui: &mut egui::Ui, version: &str) -> egui::Response {
+    ui.button(
+        egui::RichText::new(crate::i18n::trf("⬆ Update {v}", &[("v", &version)]))
+            .color(ui.visuals().hyperlink_color),
+    )
+    .on_hover_text(crate::i18n::tr("A new version of ChessPenguin is out"))
+}
diff --git a/docs/dev/desktop.md b/docs/dev/desktop.md
index 358c711..e36e22e 100644
--- a/docs/dev/desktop.md
+++ b/docs/dev/desktop.md
@@ -42,7 +42,7 @@ XDG_CONFIG_HOME=/tmp/cfg CP_OPEN=11 CP_PLY=3 CP_ANALYZE=1 ./target/debug/chesspe
 ```
 
 `CP_OPEN` — индекс партии (с 0) в первой базе списка, `CP_PLY` — шагов по основной линии,
-`CP_TAB=reference` — открыть у партии вкладку «Справочник», `CP_ANALYZE` — запустить активный движок, `CP_SETTINGS` — открыть настройки (`=board`, `=about` — сразу эту вкладку), `CP_ENGINE_PANEL` — раскрыть панель настроек движка, `CP_VAR` — перейти в первый вариант после `CP_PLY`, `CP_REVIEW=1` — запустить анализ партии (`=dialog` — только открыть окно), `CP_REPORT=1` — открыть вкладку «Отчёт» (нужен готовый анализ), `CP_BEST=k` — показать на доске k-й ход лучшей линии у первой отметки движка (нужен готовый анализ), `CP_ENGINE_OFFER=1` — окно предложения скачать Stockfish (`=download` — сразу начать загрузку), `CP_BOARD="e4 c5 Nf3"` — доска поиска большой базы с этими ходами (SAN), `CP_SORT=date` — большая база по дате (новые сверху), `CP_PANE=hidden` — большая база без правой панели, `CP_FILTER="player=carlsen;years=2015-2026;elo=2600"` — несколько фильтров большой базы, `CP_FILTER_PLAYER=имя` — фильтр «Игрок» большой базы ChessBase при запуске, `CP_SCREENSHOT=file.png` (+ `CP_SCREENSHOT_DELAY=сек`) — полноэкранный снимок окна и выход; так сделаны `docs/screenshots/`. Ключ `--bench <база> [отчёт.txt]` печатает замеры базы вместо окна (`docs/dev/import.md`, «Замер на другой машине»). `CP_MEMORY_LIMIT=<МБ>` — считать доступной памятью не больше этого (пути без дебютного индекса и без таблицы позиций PGN).
+`CP_UPDATE_SOURCE=<папка>` — брать «последний выпуск» из `latest.json` и файлов этой папки вместо GitHub, `CP_UPDATE_KIND=deb|rpm|arch|aur|flatpak|appimage|tarball|windows|mac` — считать установку такой, `CP_UPDATE_OPEN=1` — открыть окно обновления (`=start` — сразу начать), `CP_TAB=reference` — открыть у партии вкладку «Справочник», `CP_ANALYZE` — запустить активный движок, `CP_SETTINGS` — открыть настройки (`=board`, `=about` — сразу эту вкладку), `CP_ENGINE_PANEL` — раскрыть панель настроек движка, `CP_VAR` — перейти в первый вариант после `CP_PLY`, `CP_REVIEW=1` — запустить анализ партии (`=dialog` — только открыть окно), `CP_REPORT=1` — открыть вкладку «Отчёт» (нужен готовый анализ), `CP_BEST=k` — показать на доске k-й ход лучшей линии у первой отметки движка (нужен готовый анализ), `CP_ENGINE_OFFER=1` — окно предложения скачать Stockfish (`=download` — сразу начать загрузку), `CP_BOARD="e4 c5 Nf3"` — доска поиска большой базы с этими ходами (SAN), `CP_SORT=date` — большая база по дате (новые сверху), `CP_PANE=hidden` — большая база без правой панели, `CP_FILTER="player=carlsen;years=2015-2026;elo=2600"` — несколько фильтров большой базы, `CP_FILTER_PLAYER=имя` — фильтр «Игрок» большой базы ChessBase при запуске, `CP_SCREENSHOT=file.png` (+ `CP_SCREENSHOT_DELAY=сек`) — полноэкранный снимок окна и выход; так сделаны `docs/screenshots/`. Ключ `--bench <база> [отчёт.txt]` печатает замеры базы вместо окна (`docs/dev/import.md`, «Замер на другой машине»). `CP_MEMORY_LIMIT=<МБ>` — считать доступной памятью не больше этого (пути без дебютного индекса и без таблицы позиций PGN).
 
 ## Языки
 
diff --git a/packaging/aur/chesspenguin-bin/.SRCINFO b/packaging/aur/chesspenguin-bin/.SRCINFO
index 3f3d63c..f080dbf 100644
--- a/packaging/aur/chesspenguin-bin/.SRCINFO
+++ b/packaging/aur/chesspenguin-bin/.SRCINFO
@@ -1,6 +1,6 @@
 pkgbase = chesspenguin-bin
 	pkgdesc = Chess database: view, enter and analyse PGN and ChessBase games; Stockfish on request
-	pkgver = 0.6.3
+	pkgver = 0.7.0
 	pkgrel = 1
 	url = https://github.com/vrubelroman/chessPenguin
 	arch = x86_64
@@ -17,7 +17,7 @@ pkgbase = chesspenguin-bin
 	provides = chesspenguin
 	conflicts = chesspenguin
 	options = !debug
-	source = https://github.com/vrubelroman/chessPenguin/releases/download/v0.6.3/ChessPenguin-0.6.3-linux-x86_64.tar.gz
-	sha256sums = c94801bc455a35888ffe13fb79732c859ca1b1f0d9c18ee4e8a6c434da54f03a
+	source = https://github.com/vrubelroman/chessPenguin/releases/download/v0.7.0/ChessPenguin-0.7.0-linux-x86_64.tar.gz
+	sha256sums = e8ca8d548aa2543ee0e83e96cfb6bd4dde3460d0f37cf69d0acf2e11c150589c
 
 pkgname = chesspenguin-bin
diff --git a/packaging/aur/chesspenguin-bin/PKGBUILD b/packaging/aur/chesspenguin-bin/PKGBUILD
index 368cb0e..e243e07 100644
--- a/packaging/aur/chesspenguin-bin/PKGBUILD
+++ b/packaging/aur/chesspenguin-bin/PKGBUILD
@@ -1,7 +1,7 @@
 # Maintainer: vrubelroman <vrubelroman@gmail.com>
 pkgname=chesspenguin-bin
 _appid=io.github.vrubelroman.chessPenguin
-pkgver=0.6.3
+pkgver=0.7.0
 pkgrel=1
 pkgdesc="Chess database: view, enter and analyse PGN and ChessBase games; Stockfish on request"
 arch=('x86_64')
@@ -14,7 +14,7 @@ provides=('chesspenguin')
 conflicts=('chesspenguin')
 options=('!debug')
 source=("${url}/releases/download/v${pkgver}/ChessPenguin-${pkgver}-linux-x86_64.tar.gz")
-sha256sums=('c94801bc455a35888ffe13fb79732c859ca1b1f0d9c18ee4e8a6c434da54f03a')
+sha256sums=('e8ca8d548aa2543ee0e83e96cfb6bd4dde3460d0f37cf69d0acf2e11c150589c')
 
 package() {
     cd "ChessPenguin-${pkgver}-linux-x86_64"
diff --git a/packaging/flatpak/io.github.vrubelroman.chessPenguin.yml b/packaging/flatpak/io.github.vrubelroman.chessPenguin.yml
index 049ed89..ba05ab2 100644
--- a/packaging/flatpak/io.github.vrubelroman.chessPenguin.yml
+++ b/packaging/flatpak/io.github.vrubelroman.chessPenguin.yml
@@ -15,6 +15,8 @@ finish-args:
   - --socket=pulseaudio
   # PGN files and UCI engine executables live in the user's home.
   - --filesystem=home
+  # The update check (GitHub) and the user's games from Lichess and Chess.com.
+  - --share=network
 build-options:
   append-path: /usr/lib/sdk/rust-stable/bin
   build-args:
