From 134048857b7cfc1d9fb84fbbf9f671f62eef9fa8 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 13:58:22 -0500 Subject: [PATCH] fix(flatpak): allow release checks and self-update helpers --- crates/ui-egui/tests/flatpak_updates.rs | 27 +++++++++++++++++++ .../ai.storyteller.TextureCraft.bundle.yml | 7 ++--- .../flatpak/ai.storyteller.TextureCraft.yml | 7 ++--- 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 crates/ui-egui/tests/flatpak_updates.rs diff --git a/crates/ui-egui/tests/flatpak_updates.rs b/crates/ui-egui/tests/flatpak_updates.rs new file mode 100644 index 00000000..8feccc9f --- /dev/null +++ b/crates/ui-egui/tests/flatpak_updates.rs @@ -0,0 +1,27 @@ +//! Release and source Flatpaks must allow release checks and host update helpers. +fn finish_args(manifest: &str) -> Vec<&str> { + manifest + .split("finish-args:") + .nth(1) + .unwrap() + .lines() + .take_while(|line| line.is_empty() || line.starts_with(' ') || line.starts_with('#')) + .filter_map(|line| line.trim().strip_prefix("- ")) + .map(|arg| arg.trim_matches(['\'', '"'])) + .collect() +} + +#[test] +fn flatpak_update_permissions() { + let manifests = [ + include_str!("../../../packaging/linux/flatpak/ai.storyteller.TextureCraft.bundle.yml"), + include_str!("../../../packaging/linux/flatpak/ai.storyteller.TextureCraft.yml"), + ]; + let args = manifests.map(finish_args); + assert_eq!(args[0], args[1], "source and release permissions must agree"); + for permissions in args { + for required in ["--share=network", "--talk-name=org.freedesktop.Flatpak"] { + assert!(permissions.contains(&required), "missing update permission: {required}"); + } + } +} diff --git a/packaging/linux/flatpak/ai.storyteller.TextureCraft.bundle.yml b/packaging/linux/flatpak/ai.storyteller.TextureCraft.bundle.yml index 259e2396..4e800a45 100644 --- a/packaging/linux/flatpak/ai.storyteller.TextureCraft.bundle.yml +++ b/packaging/linux/flatpak/ai.storyteller.TextureCraft.bundle.yml @@ -17,6 +17,10 @@ runtime-version: '26.08' sdk: org.freedesktop.Sdk command: texturecraft finish-args: + # Release checks and downloads use HTTPS. + - --share=network + # The shared updater inspects and updates this installation via flatpak-spawn --host. + - --talk-name=org.freedesktop.Flatpak # Display: Wayland first; X11 only when no Wayland compositor is running. - --socket=wayland - --socket=fallback-x11 @@ -30,9 +34,6 @@ finish-args: # line, Open Recent, "Save" next to the original) work in the usual places. - --filesystem=xdg-pictures - --filesystem=xdg-documents - # Deliberately not granted: network (the optional --control server listens on 127.0.0.1 in - # the sandbox; `flatpak override --user --share=network ai.storyteller.texturecraft` exposes it to - # host agents) and home/host filesystem access. modules: - name: texturecraft buildsystem: simple diff --git a/packaging/linux/flatpak/ai.storyteller.TextureCraft.yml b/packaging/linux/flatpak/ai.storyteller.TextureCraft.yml index 3b680178..67e55292 100644 --- a/packaging/linux/flatpak/ai.storyteller.TextureCraft.yml +++ b/packaging/linux/flatpak/ai.storyteller.TextureCraft.yml @@ -18,6 +18,10 @@ sdk-extensions: - org.freedesktop.Sdk.Extension.rust-stable command: texturecraft finish-args: + # Release checks and downloads use HTTPS. + - --share=network + # The shared updater inspects and updates this installation via flatpak-spawn --host. + - --talk-name=org.freedesktop.Flatpak # Display: Wayland first; X11 only when no Wayland compositor is running. - --socket=wayland - --socket=fallback-x11 @@ -31,9 +35,6 @@ finish-args: # line, Open Recent, "Save" next to the original) work in the usual places. - --filesystem=xdg-pictures - --filesystem=xdg-documents - # Deliberately not granted: network (the optional --control server listens on 127.0.0.1 in - # the sandbox; `flatpak override --user --share=network ai.storyteller.texturecraft` exposes it to - # host agents) and home/host filesystem access. build-options: append-path: /usr/lib/sdk/rust-stable/bin modules: