diff --git a/.gitignore b/.gitignore index 53cdaf5..56c7c8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .vscode goldwarden __pycache__ -.flatpak-builder \ No newline at end of file +.flatpak-builder +flatpak-pip-generator +repo \ No newline at end of file diff --git a/com.quexten.Goldwarden.yml b/com.quexten.Goldwarden.yml index 86ff204..5f7026d 100644 --- a/com.quexten.Goldwarden.yml +++ b/com.quexten.Goldwarden.yml @@ -24,20 +24,29 @@ finish-args: # biometric / user password auth - --system-talk-name=org.freedesktop.PolicyKit1 modules: - - name: goldwarden + - ./ui/python3-requirements.json + - name: wl-clipboard + buildsystem: simple + build-commands: + - meson setup build && cd build && ninja + - install -D build/src/wl-copy /app/bin/wl-copy + sources: + - type: git + url: https://github.com/bugaevc/wl-clipboard.git + - name: goldwarden-ui buildsystem: simple - build-options: - build-args: - - "--share=network" build-commands: - - pip3 install --prefix=/app tendo - - git clone https://github.com/bugaevc/wl-clipboard.git - - cd wl-clipboard && meson setup build && cd build && ninja - - install -D wl-clipboard/build/src/wl-copy /app/bin/wl-copy - install -D main.py /app/bin/main.py + - cp -R ./ /app/bin - install -D com.quexten.Goldwarden.desktop /app/share/applications/com.quexten.Goldwarden.desktop - install -D goldwarden.svg /app/share/icons/hicolor/scalable/apps/com.quexten.Goldwarden.svg - - cp -R ./ /app/bin/ sources: - type: dir - path: ui \ No newline at end of file + path: ui + - name: goldwarden + buildsystem: simple + build-commands: + - install -D goldwarden /app/bin/goldwarden + sources: + - type: file + path: goldwarden \ No newline at end of file diff --git a/ui/goldwarden.py b/ui/goldwarden.py index dca8047..b1dc9a5 100644 --- a/ui/goldwarden.py +++ b/ui/goldwarden.py @@ -2,7 +2,12 @@ import subprocess import json import os -BINARY_PATH = "/home/quexten/go/src/github.com/quexten/goldwarden/goldwarden" +# if flatpak +if os.path.exists("/app/bin/goldwarden"): + BINARY_PATH = "/app/bin/goldwarden" +else: + res = subprocess.run(["which", "goldwarden"]) + BINARY_PATH = res.stdout.decode("utf-8").strip() def set_api_url(url): restic_cmd = f"{BINARY_PATH} config set-api-url {url}" diff --git a/ui/python3-requirements.json b/ui/python3-requirements.json new file mode 100644 index 0000000..10db252 --- /dev/null +++ b/ui/python3-requirements.json @@ -0,0 +1,49 @@ +{ + "name": "python3-requirements", + "buildsystem": "simple", + "build-commands": [], + "modules": [ + { + "name": "python3-ChaCha20", + "buildsystem": "simple", + "build-commands": [ + "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"ChaCha20==1.1.1\" --no-build-isolation" + ], + "sources": [ + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/7d/93/2c5c7203bcb1ece177a49d14b32f0e0511f7d4eaf8446c15f7d64af082ad/ChaCha20-1.1.1.tar.gz", + "sha256": "6d6b1ef373058540369c14d2369ab14ee4ffaeae4dc53d8a18b5b617bd06c6bb" + } + ] + }, + { + "name": "python3-chacha20poly1305", + "buildsystem": "simple", + "build-commands": [ + "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"chacha20poly1305==0.0.3\" --no-build-isolation" + ], + "sources": [ + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/38/2c/5b4eb73c5cb30ded3082af025e76f529764971c57c02b101e842ff998f63/chacha20poly1305-0.0.3.tar.gz", + "sha256": "f2f005c7cf4638ffa4ff06c02c78748068b642916795c6d16c7cc5e355e70edf" + } + ] + }, + { + "name": "python3-tendo", + "buildsystem": "simple", + "build-commands": [ + "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"tendo==0.3.0\" --no-build-isolation" + ], + "sources": [ + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/ce/3f/761077d55732b0b1a673b15d4fdaa947a7c1eb5c9a23b7142df557019823/tendo-0.3.0-py3-none-any.whl", + "sha256": "026b70b355ea4c9da7c2123fa2d5c280c8983c1b34e329ff49260e2e78b93be7" + } + ] + } + ] +} \ No newline at end of file diff --git a/ui/requirements.txt b/ui/requirements.txt new file mode 100644 index 0000000..432025d --- /dev/null +++ b/ui/requirements.txt @@ -0,0 +1,3 @@ +ChaCha20==1.1.1 +chacha20poly1305==0.0.3 +tendo==0.3.0 \ No newline at end of file