Repository: flathub/tech.feliciano.pocket-casts
Pull request #8: Build Script Improvements and Update Automation
Author: login: ProjectSynchro
Created: 2024-09-26T02:23:02Z | Merged: 2025-04-22T14:58:54Z

Updates the application to version 0.8.0, and the FreeDesktop runtime to 24.08.

The manifest has been updated to consume upstream deb packages, enable support for Wayland and uses the external data checker for updates.
I also added an updated metainfo which includes new version information, as well as other information related to the project.

This changes this flatpak to be built from existing binaries. This is mainly due to the difficulty/feasibility behind building using electron-forge offline as well as the lack of support for v3 npm lockfiles in [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools). 

Currently this isn't possible with my testing (at least with the current flatpak tools) but if someone figures this out going back to source building is the way to go. Due to the fact that both AMD64 and ARM64 debian packages are available upstream, nobody loses out on access to this application in the meantime however.

Let me know if you'd like any changes.

Obsoletes #7 


Diff:
diff --git a/.github/workflows/check-updates.yml b/.github/workflows/check-updates.yml
new file mode 100644
index 0000000..cfc8b8f
--- /dev/null
+++ b/.github/workflows/check-updates.yml
@@ -0,0 +1,56 @@
+name: Check for updates
+
+on:
+  schedule: # for scheduling to work this file must be in the default branch
+  - cron: "0 * * * *" # run every hour
+  workflow_dispatch: # can be manually dispatched under GitHub's "Actions" tab
+
+env:
+# email sets "github-actions[bot]" as commit author, see https://github.community/t/github-actions-bot-email-address/17204/6
+  GIT_USER_NAME: github-actions[bot]
+  GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
+  FLATPAK_ID: tech.feliciano.pocket-casts
+
+jobs:
+  flatpak-external-data-checker:
+    runs-on: ubuntu-latest
+
+    strategy:
+      matrix:
+        branch: [ master ] # list all branches to check
+
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          ref: ${{ matrix.branch }}
+
+      - name: Check for Flatpak source updates via Flatpak External Data Checker
+        uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest
+        with:
+          args: --edit-only ${{ env.FLATPAK_ID }}.yml
+
+      - name: Verify if git was updated
+        id: is-updated
+        run: |
+          git status -s -uno
+          [ -z "$(git status -s -uno)" ] || echo "updated=true" >> $GITHUB_OUTPUT
+
+      - name: Generate Node sources
+        if: steps.is-updated.outputs.updated
+        run: |
+          ./generate_deps.sh
+
+      - name: Reset Flatpak manifest to pre-modified state
+        run: |
+          git checkout -- ${FLATPAK_ID}.yml
+
+      - name: Run Flatpak External Data Checker again and Open PR
+        uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest
+        env:
+          GIT_AUTHOR_NAME: Flatpak External Data Checker
+          GIT_COMMITTER_NAME: Flatpak External Data Checker
+          GIT_AUTHOR_EMAIL: ${{ env.GIT_USER_NAME }}
+          GIT_COMMITTER_EMAIL: ${{ env.GIT_USER_EMAIL }}
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          args: --update --never-fork ${{ env.FLATPAK_ID }}.yml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8deece4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+# Directories
+.flatpak-builder/
+_build/
+_repo/
+
+# Loose Files
+tech.feliciano.pocket-casts.flatpak
+package.json
+package-lock.json
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..a566b72
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "flatpak-builder-tools"]
+	path = flatpak-builder-tools
+	url = https://github.com/Ian2020/flatpak-builder-tools.git
+	branch = gitrefs
\ No newline at end of file
diff --git a/README.md b/README.md
index f2a94e4..afa33be 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,15 @@
+## Flatpak for Pocket Casts
 
-## Updating the package
+#### Check out the upstream project here: https://github.com/FelicianoTech/pocket-casts-desktop-app
 
-Using [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools):
-```
-../flatpak-builder-tools/node/flatpak-node-generator npm /tmp/pocket-casts-desktop-app/package-lock.json
-```
+### Build the Flatpak locally
+1. Clone this repo
+2. Install flatpak and flatpak-builder for your distro
+3. Run the build script with: `./local-build.sh`
+4. Install the test build with: `flatpak install ./tech.feliciano.pocket-casts.flatpak`
+
+### Getting NPM generated sources manually
+1. Clone this repo
+2. Install `git`, `pipx`, `jq`, and `curl` for your distro
+3. Run `./generate_deps.sh`
+4. Verify the updates and commit the updated `generated-sources.json`
diff --git a/flathub.json b/flathub.json
new file mode 100644
index 0000000..4e6b2b8
--- /dev/null
+++ b/flathub.json
@@ -0,0 +1,4 @@
+{
+    "disable-external-data-checker": true,
+    "automerge-flathubbot-prs": false
+}
diff --git a/flatpak-builder-tools b/flatpak-builder-tools
new file mode 160000
index 0000000..886ff68
--- /dev/null
+++ b/flatpak-builder-tools
@@ -0,0 +1 @@
+Subproject commit 886ff685a1f2ee07ebbd3330c24af087795aa27e
diff --git a/generate_deps.sh b/generate_deps.sh
new file mode 100755
index 0000000..65198e1
--- /dev/null
+++ b/generate_deps.sh
@@ -0,0 +1,128 @@
+#!/usr/bin/env bash
+
+set -euo pipefail  # Exit on error, undefined variable, and pipe errors
+
+# ---------------------------
+# Configuration
+# ---------------------------
+
+# Repository details
+REPO_OWNER="FelicianoTech"
+REPO_NAME="pocket-casts-desktop-app"
+
+# Temporary files
+PACKAGE_LOCK_FILE="package-lock.json"
+PACKAGE_JSON_FILE="package.json"
+
+# ---------------------------
+# Functions
+# ---------------------------
+
+# Function to print error messages and exit
+error() {
+    echo "Error: $1" >&2
+    exit 1
+}
+
+# Function to check if a command exists
+check_command() {
+    local cmd="$1"
+    if ! command -v "$cmd" &> /dev/null; then
+        error "$cmd is not installed. Please install $cmd and try again."
+    fi
+    echo "$cmd is installed."
+}
+
+# Function to check if a Python package is installed via pipx
+check_pipx_package() {
+    local package="$1"
+    if ! pipx list | grep -q "$package"; then
+        return 1
+    fi
+    return 0
+}
+
+# ---------------------------
+# Check for Required Tools
+# ---------------------------
+
+echo "Checking for required tools..."
+
+REQUIRED_TOOLS=(
+    "git"
+    "pipx"
+    "curl"
+    "jq"
+)
+
+for cmd in "${REQUIRED_TOOLS[@]}"; do
+    check_command "$cmd"
+done
+
+echo "All required tools are installed."
+
+# ---------------------------
+# Initialize Git Submodules
+# ---------------------------
+
+echo "Initializing git submodules..."
+git submodule update --init || error "Failed to initialize git submodules."
+echo "Git submodules initialized successfully."
+
+# ---------------------------
+# Install flatpak-node-generator
+# ---------------------------
+
+echo "Checking if 'flatpak-node-generator' is installed via pipx..."
+if check_pipx_package "flatpak-node-generator"; then
+    echo "'flatpak-node-generator' is already installed."
+else
+    echo "'flatpak-node-generator' is not installed. Installing..."
+    pipx install flatpak-builder-tools/node || error "Failed to install 'flatpak-node-generator' via pipx."
+    echo "'flatpak-node-generator' installed successfully."
+fi
+
+# ---------------------------
+# Fetch Latest Release Tag
+# ---------------------------
+
+echo "Fetching the latest release tag from GitHub..."
+LATEST_TAG=$(curl -s "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest" | jq -r '.tag_name') || error "Failed to fetch the latest release tag."
+if [[ -z "$LATEST_TAG" || "$LATEST_TAG" == "null" ]]; then
+    error "Latest release tag not found."
+fi
+echo "Latest release tag: $LATEST_TAG"
+
+# ---------------------------
+# Download package.json and package-lock.json
+# ---------------------------
+
+echo "Downloading 'package.json' and 'package-lock.json' from the latest release..."
+PACKAGE_JSON_URL="https://raw.githubusercontent.com/${REPO_OWNER}/${REPO_NAME}/${LATEST_TAG}/package.json"
+PACKAGE_LOCK_URL="https://raw.githubusercontent.com/${REPO_OWNER}/${REPO_NAME}/${LATEST_TAG}/package-lock.json"
+
+curl -sSL "$PACKAGE_LOCK_URL" -o "$PACKAGE_LOCK_FILE" || error "Failed to download 'package-lock.json'."
+curl -sSL "$PACKAGE_JSON_URL" -o "$PACKAGE_JSON_FILE" || error "Failed to download 'package.json'."
+echo "Downloaded 'package.json' and 'package-lock.json' successfully."
+
+# ---------------------------
+# Generate Sources
+# ---------------------------
+
+echo "Generating 'generated-sources.json' using 'flatpak-node-generator'..."
+flatpak-node-generator npm "$PACKAGE_LOCK_FILE" || error "'flatpak-node-generator' failed."
+echo "'generated-sources.json' generated successfully."
+
+# ---------------------------
+# Clean Up
+# ---------------------------
+
+echo "Cleaning up downloaded JSON files..."
+rm -f "$PACKAGE_LOCK_FILE" "$PACKAGE_JSON_FILE"
+echo "Cleaned up temporary files."
+
+# ---------------------------
+# Completion Message
+# ---------------------------
+
+echo "Node sources updated successfully. Please review and commit 'generated-sources.json'."
diff --git a/local-build.sh b/local-build.sh
index 04d5a17..0910038 100755
--- a/local-build.sh
+++ b/local-build.sh
@@ -1,10 +1,70 @@
 #!/usr/bin/env bash
 
