# Flatpak packaging Source of truth for the Flathub submission. Every file here is a sibling of the manifest, so this directory can be copied verbatim into the `flathub/io.github.ErnieBernie10.RDPilot` repository (Flathub expects the manifest at the repo root). | File | Purpose | | --- | --- | | `io.github.ErnieBernie10.RDPilot.yaml` | Flatpak manifest | | `io.github.ErnieBernie10.RDPilot.metainfo.xml` | AppStream metadata (store page) | | `io.github.ErnieBernie10.RDPilot.desktop` | Desktop entry | | `nuget-sources.json` | Offline NuGet sources (generated) | | `build.sh` | Publish + install steps for the `rdpilot` module | | `rdpilot.sh` | `/app/bin/rdpilot` launcher | | `generate-nuget-sources.sh` | Regenerates `nuget-sources.json` | | `flathub.json` | Restricts Flathub builds to `x86_64` | `flathub.json` pins the build to `x86_64` because `nuget-sources.json` and the `dotnet publish` RID are `linux-x64`. Supporting aarch64 means generating a second set of sources with `--runtime linux-arm64` and selecting the RID per arch. Icons are installed from the git checkout: `RDPilot.Client/Assets/rdpilot-app-icon.svg` and `rdpilot-app-icon-256.png`. ### About `nuget-sources.json` The Flatpak build is offline, so every NuGet package required by `RDPilot.Client/RDPilot.Client.csproj` for `linux-x64` must be declared here with its download URL and SHA-512 hash. The file is generated by `generate-nuget-sources.sh` using the Freedesktop 25.08 SDK and its .NET 10 SDK extension. The generator itself is pinned to a known `flatpak-builder-tools` commit so upstream CLI changes cannot silently break regeneration. On pushes to `master` that change the client project or generator, the `Flatpak NuGet cache` GitHub Actions workflow regenerates this file and commits the result automatically when it changes. On pull requests, the same workflow verifies that the generated file is already committed and fails if it is stale. Do not hand-edit package URLs or hashes. If a `PackageReference` changes locally, run: ```sh cd packaging/flatpak ./generate-nuget-sources.sh ``` The generated set also follows the exact framework/apphost packages requested by the Freedesktop .NET extension, avoiding mismatches when that extension moves to a new .NET 10 servicing patch. ## What the manifest builds 1. `dotnet` — installs the .NET 10 runtime from the SDK extension into `/app/lib/dotnet`. The app is published framework-dependent, same as the Arch package. 2. `libsecret` — `RDPilot.Client/Services/SecretStore.cs` shells out to `secret-tool` and deliberately does not fall back to plaintext, so the binary must exist in the sandbox. See "Where passwords actually go" below. 3. `cjson`, `freerdp` — FreeRDP 3 is not in the freedesktop runtime. Only `libfreerdp3`, `libfreerdp-client3` and `libwinpr3` are built; `RDPilot.Wrapper/CMakeLists.txt` picks them up from `/app` through pkg-config with no code changes. 4. `rdpilot` — runs `build.sh`: `dotnet publish` (which also drives the CMake build of `libfreerdp_wrapper.so` via the `BuildNativeWrapper` target in `RDPilot.Client.csproj`) followed by the install steps. It is invoked as `sh build.sh` so the step does not depend on the source file's mode bit surviving the copy. ### Where passwords actually go Not the system keyring, on most desktops. libsecret's `backend_get_impl_type()` (`libsecret/secret-backend.c`) selects its `file` backend whenever `/.flatpak-info` exists **and** `org.freedesktop.portal.Secret` answers a version query. That backend fetches a per-app master key via the portal's `RetrieveSecret` and encrypts its own `$XDG_DATA_HOME/keyrings/default.keyring` — i.e. `~/.var/app/io.github.ErnieBernie10.RDPilot/data/keyrings/`. The file starts with the legacy `GnomeKeyring\n\r\0\n` magic, which is just libsecret's on-disk format and implies nothing about gnome-keyring being involved. `secret_password_{storev_binary,lookupv_binary,clearv}_sync` all go through `secret_backend_get()`, so `secret-tool store`, `lookup` and `clear` — the only three verbs `LinuxSecretServiceStore` uses — follow that path. `secret-tool search` and `lock` call `secret_service_*` directly and would not. So the secrets are app-private: absent from `seahorse`/`kwalletmanager`, not shared with the native Arch package, and removed by `flatpak uninstall --delete-data`. `--talk-name=org.freedesktop.secrets` is kept for the **other** branch. Without an `org.freedesktop.impl.portal.Secret` backend — Plasma predating KWallet's ksecretd bridge (added 2024-11), KeePassXC providing the Secret Service, bare WMs — the version check fails and libsecret falls back to D-Bus. Since `SecretStore` will not write plaintext, dropping the permission makes password storage hard-fail there rather than degrade. Reproduce that branch on a machine that has the portal (`SECRET_BACKEND` is read in the same `else` clause): ```sh # forced fallback, permission granted -> saves into the system keyring flatpak run --env=SECRET_BACKEND=service io.github.ErnieBernie10.RDPilot # forced fallback, permission revoked -> saving fails flatpak run --env=SECRET_BACKEND=service \ --no-talk-name=org.freedesktop.secrets io.github.ErnieBernie10.RDPilot ``` Confirm the portal exists at all with: ```sh busctl --user get-property org.freedesktop.portal.Desktop \ /org/freedesktop/portal/desktop org.freedesktop.portal.Secret version ``` ### H.264 and the codecs extension The base runtime builds ffmpeg with `--disable-decoder="h264,hevc,vc1,vvc"`, so H.264 RDPGFX needs `org.freedesktop.Platform.codecs-extra//25.08-extra`. The manifest declares **no** `add-extensions` block for it — the Platform already declares that extension point (`directory: %{lib}/codecs-extra`, `add-ld-path: lib`), so installing the extension is enough. Two things that trip people up: the branch is `25.08-extra`, not `25.08`; and the extension was called `org.freedesktop.Platform.ffmpeg-full` in freedesktop-sdk 24.08 and earlier, so older manifests and guides use a name that no longer resolves. Config and secrets land in `~/.var/app/io.github.ErnieBernie10.RDPilot/config/RDPilot.Client/` because Flatpak redirects `XDG_CONFIG_HOME`. `AppDataPaths.AppName` stays `RDPilot.Client`; changing it would orphan saved passwords. ## Build and test locally ```sh flatpak install -y flathub org.flatpak.Builder \ org.freedesktop.Platform//25.08 org.freedesktop.Sdk//25.08 \ org.freedesktop.Sdk.Extension.dotnet10//25.08 \ org.freedesktop.Platform.codecs-extra//25.08-extra cd packaging/flatpak flatpak run org.flatpak.Builder --force-clean --user --install \ --install-deps-from=flathub --ccache \ --repo=repo build-dir io.github.ErnieBernie10.RDPilot.yaml flatpak run io.github.ErnieBernie10.RDPilot ``` Lint exactly the way Flathub does — warnings are fatal there: ```sh flatpak run --command=flatpak-builder-lint org.flatpak.Builder \ manifest io.github.ErnieBernie10.RDPilot.yaml flatpak run --command=flatpak-builder-lint org.flatpak.Builder builddir build-dir ``` Two errors are expected outside Flathub and can be ignored locally: - `appstream-external-screenshot-url` - `appstream-remote-icon-not-mirrored` Both assert that the URLs in the composed AppStream catalogue start with `https://dl.flathub.org/media` — a **prefix** check, not a reachability one. Flathub satisfies it by running flatpak-builder with `--compose-url-policy=full`, which makes `appstreamcli compose` rewrite the URLs. Without that flag the original remote URLs survive and both checks fire. They are documented as never-granted exceptions, so `--exceptions` will not waive them. CI filters exactly those two and fails on anything else. Note that an unreachable screenshot URL surfaces as `appstream-missing-screenshots`, which is *not* filtered. ### Building your working tree instead of a pinned commit The manifest pins a git commit, which is what Flathub requires. To test uncommitted changes, temporarily replace the `type: git` source of the `rdpilot` module with: ```yaml - type: dir path: ../.. ``` Do not commit that swap. ## Manual test checklist The build succeeding proves very little; these are the things that actually break under sandboxing. 1. Window opens and the Inter font renders. 2. Connect to a real RDP host. `DllNotFoundException` means the FreeRDP module or the `libfreerdp_wrapper.so` copy failed. 3. Save a connection with a password, quit, relaunch, reconnect. This exercises `secret-tool` plus `--talk-name=org.freedesktop.secrets` and is the most likely thing to be broken. 4. Run once under Wayland (selected automatically because `WAYLAND_DISPLAY` is set — see `Program.cs`) and once with `flatpak run --env=RDPILOT_USE_WAYLAND=0` to force X11. Compare resize, HiDPI scaling and cursor rendering. 5. On a fractionally scaled monitor, confirm the remote desktop is not ~20% oversized. 6. Copy text in both directions. 7. Watch `[PERF_NATIVE]` / `[PERF_UI]` during a window drag. A large regression against a native build usually means the `codecs-extra` extension is not installed. ## Releasing 1. Bump `VERSION` in `build.sh` and add a matching `` to the metainfo. The newest release version and the built version must agree or the linter complains. 2. Ensure the `Flatpak NuGet cache` workflow is green after any client `PackageReference` change (or run `./generate-nuget-sources.sh` locally and commit the result). 3. Tag the release, then point the `rdpilot` module's git source at the tag and its commit. 4. Copy this directory into the Flathub repo and open a PR.