Skip to content

Flatpak#3

Merged
teidesu merged 3 commits into
masterfrom
poli-electron-builder-flatpak
Jun 18, 2026
Merged

Flatpak#3
teidesu merged 3 commits into
masterfrom
poli-electron-builder-flatpak

Conversation

@poli0iq

@poli0iq poli0iq commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

I'll add a proper manifest later (instead of relying on electron-builder) so that everything looks less ugly. But uh, this at least works already.

Summary by CodeRabbit

Release Notes

  • New Features

    • Expanded Linux distribution to include Flatpak desktop installations.
    • Added an Ubuntu Flatpak build variant to the desktop build pipeline.
  • Chores

    • Updated the Linux application identifier and desktop entry naming.
    • Improved Linux desktop icon generation by adding GNOME-optimized icon variants (SVG/PNG) and aligning Flatpak icon mapping.
  • Build/Packaging

    • Enhanced Flatpak build behavior with improved runtime setup and Flatpak bundling diagnostics.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7de93359-7009-4490-b6d7-95ab111ca818

📥 Commits

Reviewing files that changed from the base of the PR and between 3148711 and 7ae1435.

⛔ Files ignored due to path filters (2)
  • assets/desktop-icon/icon-linux.png is excluded by !**/*.png
  • assets/desktop-icon/icon-linux.svg is excluded by !**/*.svg
📒 Files selected for processing (4)
  • .github/workflows/desktop-build.yml
  • assets/desktop-icon/build.mjs
  • electron-builder.yml
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • electron-builder.yml

📝 Walkthrough

Walkthrough

Adds Linux Flatpak packaging support: the icon build script gains GNOME-variant constants and writes icon-linux.svg and icon-linux.png; electron-builder.yml switches the Linux target from AppImage to Flatpak with a new pet.tei.inutweb appId and runtime version 25.08; package.json adds a desktopName field; the CI matrix gains an Ubuntu Flatpak job with a privileged container and Electron BaseApp pre-installation.

Changes

Linux Flatpak Packaging

Layer / File(s) Summary
GNOME Linux icon generation
assets/desktop-icon/build.mjs
Adds writeFileSync import, three GNOME geometry constants (GNOME_CONTENT, GNOME_MARGIN, GNOME_RADIUS), and output steps that write icon-linux.svg and render icon-linux.png alongside the existing icon.png.
Flatpak packaging config and desktop name
electron-builder.yml, package.json
Switches Linux target from AppImage to Flatpak, changes appId to pet.tei.inutweb, sets runtimeVersion and baseVersion to 25.08, maps the scalable SVG icon into the Flatpak bundle, and adds desktopName: pet.tei.inutweb.desktop to package.json.
CI matrix: Ubuntu Flatpak build job
.github/workflows/desktop-build.yml
Adds linux-flatpak matrix entry with a privileged Flatpak container image, pre-install step for the Electron BaseApp runtime, a flatpak-builder wrapper that disables rofiles-fuse, and a DEBUG env variable on the build step.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A penguin asked for a flatpak today,
So I stamped new icons in GNOME's display.
With a privileged container and BaseApp in place,
rofiles-fuse disabled — we build at great pace!
pet.tei.inutweb, a fine desktop name,
The bunny ships Linux — hooray for the game! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The pull request title 'Flatpak' is extremely vague and generic, failing to convey meaningful information about the specific changes or their purpose. Consider using a more descriptive title like 'Add Flatpak packaging support' or 'Enable Flatpak distribution via electron-builder' to clearly communicate the main objective.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch poli-electron-builder-flatpak

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@poli0iq poli0iq force-pushed the poli-electron-builder-flatpak branch 3 times, most recently from c0d5cda to 3148711 Compare June 17, 2026 13:52
@poli0iq poli0iq changed the base branch from poli-fix-url-schema-in-electron to master June 17, 2026 13:52
@poli0iq poli0iq marked this pull request as ready for review June 17, 2026 13:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/desktop-build.yml:
- Around line 49-50: Replace the derogatory term "retarded" in the comment at
lines 49-50 of the desktop-build.yml workflow file with neutral, professional
language that accurately describes the behavior of electron-builder (such as
"automatically" or "inevitably"). Apply the same replacement to the other
occurrences mentioned in the review at lines 58-60 and 73-75 to ensure
consistent professional language throughout the workflow comments.
- Around line 24-27: Replace the current empty-string container configuration
approach with a `fromJSON` function combined with matrix variables that properly
use `null` values. Update the container section to use `container: ${{
fromJSON(matrix.container) }}` instead of the separate image and options fields
with empty-string defaults. Then modify the matrix strategy to include
conditional entries where non-Linux runners (such as macos-latest or
windows-latest) have their container variable set to `null`, while Linux runners
have a JSON object string containing the image configuration. This ensures
containerization is properly disabled for non-container-capable platforms rather
than attempting to set an empty string which GitHub Actions does not support.
- Around line 19-20: The container field in the desktop-build workflow is using
a mutable tag (freedesktop-25.08) which creates a supply-chain security risk in
privileged builds. Replace the mutable tag reference in the container field with
an immutable image digest by appending `@sha256`: followed by the specific digest
hash of the desired image version. This ensures the exact image version is
locked and cannot be reassigned by a registry compromise.

In `@assets/desktop-icon/build.mjs`:
- Around line 10-11: The import statements using destructuring syntax violate
the configured ESLint object-curly-spacing rule, which requires spaces inside
curly braces. Add spaces after the opening brace and before the closing brace in
all object destructuring patterns, including the imports on lines 10 and 11
(from 'child_process' and 'fs' respectively) and the destructuring pattern on
line 73. Change patterns like {spawnSync} to { spawnSync } and {mkdirSync,
readFileSync, rmSync, writeFileSync} to { mkdirSync, readFileSync, rmSync,
writeFileSync }.

In `@electron-builder.yml`:
- Around line 43-50: Replace the derogatory language in the flatpak
configuration comments with professional, neutral wording. Update the comment
explaining electron-builder's default version behavior (around the
runtimeVersion property) to use neutral language instead of "retarded", and
similarly update the comment about SVG icon handling (above the baseVersion
property) to describe the technical issue without derogatory terminology while
maintaining the explanation of why the workaround is necessary.
- Around line 1-3: The appId value in electron-builder.yml has been changed
globally from `io.github.MarkusBirkl.inutweb` to `pet.tei.inutweb` to satisfy
Flatpak D-Bus naming requirements, but this change will break existing macOS
installations (affecting NSUserDefaults and sandboxed containers) and modify the
Windows AUMID. Confirm with the team whether this breaking change to appId is
intentional for all platforms. If it is not intentional, either revert appId to
the original value and explore platform-specific Flatpak configuration options
in electron-builder.yml, or implement a migration strategy for existing users.
If the change is intentional, ensure the release notes and upgrade documentation
clearly communicate this breaking change and any necessary migration steps for
end users.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d73daea-c04a-4af3-9c67-bd197c686649

📥 Commits

Reviewing files that changed from the base of the PR and between 8d7c3b3 and 3148711.

⛔ Files ignored due to path filters (2)
  • assets/desktop-icon/icon-linux.png is excluded by !**/*.png
  • assets/desktop-icon/icon-linux.svg is excluded by !**/*.svg
📒 Files selected for processing (4)
  • .github/workflows/desktop-build.yml
  • assets/desktop-icon/build.mjs
  • electron-builder.yml
  • package.json

Comment on lines +19 to +20
container: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
container-options: --privileged

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
repo="flathub-infra/flatpak-github-actions"
tag="freedesktop-25.08"

