# Flatpak manifest for the native webview build of Relibre
# Build with:
#   flatpak-builder --user --install --force-clean build-dir com.circlewithadot.Relibre.yml
#   flatpak run com.circlewithadot.Relibre
app-id: com.circlewithadot.Relibre
runtime: org.gnome.Platform
runtime-version: '46'
sdk: org.gnome.Sdk
command: relibre
finish-args:
  # WebKitGTK needs network; your app also runs a localhost HTTP server
  - --share=network
  # UI backends
  - --socket=wayland
  - --socket=fallback-x11
  # Allow saving to Downloads (your /save endpoint writes there)
  - --filesystem=xdg-download
  # Optional: allow opening files via portal
  - --talk-name=org.freedesktop.portal.Desktop

modules:
  # Build your Go app inside the sandbox
  - name: relibre
    buildsystem: simple
    build-commands:
      # Ensure modules cached and vendor if you like (optional)
      - go env -w CGO_ENABLED=1
      - go mod download
      # Build the binary into /app/bin
      - go build -trimpath -ldflags "-s -w" -o /app/bin/relibre
      # Install desktop file and icon
      - install -Dm644 dist/com.circlewithadot.Relibre.desktop /app/share/applications/com.circlewithadot.Relibre.desktop
      - install -Dm644 dist/com.circlewithadot.Relibre.png /app/share/icons/hicolor/512x512/apps/com.circlewithadot.Relibre.png
    sources:
      # Use the current directory as source (assuming manifest sits at repo root)
      - type: dir
        path: .