-BRANCH=test
+set -e  # Exit immediately if a command exits with a non-zero status
 
+BRANCH="test"
+
+# Function to print error messages
+error() {
+    echo "Error: $1" >&2
+    exit 1
+}
+
+# Function to check if a command exists
+check_command() {
+    local cmd="$1"
+    if ! command -v "$cmd" &> /dev/null; then
+        error "$cmd is not installed. Please install $cmd and try again."
+    fi
+    echo "$cmd is installed."
+}
+
+# Check if flatpak is installed
+check_command "flatpak"
+
+# Check if flatpak-builder is installed
+check_command "flatpak-builder"
+
+# Define required Flatpak packages
+REQUIRED_FLATPAK_PACKAGES=(
+    "org.freedesktop.Platform//24.08"
+    "org.freedesktop.Sdk//24.08"
+    "org.freedesktop.Sdk.Extension.node20//24.08"
+    "org.electronjs.Electron2.BaseApp//24.08"
+)
+
+# Function to check if a Flatpak package is installed
+is_flatpak_installed() {
+    local package="$1"
+    flatpak info "$package" &> /dev/null
+}
+
+# Install missing Flatpak packages
+for package in "${REQUIRED_FLATPAK_PACKAGES[@]}"; do
+    if is_flatpak_installed "$package"; then
+        echo "Flatpak package '$package' is already installed."
+    else
+        echo "Flatpak package '$package' is not installed. Installing..."
+        flatpak install -y flathub "$package" || error "Failed to install $package"
+    fi
+done
+
+# Update Flatpak repositories
+echo "Updating Flatpak repositories..."
+flatpak update -y || error "Failed to update Flatpak repositories"
+
+# Clean previous build artifacts
+echo "Cleaning previous build artifacts..."
 rm -f tech.feliciano.pocket-casts.flatpak
-rm -rf _build ; mkdir _build
-rm -rf _repo ; mkdir _repo
+rm -rf _build _repo
+mkdir _build _repo
+
+# Build the Flatpak
+echo "Building the Flatpak..."
+flatpak-builder --ccache --force-clean --default-branch="$BRANCH" _build tech.feliciano.pocket-casts.yml --repo=_repo || error "flatpak-builder failed"
+
+# Bundle the Flatpak
+echo "Bundling the Flatpak..."
+flatpak build-bundle _repo tech.feliciano.pocket-casts.flatpak tech.feliciano.pocket-casts "$BRANCH" || error "flatpak build-bundle failed"
 
-flatpak-builder --ccache --force-clean --default-branch=$BRANCH _build tech.feliciano.pocket-casts.yml --repo=_repo
-flatpak build-bundle _repo tech.feliciano.pocket-casts.flatpak tech.feliciano.pocket-casts $BRANCH
+echo "Flatpak build and bundle completed successfully."


Reviews:
user: login: hadess
state: CHANGES_REQUESTED
author_association: COLLABORATOR
submitted_at: 2024-09-26T07:34:17Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-26T08:14:38Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-26T08:15:00Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-26T08:15:44Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-26T08:22:28Z
user: login: hadess
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2024-09-26T09:34:44Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-26T10:53:30Z
user: login: hadess
body: I have no idea about the implications of using GitHub actions, it's something that "somebody" (you or I, or anybody else that might be reading this) would need to research.

I'm happy to commit the rest of the commits after the review changes are applied, if you want to put the GitHub actions changes in a separate PR.
state: CHANGES_REQUESTED
author_association: COLLABORATOR
submitted_at: 2024-09-27T11:51:51Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-27T16:13:50Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-27T16:16:01Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-27T16:19:24Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-27T16:19:39Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-27T16:26:11Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-27T16:28:07Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-09-27T17:20:55Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-10-09T16:31:50Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-10-09T16:32:37Z
user: login: hadess
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-22T14:58:33Z
user: login: ProjectSynchro
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-24T14:34:01Z

Review comments:
diff_hunk: @@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-BRANCH=test
path: local-build.sh
user: login: hadess
body: Why was this deleted?
created_at: 2024-09-26T07:30:52Z
author_association: COLLABORATOR
diff_hunk: @@ -1,31 +0,0 @@
-From 3d7d7dad71e7bd89bd00c0aa99767c0438c3beeb Mon Sep 17 00:00:00 2001
path: 0001-flatpak-Add-missing-item-in-appdata-file.patch
user: login: hadess
body: You're removing files before they're obsolete. This would break the build.
created_at: 2024-09-26T07:31:19Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
path: tech.feliciano.pocket-casts.metainfo.xml
user: login: hadess
body: This file should be upstream. You removed the appdata file in the previous commit, those are the same files. Please make sure to keep this being a patch if the upstream file still exists.
created_at: 2024-09-26T07:32:30Z
author_association: COLLABORATOR
diff_hunk: @@ -1,67 +1,99 @@
 app-id: tech.feliciano.pocket-casts
 runtime: org.freedesktop.Platform
-runtime-version: '22.08'
+runtime-version: &runtime-version '24.08'
 sdk: org.freedesktop.Sdk
-sdk-extensions:
-  - org.freedesktop.Sdk.Extension.node18
 base: org.electronjs.Electron2.BaseApp
-base-version: '22.08'
-command: run.sh
+base-version: *runtime-version
+command: start-pocket-casts
 separate-locales: false
 finish-args:
+  # Share IPC namespace with the host, without it the X11 shared memory extension will not work.
   - --share=ipc
-  - --socket=x11
-  - --socket=pulseaudio
+  # Allow access to the network.
   - --share=network
+  # Show windows using Wayland with a fallback to Xorg.
+  - --socket=wayland
+  - --socket=fallback-x11
+  # Pulseaudio for audio.
+  - --socket=pulseaudio
+  # Required for hardware acceleration.
   - --device=dri
-  - --talk-name=org.kde.StatusNotifierWatcher
+  # Set XDG_CURRENT_DESKTOP to 'unity'
+  # This works around https://github.com/electron/electron/issues/39789
+  - --env=XDG_CURRENT_DESKTOP=unity
+  # Allow access to the Secrets socket (for safeStorage support)
+  - --talk-name=org.freedesktop.secrets
+  # Allow access to MPRIS controls.
   - --own-name=org.mpris.MediaPlayer2.chromium.*
+  # Allow access to appindicator icons on KDE
+  - --talk-name=org.kde.StatusNotifierWatcher
+  - --talk-name=com.canonical.AppMenu.Registrar
 modules:
-  - name: yarn
-    buildsystem: simple
-    build-commands:
-      - mkdir --parents /app/share/yarn/
-      - cp --archive * /app/share/yarn/
-      - ln --symbolic /app/share/yarn/bin/yarn /app/bin/yarn
-      - ln --symbolic /app/share/yarn/bin/yarnpkg /app/bin/yarnpkg
-    cleanup:
-      - "*"
-    sources:
-      - type: archive
-        sha256: df202627d9a70cf09ef2fb11cb298cb619db1b958590959d6f6e571b50656029
-        url: https://github.com/yarnpkg/yarn/releases/download/v1.16.0/yarn-v1.16.0.tar.gz
-
   - name: pocket-casts
     buildsystem: simple
-    build-options:
-      append-path: /usr/lib/sdk/node18/bin
-      env:
-        CHROMEDRIVER_SKIP_DOWNLOAD: 'true'
-        npm_config_nodedir: '/usr/lib/sdk/node14'
-        XDG_CACHE_HOME: /run/build/pocket-casts/flatpak-node/cache
+    build-commands:
+      # Extract debian package.
+      - bsdtar --to-stdout -xf pocket-casts_*.deb data.* | bsdtar --strip-components
+        2 -xf -
+      # Copy extracted bin and data directories to the deployment location.
+      - cp -r lib/* ${FLATPAK_DEST}/lib
+      - cp -r share/* ${FLATPAK_DEST}/share
+      # Fixup upstream desktop file so it matches our metainfo.
+      - desktop-file-edit --set-key=Exec --set-value="start-pocket-casts %U" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=Icon --set-value="${FLATPAK_ID}" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=Name --set-value="Pocket Casts" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=GenericName --set-value="Pocket Casts" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=Comment --set-value="Linux desktop player for
+        Pocket Casts" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=Categories --set-value="AudioVideo;Audio;" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      # Cleanup pixmaps folder.
+      - rm -rf ${FLATPAK_DEST}/share/pixmaps
+      # Install upstream icon correctly.
+      - install -Dm644 icon.png ${FLATPAK_DEST}/share/icons/hicolor/512x512/apps/${FLATPAK_ID}.png
+      # Install Flatpak specific wrapper.
+      - install -Dm755 start-pocket-casts.sh ${FLATPAK_DEST}/bin/start-pocket-casts
+      # Install Flatpak specific metainfo.
+      - install -Dm644 tech.feliciano.pocket-casts.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml
     sources:
       - type: git
-        url: https://github.com/felicianotech/pocket-casts-desktop-app
-        commit: 5eab5710634aa24b958db905ed3339b39c04dc9d
-      - "generated-sources.json"
+        url: https://github.com/FelicianoTech/pocket-casts-desktop-app.git
+        tag: v0.8.0
+        commit: 06d0439647b500b0ab84566d2d9028d1cff5ede6
+        x-checker-data:
+          type: git
+          tag-pattern: ^v([\d.]+)$
+      - type: file
+        only-arches:
+          - x86_64
+        url: https://github.com/FelicianoTech/pocket-casts-desktop-app/releases/download/v0.8.0/pocket-casts_0.8.0_amd64.deb
+        sha512: aa793e2427524e45f0e445552c1da38639e177a29a15427cea0ef100ff6220c499dc22fe64d1b398eba65bdf63449a83bc125d616172abefab397c16905fff2f
+        x-checker-data:
+          type: json
+          url: https://api.github.com/repos/FelicianoTech/pocket-casts-desktop-app/releases/latest
+          version-query: .tag_name
+          url-query: .assets[] | select(.name|endswith("_amd64.deb")) | .browser_download_url
+      - type: file
+        only-arches:
+          - aarch64
+        url: https://github.com/FelicianoTech/pocket-casts-desktop-app/releases/download/v0.8.0/pocket-casts_0.8.0_arm64.deb
+        sha512: 2e68a2c0b1a21853420f3e44ff1a685fec9ca2f90e1d0f4a6b7c0eb7179270f7af26746e134527b129de4c03b040279731caaac1693a7a8cbeb7f54f85576754
+        x-checker-data:
+          type: json
+          url: https://api.github.com/repos/FelicianoTech/pocket-casts-desktop-app/releases/latest
+          version-query: .tag_name
+          url-query: .assets[] | select(.name|endswith("_arm64.deb")) | .browser_download_url
       - type: script
-        dest-filename: run.sh
+        dest-filename: start-pocket-casts.sh
         commands:
-          - /app/lib/pocket-casts/pocket-casts --no-sandbox
-      - type: patch
-        path: 0001-flatpak-Add-missing-item-in-appdata-file.patch
-        use-git-am: true
-      - type: patch
-        path: 0001-flatpak-Fix-screenshot-URL.patch
-        use-git-am: true
-    build-commands:
-      - HOME=$PWD yarn config --offline set yarn-offline-mirror $FLATPAK_BUILDER_BUILDDIR/flatpak-node/yarn-mirror
-      - yarn --offline
-      - yarn run --offline pack
-      - install -Dm 644 flatpak/tech.feliciano.pocket-casts.appdata.xml /app/share/metainfo/tech.feliciano.pocket-casts.appdata.xml
-      - install -Dm 644 flatpak/tech.feliciano.pocket-casts.desktop /app/share/applications/tech.feliciano.pocket-casts.desktop
-      - install -Dm 644 icon.png /app/share/icons/tech.feliciano.pocket-casts.png
-      - mkdir -p /app/lib/ /app/bin
-      - cp -r dist/linux-*unpacked/ /app/lib/pocket-casts/
-      - install run.sh /app/bin/
+          - export TMPDIR=$XDG_RUNTIME_DIR/app/$FLATPAK_ID
+          - WAYLAND_SOCKET=${WAYLAND_DISPLAY:-"wayland-0"}
+          - FLAGS="--password-store=gnome-libsecret"
+          - if [[ -e "$XDG_RUNTIME_DIR/${WAYLAND_SOCKET}" || -e "${WAYLAND_DISPLAY}"
+            ]]; then
+          - FLAGS="$FLAGS --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto"
+          - fi
+          - FLATPAK_HOST=1 zypak-wrapper.sh /app/lib/youtube-music-desktop-app/youtube-music-desktop-app
path: tech.feliciano.pocket-casts.yml
user: login: hadess
body: `youtube-music-desktop-app` ?
created_at: 2024-09-26T07:34:12Z
author_association: COLLABORATOR
diff_hunk: @@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-BRANCH=test
path: local-build.sh
user: login: ProjectSynchro
body: I figured the instructions in the README were sufficient, but I added it back as there isn't really a reason to remove it.
created_at: 2024-09-26T08:14:38Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-BRANCH=test
path: local-build.sh
user: login: ProjectSynchro
body: Solved with https://github.com/flathub/tech.feliciano.pocket-casts/pull/8/commits/24f38ad1eca48114a9492ca12e7dc3e39d2198bf
created_at: 2024-09-26T08:15:00Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,67 +1,99 @@
 app-id: tech.feliciano.pocket-casts
 runtime: org.freedesktop.Platform
-runtime-version: '22.08'
+runtime-version: &runtime-version '24.08'
 sdk: org.freedesktop.Sdk
-sdk-extensions:
-  - org.freedesktop.Sdk.Extension.node18
 base: org.electronjs.Electron2.BaseApp
-base-version: '22.08'
-command: run.sh
+base-version: *runtime-version
+command: start-pocket-casts
 separate-locales: false
 finish-args:
+  # Share IPC namespace with the host, without it the X11 shared memory extension will not work.
   - --share=ipc
-  - --socket=x11
-  - --socket=pulseaudio
+  # Allow access to the network.
   - --share=network
+  # Show windows using Wayland with a fallback to Xorg.
+  - --socket=wayland
+  - --socket=fallback-x11
+  # Pulseaudio for audio.
+  - --socket=pulseaudio
+  # Required for hardware acceleration.
   - --device=dri
-  - --talk-name=org.kde.StatusNotifierWatcher
+  # Set XDG_CURRENT_DESKTOP to 'unity'
+  # This works around https://github.com/electron/electron/issues/39789
+  - --env=XDG_CURRENT_DESKTOP=unity
+  # Allow access to the Secrets socket (for safeStorage support)
+  - --talk-name=org.freedesktop.secrets
+  # Allow access to MPRIS controls.
   - --own-name=org.mpris.MediaPlayer2.chromium.*
+  # Allow access to appindicator icons on KDE
+  - --talk-name=org.kde.StatusNotifierWatcher
+  - --talk-name=com.canonical.AppMenu.Registrar
 modules:
-  - name: yarn
-    buildsystem: simple
-    build-commands:
-      - mkdir --parents /app/share/yarn/
-      - cp --archive * /app/share/yarn/
-      - ln --symbolic /app/share/yarn/bin/yarn /app/bin/yarn
-      - ln --symbolic /app/share/yarn/bin/yarnpkg /app/bin/yarnpkg
-    cleanup:
-      - "*"
-    sources:
-      - type: archive
-        sha256: df202627d9a70cf09ef2fb11cb298cb619db1b958590959d6f6e571b50656029
-        url: https://github.com/yarnpkg/yarn/releases/download/v1.16.0/yarn-v1.16.0.tar.gz
-
   - name: pocket-casts
     buildsystem: simple
-    build-options:
-      append-path: /usr/lib/sdk/node18/bin
-      env:
-        CHROMEDRIVER_SKIP_DOWNLOAD: 'true'
-        npm_config_nodedir: '/usr/lib/sdk/node14'
-        XDG_CACHE_HOME: /run/build/pocket-casts/flatpak-node/cache
+    build-commands:
+      # Extract debian package.
+      - bsdtar --to-stdout -xf pocket-casts_*.deb data.* | bsdtar --strip-components
+        2 -xf -
+      # Copy extracted bin and data directories to the deployment location.
+      - cp -r lib/* ${FLATPAK_DEST}/lib
+      - cp -r share/* ${FLATPAK_DEST}/share
+      # Fixup upstream desktop file so it matches our metainfo.
+      - desktop-file-edit --set-key=Exec --set-value="start-pocket-casts %U" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=Icon --set-value="${FLATPAK_ID}" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=Name --set-value="Pocket Casts" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=GenericName --set-value="Pocket Casts" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=Comment --set-value="Linux desktop player for
+        Pocket Casts" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      - desktop-file-edit --set-key=Categories --set-value="AudioVideo;Audio;" $FLATPAK_DEST/share/applications/pocket-casts.desktop
+      # Cleanup pixmaps folder.
+      - rm -rf ${FLATPAK_DEST}/share/pixmaps
+      # Install upstream icon correctly.
+      - install -Dm644 icon.png ${FLATPAK_DEST}/share/icons/hicolor/512x512/apps/${FLATPAK_ID}.png
+      # Install Flatpak specific wrapper.
+      - install -Dm755 start-pocket-casts.sh ${FLATPAK_DEST}/bin/start-pocket-casts
+      # Install Flatpak specific metainfo.
+      - install -Dm644 tech.feliciano.pocket-casts.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml
     sources:
       - type: git
-        url: https://github.com/felicianotech/pocket-casts-desktop-app
-        commit: 5eab5710634aa24b958db905ed3339b39c04dc9d
-      - "generated-sources.json"
+        url: https://github.com/FelicianoTech/pocket-casts-desktop-app.git
+        tag: v0.8.0
+        commit: 06d0439647b500b0ab84566d2d9028d1cff5ede6
+        x-checker-data:
+          type: git
+          tag-pattern: ^v([\d.]+)$
+      - type: file
+        only-arches:
+          - x86_64
+        url: https://github.com/FelicianoTech/pocket-casts-desktop-app/releases/download/v0.8.0/pocket-casts_0.8.0_amd64.deb
+        sha512: aa793e2427524e45f0e445552c1da38639e177a29a15427cea0ef100ff6220c499dc22fe64d1b398eba65bdf63449a83bc125d616172abefab397c16905fff2f
+        x-checker-data:
+          type: json
+          url: https://api.github.com/repos/FelicianoTech/pocket-casts-desktop-app/releases/latest
+          version-query: .tag_name
+          url-query: .assets[] | select(.name|endswith("_amd64.deb")) | .browser_download_url
+      - type: file
+        only-arches:
+          - aarch64
+        url: https://github.com/FelicianoTech/pocket-casts-desktop-app/releases/download/v0.8.0/pocket-casts_0.8.0_arm64.deb
+        sha512: 2e68a2c0b1a21853420f3e44ff1a685fec9ca2f90e1d0f4a6b7c0eb7179270f7af26746e134527b129de4c03b040279731caaac1693a7a8cbeb7f54f85576754
+        x-checker-data:
+          type: json
+          url: https://api.github.com/repos/FelicianoTech/pocket-casts-desktop-app/releases/latest
+          version-query: .tag_name
+          url-query: .assets[] | select(.name|endswith("_arm64.deb")) | .browser_download_url
       - type: script
-        dest-filename: run.sh
+        dest-filename: start-pocket-casts.sh
         commands:
-          - /app/lib/pocket-casts/pocket-casts --no-sandbox
-      - type: patch
-        path: 0001-flatpak-Add-missing-item-in-appdata-file.patch
-        use-git-am: true
-      - type: patch
-        path: 0001-flatpak-Fix-screenshot-URL.patch
-        use-git-am: true
-    build-commands:
-      - HOME=$PWD yarn config --offline set yarn-offline-mirror $FLATPAK_BUILDER_BUILDDIR/flatpak-node/yarn-mirror
-      - yarn --offline
-      - yarn run --offline pack
-      - install -Dm 644 flatpak/tech.feliciano.pocket-casts.appdata.xml /app/share/metainfo/tech.feliciano.pocket-casts.appdata.xml
-      - install -Dm 644 flatpak/tech.feliciano.pocket-casts.desktop /app/share/applications/tech.feliciano.pocket-casts.desktop
-      - install -Dm 644 icon.png /app/share/icons/tech.feliciano.pocket-casts.png
-      - mkdir -p /app/lib/ /app/bin
-      - cp -r dist/linux-*unpacked/ /app/lib/pocket-casts/
-      - install run.sh /app/bin/
+          - export TMPDIR=$XDG_RUNTIME_DIR/app/$FLATPAK_ID
+          - WAYLAND_SOCKET=${WAYLAND_DISPLAY:-"wayland-0"}
+          - FLAGS="--password-store=gnome-libsecret"
+          - if [[ -e "$XDG_RUNTIME_DIR/${WAYLAND_SOCKET}" || -e "${WAYLAND_DISPLAY}"
+            ]]; then
+          - FLAGS="$FLAGS --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto"
+          - fi
+          - FLATPAK_HOST=1 zypak-wrapper.sh /app/lib/youtube-music-desktop-app/youtube-music-desktop-app
path: tech.feliciano.pocket-casts.yml
user: login: ProjectSynchro
body: Bad commit, wasn't aware it pushed.
created_at: 2024-09-26T08:15:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
path: tech.feliciano.pocket-casts.metainfo.xml
user: login: ProjectSynchro
body: Metainfo is not provided in the upstream package releases unfortunately. I could patch the git repository with these changes instead, I already use that source for the upstream icon. 

The package that is shipped doesn't provide the right icon either.
created_at: 2024-09-26T08:22:27Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
path: tech.feliciano.pocket-casts.metainfo.xml
user: login: hadess
body: Right, those could be things that get fixed upstream as well, or at least filed as issues upstream.

In the case of the metainfo file, it would be better to fetch the file from upstream, and apply a small patch to it locally, rather than ship a whole modified file, as that would make it harder to maintain.
created_at: 2024-09-26T09:34:44Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
path: tech.feliciano.pocket-casts.metainfo.xml
user: login: ProjectSynchro
body: Indeed, I'll open some a PR upstream shortly, the desktop file and metainfo could use some sprucing up.
created_at: 2024-09-26T10:53:30Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,10 +1,10 @@
 #!/usr/bin/env bash
 
-BRANCH=test
+BRANCH="test"
 
 rm -f tech.feliciano.pocket-casts.flatpak
-rm -rf _build ; mkdir _build
-rm -rf _repo ; mkdir _repo
+rm -rf build-dir ; mkdir build-dir
path: local-build.sh
user: login: hadess
body: I don't think those changes are necessary.
created_at: 2024-09-27T11:33:54Z
author_association: COLLABORATOR
diff_hunk: @@ -1,67 +1,83 @@
 app-id: tech.feliciano.pocket-casts
 runtime: org.freedesktop.Platform
-runtime-version: '22.08'
+runtime-version: &runtime-version '24.08'
 sdk: org.freedesktop.Sdk
-sdk-extensions:
-  - org.freedesktop.Sdk.Extension.node18
 base: org.electronjs.Electron2.BaseApp
-base-version: '22.08'
-command: run.sh
+base-version: *runtime-version
+# Add the Node 20 SDK extension.
+sdk-extensions:
+  - org.freedesktop.Sdk.Extension.node20
+command: start-pocket-casts
 separate-locales: false
 finish-args:
+  # Share IPC namespace with the host, without it the X11 shared memory extension will not work.
path: tech.feliciano.pocket-casts.yml
user: login: hadess
body: Can you make the changes related to documenting the finish args as a separate commit? This would make the runtime update specific changes clearer.
created_at: 2024-09-27T11:37:16Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,98 @@
+--- a/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:18:40.151643139 -0400
++++ b/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:19:23.269545738 -0400
+@@ -1,31 +1,80 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<component type="desktop">
++<component type="desktop-application">
+   <id>tech.feliciano.pocket-casts</id>
+-  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <name>Pocket Casts</name>
++  <summary>Linux desktop player for Pocket Casts</summary>
+   <developer_name>Ricardo N Feliciano</developer_name>
+-  <summary>Online podcast player</summary>
path: 001-update-metainfo.patch
user: login: hadess
body: Why the summary change?
created_at: 2024-09-27T11:39:12Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,98 @@
+--- a/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:18:40.151643139 -0400
++++ b/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:19:23.269545738 -0400
+@@ -1,31 +1,80 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<component type="desktop">
++<component type="desktop-application">
+   <id>tech.feliciano.pocket-casts</id>
+-  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <name>Pocket Casts</name>
++  <summary>Linux desktop player for Pocket Casts</summary>
+   <developer_name>Ricardo N Feliciano</developer_name>
+-  <summary>Online podcast player</summary>
++
++  <url type="homepage">https://github.com/FelicianoTech/pocket-casts-desktop-app</url>
++  <!-- Update the bugtracker link to upstream bugtracker when/if this Flatpak is verified -->
++  <url type="bugtracker">https://github.com/flathub/tech.feliciano.pocket-casts/issues</url>
++
+   <metadata_license>MIT</metadata_license>
+   <project_license>MIT</project_license>
+-  <url type="homepage">https://www.pocketcasts.com/</url>
++
++  <content_rating type="oars-1.1"/>
++
++  <recommends>
++    <control>pointing</control>
++    <control>keyboard</control>
++    <control>touch</control>
++  </recommends>
++
+   <description>
+-    <p>Pocket Casts is the world's most powerful podcast player. It's a great app to discover and listen to your favorite podcasts. Many blogs have deemed Pocket Casts the best podcatcher around.</p>
+-    <p>This is an Electron wrapper around the Pocket Casts web player. You need to have a pre-existing Pocket Casts account (it's cheap and worth the money) to use this app</p>
+-    <p>This wrapper is not verified by, affiliated with, or supported by Pocket Casts or Podcast Media LLC.</p>
++    <p>
++      Pocket Casts is the world's most powerful podcast player. It's a great app to discover and listen to your favorite podcasts. Many blogs have deemed Pocket Casts the best podcatcher around.
++      This is an Electron wrapper around the Pocket Casts web player. You need to have a pre-existing Pocket Casts account (it's cheap and worth the money) to use this app.
++      This wrapper is not verified by, affiliated with, or supported by Pocket Casts or Podcast Media LLC.
++    </p>
+   </description>
++
++  <categories>
++    <category>AudioVideo</category>
++    <category>Utility</category>
++  </categories>
++
++  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <screenshots>
+     <screenshot type="default">
+-      <image type="source">https://raw.githubusercontent.com/felicianotech/pocket-casts-desktop-app/trunk/screenshot.png</image>
++      <caption>A screenshot of the main interface</caption>
++      <image>https://raw.githubusercontent.com/felicianotech/pocket-casts-desktop-app/v0.8.0/screenshot.png</image>
path: 001-update-metainfo.patch
user: login: hadess
body: This screenshot isn't suitable, please revert.

Those are the guidelines in case you're interested in updating the screenshot:
https://docs.flathub.org/docs/for-app-authors/metainfo-guidelines/quality-guidelines#screenshots
created_at: 2024-09-27T11:41:03Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,98 @@
+--- a/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:18:40.151643139 -0400
++++ b/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:19:23.269545738 -0400
+@@ -1,31 +1,80 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<component type="desktop">
++<component type="desktop-application">
+   <id>tech.feliciano.pocket-casts</id>
+-  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <name>Pocket Casts</name>
++  <summary>Linux desktop player for Pocket Casts</summary>
+   <developer_name>Ricardo N Feliciano</developer_name>
+-  <summary>Online podcast player</summary>
++
++  <url type="homepage">https://github.com/FelicianoTech/pocket-casts-desktop-app</url>
++  <!-- Update the bugtracker link to upstream bugtracker when/if this Flatpak is verified -->
++  <url type="bugtracker">https://github.com/flathub/tech.feliciano.pocket-casts/issues</url>
++
+   <metadata_license>MIT</metadata_license>
+   <project_license>MIT</project_license>
+-  <url type="homepage">https://www.pocketcasts.com/</url>
++
++  <content_rating type="oars-1.1"/>
++
++  <recommends>
++    <control>pointing</control>
++    <control>keyboard</control>
++    <control>touch</control>
++  </recommends>
++
+   <description>
+-    <p>Pocket Casts is the world's most powerful podcast player. It's a great app to discover and listen to your favorite podcasts. Many blogs have deemed Pocket Casts the best podcatcher around.</p>
+-    <p>This is an Electron wrapper around the Pocket Casts web player. You need to have a pre-existing Pocket Casts account (it's cheap and worth the money) to use this app</p>
+-    <p>This wrapper is not verified by, affiliated with, or supported by Pocket Casts or Podcast Media LLC.</p>
++    <p>
++      Pocket Casts is the world's most powerful podcast player. It's a great app to discover and listen to your favorite podcasts. Many blogs have deemed Pocket Casts the best podcatcher around.
++      This is an Electron wrapper around the Pocket Casts web player. You need to have a pre-existing Pocket Casts account (it's cheap and worth the money) to use this app.
++      This wrapper is not verified by, affiliated with, or supported by Pocket Casts or Podcast Media LLC.
++    </p>
+   </description>
++
++  <categories>
++    <category>AudioVideo</category>
++    <category>Utility</category>
++  </categories>
++
++  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <screenshots>
+     <screenshot type="default">
+-      <image type="source">https://raw.githubusercontent.com/felicianotech/pocket-casts-desktop-app/trunk/screenshot.png</image>
++      <caption>A screenshot of the main interface</caption>
++      <image>https://raw.githubusercontent.com/felicianotech/pocket-casts-desktop-app/v0.8.0/screenshot.png</image>
+     </screenshot>
+   </screenshots>
+-  <content_rating type="oars-1.1" />
+   <releases>
+-    <release version="0.5.0" date="2020-12-13">
path: 001-update-metainfo.patch
user: login: hadess
body: Why remove this metadata?
created_at: 2024-09-27T11:41:31Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,22 @@
+## Flatpak for Pocket Casts
 
-## Updating the package
+#### Check out the upstream project here: https://github.com/FelicianoTech/pocket-casts-desktop-app
 
-Using [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools):
-```
-../flatpak-builder-tools/node/flatpak-node-generator.py --xdg-layout yarn /tmp/pocket-casts-desktop-app/yarn.lock
-```
+### Build the Flatpak locally
+1. Clone this repo
+2. Install the flatpak-builder package for your distro
+3. Install FreeDesktop SDK and Runtime, as well as the Electron BaseApp
path: README.md
user: login: hadess
body: Maybe making the script check for missing runtimes would be better?

I've done this in https://github.com/flathub/org.ghidra_sre.Ghidra/blob/master/generate-deps.sh#L15

So you could remove step 3 and have step 4 say something like:
If necessary SDKs are missing, the script will error out and prompt you to install those.
created_at: 2024-09-27T11:44:56Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,22 @@
+## Flatpak for Pocket Casts
 
-## Updating the package
+#### Check out the upstream project here: https://github.com/FelicianoTech/pocket-casts-desktop-app
 
-Using [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools):
-```
-../flatpak-builder-tools/node/flatpak-node-generator.py --xdg-layout yarn /tmp/pocket-casts-desktop-app/yarn.lock
-```
+### Build the Flatpak locally
+1. Clone this repo
+2. Install the flatpak-builder package for your distro
+3. Install FreeDesktop SDK and Runtime, as well as the Electron BaseApp
+   * `flatpak install org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08 org.freedesktop.Sdk.Extension.node20//24.08 org.electronjs.Electron2.BaseApp//24.08`
+4. Build the Flatpak locally with: `./local-build.sh`
+5. Install the test build with: `flatpak install ./tech.feliciano.pocket-casts.flatpak`
+
+### Getting NPM generated sources manually
+1. Install pipx for your distro
+2. Clone this repo
+3. Initialize the flatpak-builder-tools submodule:
+   * `git submodule update --init`
+3. Install flatpak-node-generator with:
+   * `pipx install flatpak-builder-tools/node`
+4. Download the latest package-lock.json from the upstream repository
path: README.md
user: login: hadess
body: Maybe you could add a copy/paste command for that too? Using curl or wget would be fine.
created_at: 2024-09-27T11:45:56Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,98 @@
+--- a/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:18:40.151643139 -0400
++++ b/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:19:23.269545738 -0400
+@@ -1,31 +1,80 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<component type="desktop">
++<component type="desktop-application">
+   <id>tech.feliciano.pocket-casts</id>
+-  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <name>Pocket Casts</name>
++  <summary>Linux desktop player for Pocket Casts</summary>
+   <developer_name>Ricardo N Feliciano</developer_name>
+-  <summary>Online podcast player</summary>
++
++  <url type="homepage">https://github.com/FelicianoTech/pocket-casts-desktop-app</url>
++  <!-- Update the bugtracker link to upstream bugtracker when/if this Flatpak is verified -->
++  <url type="bugtracker">https://github.com/flathub/tech.feliciano.pocket-casts/issues</url>
++
+   <metadata_license>MIT</metadata_license>
+   <project_license>MIT</project_license>
+-  <url type="homepage">https://www.pocketcasts.com/</url>
++
++  <content_rating type="oars-1.1"/>
++
++  <recommends>
++    <control>pointing</control>
++    <control>keyboard</control>
++    <control>touch</control>
++  </recommends>
++
+   <description>
+-    <p>Pocket Casts is the world's most powerful podcast player. It's a great app to discover and listen to your favorite podcasts. Many blogs have deemed Pocket Casts the best podcatcher around.</p>
+-    <p>This is an Electron wrapper around the Pocket Casts web player. You need to have a pre-existing Pocket Casts account (it's cheap and worth the money) to use this app</p>
+-    <p>This wrapper is not verified by, affiliated with, or supported by Pocket Casts or Podcast Media LLC.</p>
++    <p>
++      Pocket Casts is the world's most powerful podcast player. It's a great app to discover and listen to your favorite podcasts. Many blogs have deemed Pocket Casts the best podcatcher around.
++      This is an Electron wrapper around the Pocket Casts web player. You need to have a pre-existing Pocket Casts account (it's cheap and worth the money) to use this app.
++      This wrapper is not verified by, affiliated with, or supported by Pocket Casts or Podcast Media LLC.
++    </p>
+   </description>
++
++  <categories>
++    <category>AudioVideo</category>
++    <category>Utility</category>
++  </categories>
++
++  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <screenshots>
+     <screenshot type="default">
+-      <image type="source">https://raw.githubusercontent.com/felicianotech/pocket-casts-desktop-app/trunk/screenshot.png</image>
++      <caption>A screenshot of the main interface</caption>
++      <image>https://raw.githubusercontent.com/felicianotech/pocket-casts-desktop-app/v0.8.0/screenshot.png</image>
path: 001-update-metainfo.patch
user: login: ProjectSynchro
body: I see, I had just continued to use the upstream metainfo's screenshot. 

Didn't really want to change it but I'll take some screenshots and stick them in the repo here instead.
created_at: 2024-09-27T16:13:50Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,98 @@
+--- a/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:18:40.151643139 -0400
++++ b/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:19:23.269545738 -0400
+@@ -1,31 +1,80 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<component type="desktop">
++<component type="desktop-application">
+   <id>tech.feliciano.pocket-casts</id>
+-  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <name>Pocket Casts</name>
++  <summary>Linux desktop player for Pocket Casts</summary>
+   <developer_name>Ricardo N Feliciano</developer_name>
+-  <summary>Online podcast player</summary>
++
++  <url type="homepage">https://github.com/FelicianoTech/pocket-casts-desktop-app</url>
++  <!-- Update the bugtracker link to upstream bugtracker when/if this Flatpak is verified -->
++  <url type="bugtracker">https://github.com/flathub/tech.feliciano.pocket-casts/issues</url>
++
+   <metadata_license>MIT</metadata_license>
+   <project_license>MIT</project_license>
+-  <url type="homepage">https://www.pocketcasts.com/</url>
++
++  <content_rating type="oars-1.1"/>
++
++  <recommends>
++    <control>pointing</control>
++    <control>keyboard</control>
++    <control>touch</control>
++  </recommends>
++
+   <description>
+-    <p>Pocket Casts is the world's most powerful podcast player. It's a great app to discover and listen to your favorite podcasts. Many blogs have deemed Pocket Casts the best podcatcher around.</p>
+-    <p>This is an Electron wrapper around the Pocket Casts web player. You need to have a pre-existing Pocket Casts account (it's cheap and worth the money) to use this app</p>
+-    <p>This wrapper is not verified by, affiliated with, or supported by Pocket Casts or Podcast Media LLC.</p>
++    <p>
++      Pocket Casts is the world's most powerful podcast player. It's a great app to discover and listen to your favorite podcasts. Many blogs have deemed Pocket Casts the best podcatcher around.
++      This is an Electron wrapper around the Pocket Casts web player. You need to have a pre-existing Pocket Casts account (it's cheap and worth the money) to use this app.
++      This wrapper is not verified by, affiliated with, or supported by Pocket Casts or Podcast Media LLC.
++    </p>
+   </description>
++
++  <categories>
++    <category>AudioVideo</category>
++    <category>Utility</category>
++  </categories>
++
++  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <screenshots>
+     <screenshot type="default">
+-      <image type="source">https://raw.githubusercontent.com/felicianotech/pocket-casts-desktop-app/trunk/screenshot.png</image>
++      <caption>A screenshot of the main interface</caption>
++      <image>https://raw.githubusercontent.com/felicianotech/pocket-casts-desktop-app/v0.8.0/screenshot.png</image>
+     </screenshot>
+   </screenshots>
+-  <content_rating type="oars-1.1" />
+   <releases>
+-    <release version="0.5.0" date="2020-12-13">
path: 001-update-metainfo.patch
user: login: ProjectSynchro
body: Mainly for consistency and maintenance sake. (there were some formatting changes too so those lines were removed but re-added later in the diff. 

It's far simpler to just point to the github release for each of the releases. The upstream developer could change the information to include additional information, or in the case of v0.8.0 the release notes just point to additional links to github PRs. 

Some past releases don't have any changelogs at all.
created_at: 2024-09-27T16:16:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,7 +1,22 @@
+## Flatpak for Pocket Casts
 
-## Updating the package
+#### Check out the upstream project here: https://github.com/FelicianoTech/pocket-casts-desktop-app
 
-Using [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools):
-```
-../flatpak-builder-tools/node/flatpak-node-generator.py --xdg-layout yarn /tmp/pocket-casts-desktop-app/yarn.lock
-```
+### Build the Flatpak locally
+1. Clone this repo
+2. Install the flatpak-builder package for your distro
+3. Install FreeDesktop SDK and Runtime, as well as the Electron BaseApp
path: README.md
user: login: ProjectSynchro
body: I was thinking about doing that so the workflow can reference it too. That should be pretty doable.
created_at: 2024-09-27T16:19:24Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,7 +1,22 @@
+## Flatpak for Pocket Casts
 
-## Updating the package
+#### Check out the upstream project here: https://github.com/FelicianoTech/pocket-casts-desktop-app
 
-Using [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools):
-```
-../flatpak-builder-tools/node/flatpak-node-generator.py --xdg-layout yarn /tmp/pocket-casts-desktop-app/yarn.lock
-```
+### Build the Flatpak locally
+1. Clone this repo
+2. Install the flatpak-builder package for your distro
+3. Install FreeDesktop SDK and Runtime, as well as the Electron BaseApp
+   * `flatpak install org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08 org.freedesktop.Sdk.Extension.node20//24.08 org.electronjs.Electron2.BaseApp//24.08`
+4. Build the Flatpak locally with: `./local-build.sh`
+5. Install the test build with: `flatpak install ./tech.feliciano.pocket-casts.flatpak`
+
+### Getting NPM generated sources manually
+1. Install pipx for your distro
+2. Clone this repo
+3. Initialize the flatpak-builder-tools submodule:
+   * `git submodule update --init`
+3. Install flatpak-node-generator with:
+   * `pipx install flatpak-builder-tools/node`
+4. Download the latest package-lock.json from the upstream repository
path: README.md
user: login: ProjectSynchro
body: Sure, seems simple enough :)
created_at: 2024-09-27T16:19:39Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,98 @@
+--- a/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:18:40.151643139 -0400
++++ b/flatpak/tech.feliciano.pocket-casts.appdata.xml	2024-09-26 04:19:23.269545738 -0400
+@@ -1,31 +1,80 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<component type="desktop">
++<component type="desktop-application">
+   <id>tech.feliciano.pocket-casts</id>
+-  <launchable type="desktop-id">tech.feliciano.pocket-casts.desktop</launchable>
++
+   <name>Pocket Casts</name>
++  <summary>Linux desktop player for Pocket Casts</summary>
+   <developer_name>Ricardo N Feliciano</developer_name>
+-  <summary>Online podcast player</summary>
path: 001-update-metainfo.patch
user: login: ProjectSynchro
body: I initially was thinking I would change it to be more descriptive. Looking now: https://docs.flathub.org/docs/for-app-authors/metainfo-guidelines/quality-guidelines#summary might not want to do that.

It may also be worth it to copy what is used for the snap for consistency's sake: https://github.com/FelicianoTech/pocket-casts-desktop-app/blob/06d0439647b500b0ab84566d2d9028d1cff5ede6/package.json#L45

Main issue with that is it may not work out to be totally within the quality guidelines.
created_at: 2024-09-27T16:26:11Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,10 +1,10 @@
 #!/usr/bin/env bash
 
-BRANCH=test
+BRANCH="test"
 
 rm -f tech.feliciano.pocket-casts.flatpak
-rm -rf _build ; mkdir _build
-rm -rf _repo ; mkdir _repo
+rm -rf build-dir ; mkdir build-dir
path: local-build.sh
user: login: ProjectSynchro
body: I tend to use `build-dir` myself but I can revert these changes.
created_at: 2024-09-27T16:28:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,67 +1,83 @@
 app-id: tech.feliciano.pocket-casts
 runtime: org.freedesktop.Platform
-runtime-version: '22.08'
+runtime-version: &runtime-version '24.08'
 sdk: org.freedesktop.Sdk
-sdk-extensions:
-  - org.freedesktop.Sdk.Extension.node18
 base: org.electronjs.Electron2.BaseApp
-base-version: '22.08'
-command: run.sh
+base-version: *runtime-version
+# Add the Node 20 SDK extension.
+sdk-extensions:
+  - org.freedesktop.Sdk.Extension.node20
+command: start-pocket-casts
 separate-locales: false
 finish-args:
+  # Share IPC namespace with the host, without it the X11 shared memory extension will not work.
path: tech.feliciano.pocket-casts.yml
user: login: ProjectSynchro
body: Sure, I can do that.
created_at: 2024-09-27T17:20:55Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,7 +1,22 @@
+## Flatpak for Pocket Casts
 
-## Updating the package
+#### Check out the upstream project here: https://github.com/FelicianoTech/pocket-casts-desktop-app
 
-Using [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools):
-```
-../flatpak-builder-tools/node/flatpak-node-generator.py --xdg-layout yarn /tmp/pocket-casts-desktop-app/yarn.lock
-```
+### Build the Flatpak locally
+1. Clone this repo
+2. Install the flatpak-builder package for your distro
+3. Install FreeDesktop SDK and Runtime, as well as the Electron BaseApp
+   * `flatpak install org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08 org.freedesktop.Sdk.Extension.node20//24.08 org.electronjs.Electron2.BaseApp//24.08`
+4. Build the Flatpak locally with: `./local-build.sh`
+5. Install the test build with: `flatpak install ./tech.feliciano.pocket-casts.flatpak`
+
+### Getting NPM generated sources manually
+1. Install pipx for your distro
+2. Clone this repo
+3. Initialize the flatpak-builder-tools submodule:
+   * `git submodule update --init`
+3. Install flatpak-node-generator with:
+   * `pipx install flatpak-builder-tools/node`
+4. Download the latest package-lock.json from the upstream repository
path: README.md
user: login: ProjectSynchro
body: I implemented this in a script (generate_deps.sh)
https://github.com/ProjectSynchro/tech.feliciano.pocket-casts/commit/055a8924aded5588be28131962bc9e227fd96f7a
created_at: 2024-10-09T16:31:50Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,7 +1,22 @@
+## Flatpak for Pocket Casts
 
-## Updating the package
+#### Check out the upstream project here: https://github.com/FelicianoTech/pocket-casts-desktop-app
 
-Using [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools):
-```
-../flatpak-builder-tools/node/flatpak-node-generator.py --xdg-layout yarn /tmp/pocket-casts-desktop-app/yarn.lock
-```
+### Build the Flatpak locally
+1. Clone this repo
+2. Install the flatpak-builder package for your distro
+3. Install FreeDesktop SDK and Runtime, as well as the Electron BaseApp
path: README.md
user: login: ProjectSynchro
body: Implemented this in local-build.sh

https://github.com/ProjectSynchro/tech.feliciano.pocket-casts/commit/e53d0a71852fdb9ee658a1d8ad7d40906b07996c
created_at: 2024-10-09T16:32:37Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,10 +1,70 @@
 #!/usr/bin/env bash
 
+set -e  # Exit immediately if a command exits with a non-zero status
+
 BRANCH="test"
 
+# Function to print error messages
+error() {
+    echo "Error: $1" >&2
+    exit 1
+}
+
+# Function to check if a command exists
+check_command() {
+    local cmd="$1"
+    if ! command -v "$cmd" &> /dev/null; then
+        error "$cmd is not installed. Please install $cmd and try again."
+    fi
+    echo "$cmd is installed."
+}
+
+# Check if flatpak is installed
+check_command "flatpak"
+
+# Check if flatpak-builder is installed
+check_command "flatpak-builder"
+
+# Define required Flatpak packages
+REQUIRED_FLATPAK_PACKAGES=(
+    "org.freedesktop.Platform//24.08"
+    "org.freedesktop.Sdk//24.08"
+    "org.freedesktop.Sdk.Extension.node20//24.08"
+    "org.electronjs.Electron2.BaseApp//24.08"
+)
+
+# Function to check if a Flatpak package is installed
+is_flatpak_installed() {
+    local package="$1"
+    flatpak info "$package" &> /dev/null
+}
+
+# Install missing Flatpak packages
+for package in "${REQUIRED_FLATPAK_PACKAGES[@]}"; do
+    if is_flatpak_installed "$package"; then
+        echo "Flatpak package '$package' is already installed."
+    else
+        echo "Flatpak package '$package' is not installed. Installing..."
+        flatpak install -y flathub "$package" || error "Failed to install $package"
+    fi
+done
+
+# Update Flatpak repositories
+echo "Updating Flatpak repositories..."
+flatpak update -y || error "Failed to update Flatpak repositories"
+
+# Clean previous build artifacts
+echo "Cleaning previous build artifacts..."
 rm -f tech.feliciano.pocket-casts.flatpak
-rm -rf _build ; mkdir _build
-rm -rf _repo ; mkdir _repo
+rm -rf _build _repo
+mkdir _build _repo
path: local-build.sh
user: login: hadess
body: The directories will be re-created, that can be removed.
created_at: 2024-10-09T16:50:09Z
author_association: COLLABORATOR
diff_hunk: @@ -1,10 +1,70 @@
 #!/usr/bin/env bash
 
+set -e  # Exit immediately if a command exits with a non-zero status
+
 BRANCH="test"
 
+# Function to print error messages
+error() {
+    echo "Error: $1" >&2
+    exit 1
+}
+
+# Function to check if a command exists
+check_command() {
+    local cmd="$1"
+    if ! command -v "$cmd" &> /dev/null; then
+        error "$cmd is not installed. Please install $cmd and try again."
+    fi
+    echo "$cmd is installed."
+}
+
+# Check if flatpak is installed
+check_command "flatpak"
+
+# Check if flatpak-builder is installed
+check_command "flatpak-builder"
+
+# Define required Flatpak packages
+REQUIRED_FLATPAK_PACKAGES=(
+    "org.freedesktop.Platform//24.08"
+    "org.freedesktop.Sdk//24.08"
+    "org.freedesktop.Sdk.Extension.node20//24.08"
+    "org.electronjs.Electron2.BaseApp//24.08"
+)
+
+# Function to check if a Flatpak package is installed
+is_flatpak_installed() {
+    local package="$1"
+    flatpak info "$package" &> /dev/null
+}
+
+# Install missing Flatpak packages
+for package in "${REQUIRED_FLATPAK_PACKAGES[@]}"; do
+    if is_flatpak_installed "$package"; then
+        echo "Flatpak package '$package' is already installed."
+    else
+        echo "Flatpak package '$package' is not installed. Installing..."
+        flatpak install -y flathub "$package" || error "Failed to install $package"
+    fi
+done
+
+# Update Flatpak repositories
+echo "Updating Flatpak repositories..."
+flatpak update -y || error "Failed to update Flatpak repositories"
+
+# Clean previous build artifacts
+echo "Cleaning previous build artifacts..."
 rm -f tech.feliciano.pocket-casts.flatpak
-rm -rf _build ; mkdir _build
-rm -rf _repo ; mkdir _repo
+rm -rf _build _repo
+mkdir _build _repo
path: local-build.sh
user: login: hadess
body: That review is still relevant, you can remove the `mkdir` calls.
created_at: 2025-04-22T14:55:40Z
author_association: COLLABORATOR
diff_hunk: @@ -1,10 +1,70 @@
 #!/usr/bin/env bash
 
+set -e  # Exit immediately if a command exits with a non-zero status
+
 BRANCH="test"
 
+# Function to print error messages
+error() {
+    echo "Error: $1" >&2
+    exit 1
+}
+
+# Function to check if a command exists
+check_command() {
+    local cmd="$1"
+    if ! command -v "$cmd" &> /dev/null; then
+        error "$cmd is not installed. Please install $cmd and try again."
+    fi
+    echo "$cmd is installed."
+}
+
+# Check if flatpak is installed
+check_command "flatpak"
+
+# Check if flatpak-builder is installed
+check_command "flatpak-builder"
+
+# Define required Flatpak packages
+REQUIRED_FLATPAK_PACKAGES=(
+    "org.freedesktop.Platform//24.08"
+    "org.freedesktop.Sdk//24.08"
+    "org.freedesktop.Sdk.Extension.node20//24.08"
+    "org.electronjs.Electron2.BaseApp//24.08"
+)
+
+# Function to check if a Flatpak package is installed
+is_flatpak_installed() {
+    local package="$1"
+    flatpak info "$package" &> /dev/null
+}
+
+# Install missing Flatpak packages
+for package in "${REQUIRED_FLATPAK_PACKAGES[@]}"; do
+    if is_flatpak_installed "$package"; then
+        echo "Flatpak package '$package' is already installed."
+    else
+        echo "Flatpak package '$package' is not installed. Installing..."
+        flatpak install -y flathub "$package" || error "Failed to install $package"
+    fi
+done
+
+# Update Flatpak repositories
+echo "Updating Flatpak repositories..."
+flatpak update -y || error "Failed to update Flatpak repositories"
+
+# Clean previous build artifacts
+echo "Cleaning previous build artifacts..."
 rm -f tech.feliciano.pocket-casts.flatpak
-rm -rf _build ; mkdir _build
-rm -rf _repo ; mkdir _repo
+rm -rf _build _repo
+mkdir _build _repo
path: local-build.sh
user: login: ProjectSynchro
body: Ah I can open a PR to fix this if you want this adjusted, must have skipped my mind.
created_at: 2025-04-24T14:34:01Z
author_association: CONTRIBUTOR

PR comments:
user: login: flathubbot
created_at: 2024-09-26T02:30:11Z
body: Started [test build 149656](https://buildbot.flathub.org/#/builders/6/builds/149656)
author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T02:46:35Z
body: Build [149656 successful](https://buildbot.flathub.org/#/builders/6/builds/149656)
To test this build, install it from the testing repository:
```
flatpak install --user https://dl.flathub.org/build-repo/132751/tech.feliciano.pocket-casts.flatpakref
```

author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T02:48:48Z
body: Started [test build 149657](https://buildbot.flathub.org/#/builders/6/builds/149657)
author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T03:05:15Z
body: Build [149657 successful](https://buildbot.flathub.org/#/builders/6/builds/149657)
To test this build, install it from the testing repository:
```
flatpak install --user https://dl.flathub.org/build-repo/132752/tech.feliciano.pocket-casts.flatpakref
```

author_association: NONE
user: login: hadess
created_at: 2024-09-26T07:30:30Z
body: > This changes this flatpak to be built from existing binaries. This is mainly due to the difficulty/feasibility behind building using electron-forge offline as well as the lack of support for v3 npm lockfiles in [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools).

I'll let @FelicianoTech figure out whether this is acceptable. In my opinion, this should be worked on (or at least attempted to be worked on) upstream so that the package keeps being built from source.

I should also note that the commits don't seem to be organised correctly, the package should still be building after each commit...
author_association: COLLABORATOR
user: login: flathubbot
created_at: 2024-09-26T08:12:24Z
body: Started [test build 149691](https://buildbot.flathub.org/#/builders/6/builds/149691)
author_association: NONE
user: login: ProjectSynchro
created_at: 2024-09-26T08:13:41Z
body: > I should also note that the commits don't seem to be organised correctly, the package should still be building after each commit...

Seems like my changes didn't get correctly applied, force pushed so they are in the correct order, as well as removed some bad commits.


author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2024-09-26T08:21:47Z
body: Build [149691 failed](https://buildbot.flathub.org/#/builders/6/builds/149691)

author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T08:24:01Z
body: Started [test build 149694](https://buildbot.flathub.org/#/builders/6/builds/149694)
author_association: NONE
user: login: ProjectSynchro
created_at: 2024-09-26T08:31:59Z
body: I'm going to mark this as a draft, I may be able to get this to build from source after all.
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2024-09-26T08:42:45Z
body: Build [149694 successful](https://buildbot.flathub.org/#/builders/6/builds/149694)
To test this build, install it from the testing repository:
```
flatpak install --user https://dl.flathub.org/build-repo/132789/tech.feliciano.pocket-casts.flatpakref
```

author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T10:48:43Z
body: Started [test build 149716](https://buildbot.flathub.org/#/builders/6/builds/149716)
author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T10:59:19Z
body: Build [149716 failed](https://buildbot.flathub.org/#/builders/6/builds/149716)

author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T11:01:45Z
body: Started [test build 149719](https://buildbot.flathub.org/#/builders/6/builds/149719)
author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T11:23:41Z
body: Build [149719 failed](https://buildbot.flathub.org/#/builders/6/builds/149719)

author_association: NONE
user: login: ProjectSynchro
created_at: 2024-09-26T11:24:18Z
body: bot, build
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2024-09-26T11:24:21Z
body: Queued test build for tech.feliciano.pocket-casts.
author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T11:26:03Z
body: Started [test build 149722](https://buildbot.flathub.org/#/builders/6/builds/149722)
author_association: NONE
user: login: ProjectSynchro
created_at: 2024-09-26T11:29:45Z
body: Okay, round two.

I have figured out how to get source builds working again, and have bumped every dependency I could to the newest that is supported (FreeDesktop, Node).

Additionally I have a solution for managing automatic updates. 

Normally if you aren't building a node app you can use [flatpak-external-data-checker](https://github.com/flathub-infra/flatpak-external-data-checker) and it will bump the manifest and metainfo automatically (the metainfo is handy if there isn't anything upstream, mainly just adds a placeholder version tag though)

With node however we need to generate the NPM cache so the build works while offline. I implemented a Github Actions workflow that will update the generated-sources.json alongside any external-data-checker checks. 

The external data checker will then create a PR for the update (if there is one) which gets test built by CI and then can be merged by maintainers if it works correctly.

Let me know if you'd like any changes. I'm pretty sure the commits can be built cleanly as you had mentioned you'd like it to be that way.
author_association: CONTRIBUTOR
user: login: ProjectSynchro
created_at: 2024-09-26T11:35:12Z
body: Some additional context on the Github Actions workflow:

It uses the docker based action provided by flathub, so external dependency-wise that is the only one, actions/checkout is maintained by Github and doesn't pose any issues in terms of maintainability.

Essentially the workflow checks with the external data checker if there is an update in an edit only mode, I then use git to check if there is any changes to files. 

If there is, we get the latest upstream tagged release's `package.json` and `package-lock.json` and run `flatpak-node-generator` to get our `generated-sources.json`. 

From there the git repository has the manifest file reset and the external data checker is called again in merge mode (which opens a PR with changes) that will open the PR with the manifest updates and the `generated-sources.json` updates.

Hopefully that helps outline what the workflow does.
author_association: CONTRIBUTOR
user: login: ProjectSynchro
created_at: 2024-09-26T11:38:39Z
body: Still TODO, open a PR upstream with the metainfo and desktop file changes so we can get rid of the patches eventually.
author_association: CONTRIBUTOR
user: login: ProjectSynchro
created_at: 2024-09-26T11:44:53Z
body: bot, build
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2024-09-26T11:44:56Z
body: Queued test build for tech.feliciano.pocket-casts.
author_association: NONE
user: login: ProjectSynchro
created_at: 2024-09-26T11:45:11Z
body: Fixed a stray command. Build [149722](https://buildbot.flathub.org/#/builders/6/builds/149722) will fail but the next one should be good now.
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2024-09-26T11:48:55Z
body: Build [149722 failed](https://buildbot.flathub.org/#/builders/6/builds/149722)

author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T11:51:16Z
body: Started [test build 149727](https://buildbot.flathub.org/#/builders/6/builds/149727)
author_association: NONE
user: login: flathubbot
created_at: 2024-09-26T12:11:27Z
body: Build [149727 successful](https://buildbot.flathub.org/#/builders/6/builds/149727)
To test this build, install it from the testing repository:
```
flatpak install --user https://dl.flathub.org/build-repo/132822/tech.feliciano.pocket-casts.flatpakref
```

author_association: NONE
user: login: ProjectSynchro
created_at: 2024-09-27T16:30:09Z
body: > I have no idea about the implications of using GitHub actions, it's something that "somebody" (you or I, or anybody else that might be reading this) would need to research.
> 
> I'm happy to commit the rest of the commits after the review changes are applied, if you want to put the GitHub actions changes in a separate PR.

I can do that. I have tested it on my fork already and it seems to work well.

See here for a PR example: https://github.com/ProjectSynchro/tech.feliciano.pocket-casts/pull/3

And See the worflow run here: https://github.com/ProjectSynchro/tech.feliciano.pocket-casts/actions/runs/11058580552/job/30724922447
author_association: CONTRIBUTOR
user: login: hadess
created_at: 2024-10-08T19:20:58Z
body: I've reordered and merged most of the necessary changes for the build in https://github.com/flathub/tech.feliciano.pocket-casts/pull/10

You can remove `Bump FreeDesktop Runtime to 24.08, bump node to node20` from this and keep only the dependency automation to avoid opening a new PR.

The appdata and desktop file changes will definitely have to go through upstream, rather than the very large changes in this PR.
author_association: COLLABORATOR
user: login: ProjectSynchro
created_at: 2024-10-09T15:21:40Z
body: Apologies, got swamped with work.

I'll clean this up to just include the workflow commits and changes.
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2024-10-09T15:43:55Z
body: Started [test build 152945](https://buildbot.flathub.org/#/builders/6/builds/152945)
author_association: NONE
user: login: ProjectSynchro
created_at: 2024-10-09T15:52:10Z
body: Not quite sure why Github closed this, oh well.

I'll set it as a draft for now.
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2024-10-09T15:52:36Z
body: Build [152945 failed](https://buildbot.flathub.org/#/builders/6/builds/152945)

author_association: NONE
user: login: flathubbot
created_at: 2024-10-09T16:02:18Z
body: Started [test build 152956](https://buildbot.flathub.org/#/builders/6/builds/152956)
author_association: NONE
user: login: flathubbot
created_at: 2024-10-09T16:22:20Z
body: Build [152956 successful](https://buildbot.flathub.org/#/builders/6/builds/152956)
To test this build, install it from the testing repository:
```
flatpak install --user https://dl.flathub.org/build-repo/136040/tech.feliciano.pocket-casts.flatpakref
```

author_association: NONE
user: login: ProjectSynchro
created_at: 2024-10-09T16:33:21Z
body: Ready to go now. 
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2024-10-09T16:40:38Z
body: Started [test build 152965](https://buildbot.flathub.org/#/builders/6/builds/152965)
author_association: NONE
user: login: flathubbot
created_at: 2024-10-09T16:54:24Z
body: Build [152965 successful](https://buildbot.flathub.org/#/builders/6/builds/152965)
To test this build, install it from the testing repository:
```
flatpak install --user https://dl.flathub.org/build-repo/136049/tech.feliciano.pocket-casts.flatpakref
```

author_association: NONE
user: login: hadess
created_at: 2024-10-09T17:10:35Z
body: > I have no idea about the implications of using GitHub actions, it's something that "somebody" (you or I, or anybody else that might be reading this) would need to research.

Discussion is here:
https://discourse.flathub.org/t/using-github-actions-workflow-to-update-deps/7816
author_association: COLLABORATOR
user: login: flathubbot
created_at: 2025-04-04T10:24:08Z
body: Started [test build 191603](https://buildbot.flathub.org/#/builders/6/builds/191603)
author_association: NONE
user: login: hadess
created_at: 2025-04-04T10:25:28Z
body: I've rebased this, but it still needs changes as the app has slightly changed, and we need to apply some manual changes on top of the current codebase to make it build. The dependency generator is also still broken upstream.

See https://github.com/flathub/tech.feliciano.pocket-casts/pull/15
author_association: COLLABORATOR
user: login: flathubbot
created_at: 2025-04-04T11:35:35Z
body: Build [191603 successful](https://buildbot.flathub.org/#/builders/6/builds/191603)
To test this build, install it from the testing repository:
```
flatpak install --user https://dl.flathub.org/build-repo/174880/tech.feliciano.pocket-casts.flatpakref
```

author_association: NONE
user: login: ProjectSynchro
created_at: 2025-04-19T10:23:54Z
body: I'll take a look at this again and see if I can get it mergable.
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2025-04-19T10:45:11Z
body: 🚧 Test build enqueued.
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T10:45:25Z
body: 🚧 Started [test build](https://github.com/flathub-infra/vorarbeiter/actions/runs/14548395736).
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T10:50:47Z
body: 🚧 [Test build succeeded](https://github.com/flathub-infra/vorarbeiter/actions/runs/14548395736). To test this build, install it from the testing repository:

```
flatpak install --user https://dl.flathub.org/build-repo/179012/tech.feliciano.pocket-casts.flatpakref
```
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T11:14:33Z
body: 🚧 Test build enqueued.
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T11:14:46Z
body: 🚧 Started [test build](https://github.com/flathub-infra/vorarbeiter/actions/runs/14548590520).
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T11:19:11Z
body: 🚧 [Test build succeeded](https://github.com/flathub-infra/vorarbeiter/actions/runs/14548590520). To test this build, install it from the testing repository:

```
flatpak install --user https://dl.flathub.org/build-repo/179026/tech.feliciano.pocket-casts.flatpakref
```
author_association: NONE
user: login: ProjectSynchro
created_at: 2025-04-19T11:20:28Z
body: Thanks to @Ian2020's implementation in https://github.com/flatpak/flatpak-builder-tools/pull/382 pulling updates for the node dependencies that use git sources is trivial. 

I've updated the git submodule in use to track the gitrefs branch in their fork. When that PR is upstreamed this can be changed to the upstream https://github.com/flatpak/flatpak-builder-tools repo.

I ran a test build with the generated sources outputted by the script and all seems well as far as test building.
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2025-04-19T11:28:00Z
body: 🚧 Test build enqueued.
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T11:28:14Z
body: 🚧 Started [test build](https://github.com/flathub-infra/vorarbeiter/actions/runs/14548685614).
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T11:32:14Z
body: 🚧 Test build enqueued.
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T11:32:27Z
body: 🚧 [Test build](https://github.com/flathub-infra/vorarbeiter/actions/runs/14548685614) was cancelled.
author_association: NONE
user: login: flathubbot
created_at: 2025-04-19T11:32:41Z
body: 🚧 Started [test build](https://github.com/flathub-infra/vorarbeiter/actions/runs/14548716780).
author_association: NONE
user: login: ProjectSynchro
created_at: 2025-04-19T11:34:36Z
body: This is ready to go.

Here is a sample PR for an update from 0.10.1 to 0.10.2: https://github.com/ProjectSynchro/tech.feliciano.pocket-casts/pull/4

The generated commit is here: https://github.com/ProjectSynchro/tech.feliciano.pocket-casts/pull/4/commits/c04f4c22160766a4129829995a1002ae7920e3ed
author_association: CONTRIBUTOR
user: login: flathubbot
created_at: 2025-04-19T11:37:35Z
body: 🚧 [Test build succeeded](https://github.com/flathub-infra/vorarbeiter/actions/runs/14548716780). To test this build, install it from the testing repository:

```
flatpak install --user https://dl.flathub.org/build-repo/179039/tech.feliciano.pocket-casts.flatpakref
```
author_association: NONE