token="$(python - <<'PY'
import json, urllib.request
u = urllib.request.urlopen("https://ghcr.io/token?scope=repository:flathub-infra/flatpak-github-actions:pull")
print(json.load(u)["token"])
PY
)"

digest="$(curl -fsSI \
  -H "Authorization: Bearer ${token}" \
  -H "Accept: application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json" \
  "https://ghcr.io/v2/${repo}/manifests/${tag}" \
  | tr -d '\r' \
  | awk -F': ' 'tolower($1)=="docker-content-digest"{print $2}')"

echo "Resolved digest: ${digest}"

Repository: teidesu/tweb

Length of output: 2638


🏁 Script executed:

# Check if the file exists and read lines around 19-20
if [ -f .github/workflows/desktop-build.yml ]; then
  echo "=== File exists, showing lines 15-25 ==="
  sed -n '15,25p' .github/workflows/desktop-build.yml | cat -n
else
  echo "File not found"
fi

Repository: teidesu/tweb

Length of output: 514


🌐 Web query:

container image pinning by digest security best practice GitHub Actions

💡 Result:

Pinning container images by digest (SHA256) is a critical security best practice in GitHub Actions to prevent supply chain attacks and ensure build reproducibility [1][2][3]. Why Pinning by Digest is Necessary Container image tags (e.g.,:latest,:v1, or:18) are mutable, meaning the underlying image content associated with a tag can be changed at any time by the publisher without notice [2][3]. Relying on tags exposes your workflow to several risks: - Supply Chain Attacks: If a registry account is compromised, an attacker can push a malicious image to an existing tag, causing your workflows to execute unauthorized code [2][3]. - Non-reproducible Builds: Because the image can change, different runs of the same workflow version may use different image layers, leading to inconsistent build results [1][2]. - Silent Compromise: There is no inherent indication or warning when the content of a tag changes, making it difficult to detect that your build environment has been altered [2]. Best Practices for Implementation - Use Immutable Digests: Always reference images using the @sha256: suffix (e.g., node@sha256:a5e0ed...) rather than relying solely on tags [1][2][4]. You can optionally keep the tag for human readability if formatted as image:tag@sha256:... [2]. - Automate Updates: Manually updating digests is error-prone. Use tools like Dependabot or Renovate to automatically monitor for new digests and open pull requests to update your workflow files [3]. - Verify Image Integrity: Where possible, use technologies like Cosign or Docker Content Trust to verify image signatures alongside digest pinning [4]. - Use Trusted Sources: Whenever possible, pull images from secure, private mirrors or registries that support scanning and policy enforcement before the images are available to CI runners [2][3]. How to Find a Digest You can identify the current digest of a container image using the following commands: - Docker CLI: docker buildx imagetools inspect <image:tag> or docker inspect --format='{{index .RepoDigests 0}}' <image:tag> [5][3]. - Third-party tools: Utilities like crane digest <image:tag> can retrieve digests without requiring a local Docker daemon [2][6][5].

Citations:


Pin the Flatpak container image by digest.

Line 19 uses a mutable tag in a privileged job container. Pinning to a digest materially reduces CI supply-chain risk. Mutable tags can be reassigned by a registry account compromise, potentially injecting malicious code into privileged builds.

Proposed fix
-            container: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
+            container: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08@sha256:<resolved-digest>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/desktop-build.yml around lines 19 - 20, The container
field in the desktop-build workflow is using a mutable tag (freedesktop-25.08)
which creates a supply-chain security risk in privileged builds. Replace the
mutable tag reference in the container field with an immutable image digest by
appending `@sha256`: followed by the specific digest hash of the desired image
version. This ensures the exact image version is locked and cannot be reassigned
by a registry compromise.

Source: Linters/SAST tools

