{
 "app_id": "io.github.troyeguo.koodo-reader",
 "source_url": "https://raw.githubusercontent.com/flathub/io.github.troyeguo.koodo-reader/master/io.github.troyeguo.koodo-reader.yml",
 "runtime": "org.freedesktop.Platform",
 "runtime_version": "25.08",
 "sdk": "org.freedesktop.Sdk",
 "finish_args": [
  "--share=ipc",
  "--share=network",
  "--socket=fallback-x11",
  "--socket=pulseaudio",
  "--socket=wayland",
  "--device=dri",
  "--filesystem=home:ro"
 ],
 "module_count": 1,
 "fetched_at": "2026-09-17T16:12:26.536959+00:00",
 "manifest": {
  "app-id": "io.github.troyeguo.koodo-reader",
  "runtime": "org.freedesktop.Platform",
  "runtime-version": "25.08",
  "sdk": "org.freedesktop.Sdk",
  "base": "org.electronjs.Electron2.BaseApp",
  "base-version": "25.08",
  "sdk-extensions": [
   "org.freedesktop.Sdk.Extension.node22"
  ],
  "command": "koodo",
  "finish-args": [
   "--device=dri",
   "--share=ipc",
   "--share=network",
   "--socket=wayland",
   "--socket=fallback-x11",
   "--socket=pulseaudio",
   "--filesystem=home:ro"
  ],
  "cleanup": [
   "/bin/*.py",
   "/include",
   "/lib/pkgconfig",
   "/share/man",
   "*.la",
   "*.a"
  ],
  "modules": [
   {
    "name": "koodo",
    "buildsystem": "simple",
    "build-options": {
     "append-path": "/usr/lib/sdk/node22/bin:/run/build/koodo/flatpak-node/chromedrive",
     "env": {
      "XDG_CACHE_HOME": "/run/build/koodo/flatpak-node/cache",
      "npm_config_offline": "true",
      "npm_config_no_save": "true",
      "npm_config_cache": "/run/build/koodo/flatpak-node/npm-cache",
      "npm_config_loglevel": "verbose",
      "ELECTRON_SKIP_BINARY_DOWNLOAD": "true",
      "LENS_SKIP_DOWNLOAD_BINARIES": "true"
     },
     "arch": {
      "x86_64": {
       "env": {
        "npm_config_arch": "x64",
        "npm_config_target_arch": "x64"
       }
      },
      "aarch64": {
       "env": {
        "npm_config_arch": "arm64",
        "npm_config_target_arch": "arm64"
       }
      }
     }
    },
    "build-commands": [
     "HOME=$PWD yarn config --offline set yarn-offline-mirror $FLATPAK_BUILDER_BUILDDIR/flatpak-node/yarn-mirror",
     "set -e\nexport HOME=$PWD\n# Install dependencies without running install scripts; native modules are\n# rebuilt against the bundled Electron below using the matching V8 headers.\nyarn --offline --ignore-scripts\n# Resolve the bundled Electron version and point node-gyp at the cached\n# headers (flatpak-node/cache/node-gyp/<version>, produced by\n# flatpak-node-generator --electron-node-headers). Native modules must link\n# against Electron's V8 ABI, not the SDK Node's, otherwise dlopen fails at\n# runtime with \"undefined symbol\" (e.g. v8::String::Utf8Value changed its\n# signature in V8 13.x / Electron 34).\nELECTRON_VERSION=$(node -p \"require('./node_modules/electron/package.json').version\")\nexport npm_config_target=$ELECTRON_VERSION\nexport npm_config_runtime=electron\nexport npm_config_nodedir=$FLATPAK_BUILDER_BUILDDIR/flatpak-node/cache/node-gyp/$ELECTRON_VERSION\n# @electron/rebuild does not follow XDG; mirror the node-gyp cache to\n# ~/.electron-gyp so it finds the pre-cached Electron headers offline.\nln -sf \"$XDG_CACHE_HOME/node-gyp\" \"$HOME/.electron-gyp\"\n# Re-run the project's postinstall that --ignore-scripts skipped, then\n# rebuild native modules against Electron.\nnode scripts/patch-nan.js\n# cpu-features (optional dep of ssh2) ships a gyp setup that fails under\n# @electron/node-gyp (\"buildcheck.gypi not found\"). It is optional: ssh2\n# falls back to its pure-JS crypto path without it. Drop it so only the\n# modules that actually need an Electron build (better-sqlite3) are built.\nrm -rf node_modules/cpu-features\nnpx electron-builder install-app-deps\n# Build the renderer and package for Linux.\nyarn run build\nnpx electron-builder --linux dir --${npm_config_arch}\n",
     "cp -r dist/linux-*unpacked ${FLATPAK_DEST}/koodo",
     "install -Dm644 io.github.troyeguo.koodo-reader.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop",
     "install -Dm755 koodo.sh ${FLATPAK_DEST}/bin/koodo",
     "install -Dm644 io.github.troyeguo.koodo-reader.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml",
     "install -Dm644 assets/icons/256x256.png ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png",
     "APP_LOCALES_ROOT=\"${FLATPAK_DEST}/koodo/locales\"\n  RUNTIME_LOCALES_ROOT=\"${FLATPAK_DEST}/share/runtime/locale\"\n  if [ -d \"${APP_LOCALES_ROOT}\" ]; then\n    for lang in \"${APP_LOCALES_ROOT}\"/*.pak; do\n      LOCALE=\"$(basename -s .pak \"${lang}\")\"\n      runtime_locale_dir=\"${RUNTIME_LOCALES_ROOT}/${LOCALE%%-*}/\"\n      install -Dm644 -t \"${runtime_locale_dir}\" \"${lang}\"\n      ln -sf \"${runtime_locale_dir}/$(basename \"${lang}\")\" \"${APP_LOCALES_ROOT}/$(basename \"${lang}\")\"\n    done\n  fi\n"
    ],
    "sources": [
     {
      "type": "git",
      "url": "https://github.com/koodo-reader/koodo-reader.git",
      "tag": "v2.4.3",
      "commit": "97a6a0fe28c4b9c0737a575b48556cb403de6ccb",
      "x-checker-data": {
       "type": "anitya",
       "project-id": 328157,
       "stable-only": true,
       "tag-template": "v$version"
      }
     },
     {
      "type": "script",
      "dest-filename": "koodo.sh",
      "commands": [
       "set -oue pipefail",
       "export FLATPAK_ID=\"${FLATPAK_ID:-io.github.troyeguo.koodo-reader}\"",
       "export TMPDIR=\"${XDG_RUNTIME_DIR}/app/${FLATPAK_ID}\"",
       "export SNAP=/app/koodo",
       "exec zypak-wrapper /app/koodo/koodo-reader --ozone-platform-hint=auto --enable-wayland-ime --wayland-text-input-version=3 $@"
      ]
     },
     {
      "type": "file",
      "path": "io.github.troyeguo.koodo-reader.metainfo.xml"
     },
     {
      "type": "file",
      "path": "io.github.troyeguo.koodo-reader.desktop"
     },
     "generated-sources.json"
    ]
   }
  ]
 }
}