---
app-id: org.onionshare.OnionShare
command: onionshare
runtime: org.kde.Platform
runtime-version: "5.15"
sdk: org.kde.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.golang
separate-locales: false
finish-args:
  - "--device=dri"
  - "--share=ipc"
  - "--share=network"
  - "--socket=wayland"
  - "--socket=x11"
  - "--talk-name=org.freedesktop.Flatpak"
  - "--talk-name=org.freedesktop.Notifications"
  - "--talk-name=org.freedesktop.secrets"
  - "--filesystem=home:ro"
  - "--filesystem=~/OnionShare:create"
  - "--filesystem=xdg-config/onionshare:create"
cleanup:
  - "/go"
  - "/bin/scripts"
modules:
  - name: pyside2
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
      - -DCMAKE_BUILD_TYPE=Release
      - -DBUILD_TESTS=OFF
    cleanup:
      - /bin
    sources:
      - type: archive
        sha256: f175c1d8813257904cf0efeb58e44f68d53b9916f73adaf9ce19514c0271c3fa
        url: https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-5.15.1-src/pyside-setup-opensource-src-5.15.1.tar.xz
      - type: shell
        commands:
          - mkdir -p /app/include/qt5tmp && cp -R /usr/include/Qt* /app/include/qt5tmp # https://bugreports.qt.io/browse/PYSIDE-787
          - sed -i 's|\(--include-paths=\)|\1/app/include/qt5tmp:|' sources/pyside2/cmake/Macros/PySideModules.cmake
  - name: tor
    buildsystem: simple
    build-commands:
      - "./configure --prefix=${FLATPAK_DEST}"
      - make
      - make install
    sources:
      - type: archive
        sha256: 22cba3794fedd5fa87afc1e512c6ce2c21bc20b4e1c6f8079d832dc1e545e733
        url: https://dist.torproject.org/tor-0.4.5.6.tar.gz
    modules:
      - name: libevent
        buildsystem: simple
        build-commands:
          - "./configure --prefix=${FLATPAK_DEST}"
          - make
          - make install
        sources:
          - type: archive
            url: https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
            sha256: 92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
  - name: obfs4proxy
    buildsystem: simple
    build-options:
      env:
        GOBIN: "/app/bin/"
        GO111MODULE: "off"
    build-commands:
      - ". /usr/lib/sdk/golang/enable.sh; GOPATH=$PWD go install gitlab.com/yawning/obfs4.git/obfs4proxy"
    sources:
      - type: git
        url: https://go.googlesource.com/net
        commit: 5f55cee0dc0dc168ce29222f077fe7fcd4be72c5
        dest: src/golang.org/x/net
      - type: git
        url: https://go.googlesource.com/crypto
        commit: 5ea612d1eb830b38bc4e914e37f55311eb58adce
        dest: src/golang.org/x/crypto
      - type: git
        url: https://go.googlesource.com/sys
        commit: 9a76102bfb4322425a1228caa377974426e82c84
        dest: src/golang.org/x/sys
      - type: git
        url: https://go.googlesource.com/text
        commit: 8f690f22cf1c026c950adddf3d45258bfd0912f0
        dest: src/golang.org/x/text
      - type: git
        url: https://gitlab.com/yawning/utls
        commit: 2dd4f38ff9e07464eb2748cc017eac1355e42251
        dest: src/gitlab.com/yawning/utls.git
      - type: git
        url: https://gitlab.com/yawning/obfs4
        commit: f638c33f6c6f697498150d5f0dfbf26453759262
        dest: src/gitlab.com/yawning/obfs4.git
      - type: git
        url: https://gitlab.com/yawning/bsaes
        commit: 0a714cd429ec754482b4001e918db30cd2094405
        dest: src/gitlab.com/yawning/bsaes.git
      - type: git
        url: https://github.com/dchest/siphash
        commit: a21c2e7914a8fe0db087fa007cbe804967665dfc
        dest: src/github.com/dchest/siphash
      - type: git
        url: https://github.com/dsnet/compress
        commit: da652975a8eea9fa0735aba8056747a751db0bd3
        dest: src/github.com/dsnet/compress
      - type: git
        url: https://git.torproject.org/pluggable-transports/goptlib
        commit: 781a46c66d2ddbc3509354ae7f1fccab74cb9927
        dest: src/git.torproject.org/pluggable-transports/goptlib.git
  - name: onionshare
    buildsystem: simple
    ensure-writable:
      - easy-install.pth
    build-commands:
      - python3 setup.py install --prefix=${FLATPAK_DEST}
      - install -D -m0644 org.onionshare.OnionShare.appdata.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.appdata.xml
      - install -D -m0644 org.onionshare.OnionShare.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/org.onionshare.OnionShare.svg
      - install -D -m0644 org.onionshare.OnionShare.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
    sources:
      - type: dir
        path: ../desktop/src
    modules:
      - name: python3-qrcode
        buildsystem: simple
        build-commands:
          - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
            "qrcode"
        sources:
          - type: file
            url: https://files.pythonhosted.org/packages/19/d5/6c7d4e103d94364d067636417a77a6024219c58cd6e9f428ece9b5061ef9/qrcode-6.1.tar.gz
            sha256: 505253854f607f2abf4d16092c61d4e9d511a3b4392e60bff957a68592b04369
      - name: onionshare-cli
        buildsystem: simple
        build-commands:
          - python3 setup.py install --prefix=${FLATPAK_DEST}
        sources:
          - type: dir
            path: ../cli
        modules:
          - name: python3-click
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "click"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/27/6f/be940c8b1f1d69daceeb0032fee6c34d7bd70e3e649ccac0951500b4720e/click-7.1.2.tar.gz
                sha256: d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a
          - name: python3-flask
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "flask"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/4f/e7/65300e6b32e69768ded990494809106f87da1d436418d5f1367ed3966fd7/Jinja2-2.11.3.tar.gz
                sha256: a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6
              - type: file
                url: https://files.pythonhosted.org/packages/27/6f/be940c8b1f1d69daceeb0032fee6c34d7bd70e3e649ccac0951500b4720e/click-7.1.2.tar.gz
                sha256: d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a
              - type: file
                url: https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz
                sha256: 29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b
              - type: file
                url: https://files.pythonhosted.org/packages/68/1a/f27de07a8a304ad5fa817bbe383d1238ac4396da447fa11ed937039fa04b/itsdangerous-1.1.0.tar.gz
                sha256: 321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19
              - type: file
                url: https://files.pythonhosted.org/packages/4e/0b/cb02268c90e67545a0e3a37ea1ca3d45de3aca43ceb7dbf1712fb5127d5d/Flask-1.1.2.tar.gz
                sha256: 4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060
              - type: file
                url: https://files.pythonhosted.org/packages/10/27/a33329150147594eff0ea4c33c2036c0eadd933141055be0ff911f7f8d04/Werkzeug-1.0.1.tar.gz
                sha256: 6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c
          - name: python3-flask-httpauth
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "flask-httpauth"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/4f/e7/65300e6b32e69768ded990494809106f87da1d436418d5f1367ed3966fd7/Jinja2-2.11.3.tar.gz
                sha256: a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6
              - type: file
                url: https://files.pythonhosted.org/packages/27/6f/be940c8b1f1d69daceeb0032fee6c34d7bd70e3e649ccac0951500b4720e/click-7.1.2.tar.gz
                sha256: d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a
              - type: file
                url: https://files.pythonhosted.org/packages/2d/6a/e458a74c909899d136aa76cb4d707f0f600fba6ca0d603de681e8fcac91f/Flask-HTTPAuth-4.2.0.tar.gz
                sha256: 8c7e49e53ce7dc14e66fe39b9334e4b7ceb8d0b99a6ba1c3562bb528ef9da84a
              - type: file
                url: https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz
                sha256: 29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b
              - type: file
                url: https://files.pythonhosted.org/packages/68/1a/f27de07a8a304ad5fa817bbe383d1238ac4396da447fa11ed937039fa04b/itsdangerous-1.1.0.tar.gz
                sha256: 321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19
              - type: file
                url: https://files.pythonhosted.org/packages/4e/0b/cb02268c90e67545a0e3a37ea1ca3d45de3aca43ceb7dbf1712fb5127d5d/Flask-1.1.2.tar.gz
                sha256: 4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060
              - type: file
                url: https://files.pythonhosted.org/packages/10/27/a33329150147594eff0ea4c33c2036c0eadd933141055be0ff911f7f8d04/Werkzeug-1.0.1.tar.gz
                sha256: 6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c
          - name: python3-flask-socketio
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "flask-socketio"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/06/7f/7496b6684e2b8eadb150555fa979497303459a31cb7dc592a5da51900090/Flask-SocketIO-5.0.1.tar.gz
                sha256: 5c4319f5214ada20807857dc8fdf3dc7d2afe8d6dd38f5c516c72e2be47d2227
              - type: file
                url: https://files.pythonhosted.org/packages/4f/e7/65300e6b32e69768ded990494809106f87da1d436418d5f1367ed3966fd7/Jinja2-2.11.3.tar.gz
                sha256: a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6
              - type: file
                url: https://files.pythonhosted.org/packages/27/6f/be940c8b1f1d69daceeb0032fee6c34d7bd70e3e649ccac0951500b4720e/click-7.1.2.tar.gz
                sha256: d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a
              - type: file
                url: https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz
                sha256: 29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b
              - type: file
                url: https://files.pythonhosted.org/packages/68/1a/f27de07a8a304ad5fa817bbe383d1238ac4396da447fa11ed937039fa04b/itsdangerous-1.1.0.tar.gz
                sha256: 321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19
              - type: file
                url: https://files.pythonhosted.org/packages/4e/0b/cb02268c90e67545a0e3a37ea1ca3d45de3aca43ceb7dbf1712fb5127d5d/Flask-1.1.2.tar.gz
                sha256: 4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060
              - type: file
                url: https://files.pythonhosted.org/packages/bd/7c/83fbbc8568be511bc48704b97ef58f67ff2ab85ec4fcd1dad12cd2323c32/bidict-0.21.2.tar.gz
                sha256: 4fa46f7ff96dc244abfc437383d987404ae861df797e2fd5b190e233c302be09
              - type: file
                url: https://files.pythonhosted.org/packages/10/27/a33329150147594eff0ea4c33c2036c0eadd933141055be0ff911f7f8d04/Werkzeug-1.0.1.tar.gz
                sha256: 6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c
              - type: file
                url: https://files.pythonhosted.org/packages/37/91/7713854e0741f807c38ef084169b489ff6e87b24d1d9ba1e943bb9e10b8b/python-socketio-5.0.4.tar.gz
                sha256: f53fd0d5bd9f75a70492062f4ae6195ab5d34d67a29024d740f25e468392893e
              - type: file
                url: https://files.pythonhosted.org/packages/92/e8/2dd4bd782b593adcc0bdce0675fe92016c3ffca061202142fcf1e55cbf6a/python-engineio-4.0.0.tar.gz
                sha256: 9f34afa4170f5ba6e3d9ff158752ccf8fbb2145f16554b2f0fc84646675be99a
              - type: file
                url: https://files.pythonhosted.org/packages/12/68/95515eaff788370246dac534830ea9ccb0758e921ac9e9041996026ecaf2/setuptools-53.0.0.tar.gz
                sha256: 1b18ef17d74ba97ac9c0e4b4265f123f07a8ae85d9cd093949fa056d3eeeead5
              - type: file
                url: https://files.pythonhosted.org/packages/ed/46/e298a50dde405e1c202e316fa6a3015ff9288423661d7ea5e8f22f589071/wheel-0.36.2.tar.gz
                sha256: e11eefd162658ea59a60a0f6c7d493a7190ea4b9a85e335b33489d9f17e0245e
              - type: file
                url: https://files.pythonhosted.org/packages/af/df/f8aa8a78d4d29e0cffa4512e9bc223ed02f24893fe1837c6cee2749ebd67/setuptools_scm-5.0.1.tar.gz
                sha256: c85b6b46d0edd40d2301038cdea96bb6adc14d62ef943e75afb08b3e7bcf142a
          - name: python3-psutil
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "psutil"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/e1/b0/7276de53321c12981717490516b7e612364f2cb372ee8901bd4a66a000d7/psutil-5.8.0.tar.gz
                sha256: 0c9ccb99ab76025f2f0bbecf341d4656e9c1351db8cc8a03ccd62e318ab4b5c6
          - name: python3-pycryptodome
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "pycryptodome"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/88/7f/740b99ffb8173ba9d20eb890cc05187677df90219649645aca7e44eb8ff4/pycryptodome-3.10.1.tar.gz
                sha256: 3e2e3a06580c5f190df843cdb90ea28d61099cf4924334d5297a995de68e4673
          - name: python3-pysocks
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "pysocks"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/bd/11/293dd436aea955d45fc4e8a35b6ae7270f5b8e00b53cf6c024c83b657a11/PySocks-1.7.1.tar.gz
                sha256: 3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0
          - name: python3-requests
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "requests"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/d7/8d/7ee68c6b48e1ec8d41198f694ecdc15f7596356f2ff8e6b1420300cf5db3/urllib3-1.26.3.tar.gz
                sha256: de3eedaad74a2683334e282005cd8d7f22f4d55fa690a2a1020a416cb0a47e73
              - type: file
                url: https://files.pythonhosted.org/packages/ee/2d/9cdc2b527e127b4c9db64b86647d567985940ac3698eeabc7ffaccb4ea61/chardet-4.0.0.tar.gz
                sha256: 0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa
              - type: file
                url: https://files.pythonhosted.org/packages/06/a9/cd1fd8ee13f73a4d4f491ee219deeeae20afefa914dfb4c130cfc9dc397a/certifi-2020.12.5.tar.gz
                sha256: 1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c
              - type: file
                url: https://files.pythonhosted.org/packages/6b/47/c14abc08432ab22dc18b9892252efaf005ab44066de871e72a38d6af464b/requests-2.25.1.tar.gz
                sha256: 27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804
              - type: file
                url: https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
                sha256: b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6
          - name: python3-stem
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "stem"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/71/bd/ab05ffcbfe74dca704e860312e00c53ef690b1ddcb23be7a4d9ea4f40260/stem-1.8.0.tar.gz
                sha256: a0b48ea6224e95f22aa34c0bc3415f0eb4667ddeae3dfb5e32a6920c185568c2
          - name: python3-unidecode
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "unidecode"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/cd/31/245d8a384939aa0ee152c76fc62890f79f35fc41cd12839f5df268d9081d/Unidecode-1.2.0.tar.gz
                sha256: 8d73a97d387a956922344f6b74243c2c6771594659778744b2dbdaad8f6b727d
          - name: python3-urllib3
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "urllib3"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/d7/8d/7ee68c6b48e1ec8d41198f694ecdc15f7596356f2ff8e6b1420300cf5db3/urllib3-1.26.3.tar.gz
                sha256: de3eedaad74a2683334e282005cd8d7f22f4d55fa690a2a1020a416cb0a47e73
          - name: python3-eventlet
            buildsystem: simple
            build-commands:
              - pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST}
                "eventlet"
            sources:
              - type: file
                url: https://files.pythonhosted.org/packages/40/9c/bd7bc0202a84012a4b6b653b54a389ef48bc7f13ce628865357ffdf37160/eventlet-0.30.1.tar.gz
                sha256: d00649a7e17de0bcddff1a96311ed3baf1b295b3223d4b71aceafe7b45e6d6f8
              - type: file
                url: https://files.pythonhosted.org/packages/ec/c5/14bcd63cb6d06092a004793399ec395405edf97c2301dfdc146dfbd5beed/dnspython-1.16.0.zip
                sha256: 36c5e8e38d4369a08b6780b7f27d790a292b2b08eea01607865bf0936c558e01
              - type: file
                url: https://files.pythonhosted.org/packages/92/be/878cc5314fa5aadce33e68738c1a24debe317605196bdfc2049e66bc9c30/greenlet-1.0.0.tar.gz
                sha256: 719e169c79255816cdcf6dccd9ed2d089a72a9f6c42273aae12d55e8d35bdcf8