Comment on lines +24 to +27
# Ignored if empty
container:
image: ${{ matrix.container || '' }}
options: ${{ matrix.container-options || '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Does GitHub Actions officially support setting jobs.<job_id>.container.image to an empty string to disable job containers for non-Linux matrix entries?

💡 Result:

As of June 2026, GitHub Actions does not natively support disabling a job container by setting jobs.<job_id>.container.image to an empty string [1][2]. While recent updates to the workflow parser have relaxed schema validation to allow empty strings at parse time [2], the runtime behavior remains restrictive. Specifically, setting the container image to an empty string for a job will typically result in a workflow error or failure, as the runner expects a valid container image identifier when the container key is defined [1][2]. For matrix strategies that require running jobs both inside and outside of containers (such as across Linux, Windows, and macOS), the standard and supported approach is to set the entire container key to null rather than using an empty string for the image [3]. This can be achieved effectively by using a matrix variable combined with the fromJSON function [3]: jobs: test: runs-on: ${{ matrix.os }} container: ${{ fromJSON(matrix.container) }} strategy: matrix: os: [ubuntu-latest, macos-latest] container: - '{"image": "ubuntu:latest"}' # For Linux jobs - null # For non-Linux/no-container jobs This method allows you to dynamically control container usage per matrix entry, ensuring jobs on platforms that do not support Docker (like macOS or Windows) or jobs intended to run directly on the runner host can bypass containerization entirely [3].

Citations:


Replace empty-string container config with null to avoid runtime failures on non-Linux runners.

GitHub Actions does not support disabling containers by setting jobs.<job_id>.container.image to an empty string—this causes runtime errors. The standard approach is to use null with fromJSON and a matrix variable:

container: ${{ fromJSON(matrix.container) }}
strategy:
  matrix:
    include:
      - os: ubuntu-latest
        container: '{"image": "ubuntu:latest"}'
      - os: macos-latest
        container: null

This ensures jobs on non-Linux platforms (macOS, Windows) or jobs intended to run directly on the runner bypass containerization entirely.

🧰 Tools
🪛 zizmor (1.25.2)

[error] 26-26: unpinned image references (unpinned-images): container image may be unpinned

(unpinned-images)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/desktop-build.yml around lines 24 - 27, Replace the
current empty-string container configuration approach with a `fromJSON` function
combined with matrix variables that properly use `null` values. Update the
container section to use `container: ${{ fromJSON(matrix.container) }}` instead
of the separate image and options fields with empty-string defaults. Then modify
the matrix strategy to include conditional entries where non-Linux runners (such
as macos-latest or windows-latest) have their container variable set to `null`,
while Linux runners have a JSON object string containing the image
configuration. This ensures containerization is properly disabled for
non-container-capable platforms rather than attempting to set an empty string
which GitHub Actions does not support.

Comment thread .github/workflows/desktop-build.yml Outdated
Comment on lines 10 to +11
import {spawnSync} from 'child_process';
import {mkdirSync, readFileSync, rmSync} from 'fs';
import {mkdirSync, readFileSync, rmSync, writeFileSync} from 'fs';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix ESLint object-curly-spacing violations.

Line 10, Line 11, and Line 73 violate the configured spacing rule and can break lint-gated checks.

Proposed fix
-import {spawnSync} from 'child_process';
-import {mkdirSync, readFileSync, rmSync, writeFileSync} from 'fs';
+import { spawnSync } from 'child_process';
+import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';
...
-const linux = buildSvg({size: GNOME_CONTENT, offset: GNOME_MARGIN, radius: GNOME_RADIUS});
+const linux = buildSvg({ size: GNOME_CONTENT, offset: GNOME_MARGIN, radius: GNOME_RADIUS });

Also applies to: 73-73

🧰 Tools
🪛 ESLint

[error] 10-10: A space is required after '{'.

(object-curly-spacing)


[error] 10-10: A space is required before '}'.

(object-curly-spacing)


[error] 11-11: A space is required after '{'.

(object-curly-spacing)


[error] 11-11: A space is required before '}'.

(object-curly-spacing)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@assets/desktop-icon/build.mjs` around lines 10 - 11, The import statements
using destructuring syntax violate the configured ESLint object-curly-spacing
rule, which requires spaces inside curly braces. Add spaces after the opening
brace and before the closing brace in all object destructuring patterns,
including the imports on lines 10 and 11 (from 'child_process' and 'fs'
respectively) and the destructuring pattern on line 73. Change patterns like
{spawnSync} to { spawnSync } and {mkdirSync, readFileSync, rmSync,
writeFileSync} to { mkdirSync, readFileSync, rmSync, writeFileSync }.

Source: Linters/SAST tools

Comment thread electron-builder.yml
Comment on lines +1 to +3
# Flatpak requires appId to be a valid D-Bus bus name. A valid D-Bus bus name
# contains at least 3 segments (intended for reverse dns notation).
appId: pet.tei.inutweb

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

In electron-builder v26, does changing top-level appId affect macOS bundle identifier and Windows app identity, and is there a Flatpak-only appId override?

💡 Result:

Yes, changing the top-level appId property in electron-builder (including in v26) does affect both the macOS bundle identifier and the Windows application identity [1][2][3]. For macOS, the appId serves as the CFBundleIdentifier [1]. It is strongly recommended to set this explicitly; changing it after an initial release can break existing user data paths, such as NSUserDefaults and sandboxed containers [1]. For Windows, the appId is used as the Application User Model ID (AUMID) for the NSIS target [1][4]. Note that this functionality is specific to NSIS and is not supported by Squirrel.Windows [1][4]. Regarding Flatpak, electron-builder does not provide a specific top-level "appId override" key just for Flatpak. While you can configure Flatpak-specific options under the flatpak configuration block, the appId itself is generally handled globally [5]. Flatpak identifiers (often formatted like org.domain.appname) are typically defined within the Flatpak-specific manifest or configuration settings, and you should ensure your application identity aligns with the requirements of the Flatpak ecosystem [6][7].

Citations:


Confirm this is an intentional breaking change; appId migration affects macOS user data and Windows app identity.

Changing the top-level appId from io.github.MarkusBirkl.inutweb to pet.tei.inutweb will break existing installations on macOS (invalidates NSUserDefaults paths and sandboxed containers) and change the Windows AUMID for NSIS. There is no Flatpak-only override for appId; the global change applies to all platforms. Confirm this is intentional before release, especially if existing users exist.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@electron-builder.yml` around lines 1 - 3, The appId value in
electron-builder.yml has been changed globally from
`io.github.MarkusBirkl.inutweb` to `pet.tei.inutweb` to satisfy Flatpak D-Bus
naming requirements, but this change will break existing macOS installations
(affecting NSUserDefaults and sandboxed containers) and modify the Windows
AUMID. Confirm with the team whether this breaking change to appId is
intentional for all platforms. If it is not intentional, either revert appId to
the original value and explore platform-specific Flatpak configuration options
in electron-builder.yml, or implement a migration strategy for existing users.
If the change is intentional, ensure the release notes and upgrade documentation
clearly communicate this breaking change and any necessary migration steps for
end users.

Comment thread electron-builder.yml Outdated
@poli0iq poli0iq force-pushed the poli-electron-builder-flatpak branch from 3148711 to cdb2792 Compare June 17, 2026 15:24
@poli0iq poli0iq closed this Jun 17, 2026
@poli0iq poli0iq deleted the poli-electron-builder-flatpak branch June 17, 2026 15:44
@poli0iq poli0iq restored the poli-electron-builder-flatpak branch June 17, 2026 16:58
@poli0iq poli0iq reopened this Jun 17, 2026
@poli0iq poli0iq force-pushed the poli-electron-builder-flatpak branch from cdb2792 to 7ae1435 Compare June 17, 2026 21:46
@teidesu teidesu merged commit 22482a8 into master Jun 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants